MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TestFloatHardSwish

Function TestFloatHardSwish

tensorflow/lite/kernels/activations_test.cc:294–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294void TestFloatHardSwish(int size, std::minstd_rand* random_engine) {
295 std::vector<float> float_input_values;
296 const float kMin = -10.0f;
297 const float kMax = 10.0f;
298 GenerateUniformRandomVector(size, kMin, kMax, random_engine,
299 &float_input_values);
300 std::vector<float> float_ref_output_values;
301 EvalTestReferenceHardSwish(size, float_input_values,
302 &float_ref_output_values);
303 FloatActivationsOpModel m(BuiltinOperator_HARD_SWISH,
304 /*input=*/{TensorType_FLOAT32, {1, 1, 1, size}},
305 /*output=*/{TensorType_FLOAT32, {1, 1, 1, size}});
306 m.SetInput(float_input_values);
307
308 m.Invoke();
309 EXPECT_THAT(m.GetOutput(),
310 ElementsAreArray(ArrayFloatNear(float_ref_output_values)));
311}
312
313template <typename QuantizedType>
314void TestQuantizedHardSwish(TensorType tensor_type, int size, float input_min,

Callers 1

TESTFunction · 0.85

Calls 6

ArrayFloatNearFunction · 0.70
SetInputMethod · 0.45
InvokeMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected