Loading neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp +12 −7 Original line number Diff line number Diff line Loading @@ -66,8 +66,8 @@ void copy_back(MixedTyped* dst, const std::vector<RequestArgument>& ra, char* sr // Top level driver for models and examples generated by test_generator.py // Test driver for those generated from ml/nn/runtime/test/spec void EvaluatePreparedModel(sp<IPreparedModel>& preparedModel, std::function<bool(int)> is_ignored, const std::vector<MixedTypedExampleType>& examples, float fpRange = 1e-5f) { const std::vector<MixedTypedExampleType>& examples, float fpAtol = 1e-5f, float fpRtol = 1e-5f) { const uint32_t INPUT = 0; const uint32_t OUTPUT = 1; Loading Loading @@ -175,7 +175,7 @@ void EvaluatePreparedModel(sp<IPreparedModel>& preparedModel, std::function<bool MixedTyped filtered_test = filter(test, is_ignored); // We want "close-enough" results for float compare(filtered_golden, filtered_test, fpRange); compare(filtered_golden, filtered_test, fpAtol, fpRtol); } } Loading Loading @@ -220,7 +220,8 @@ void Execute(const sp<V1_0::IDevice>& device, std::function<V1_0::Model(void)> c EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus); ASSERT_NE(nullptr, preparedModel.get()); EvaluatePreparedModel(preparedModel, is_ignored, examples); float fpAtol = 1e-5f, fpRtol = 5.0f * 1.1920928955078125e-7f; EvaluatePreparedModel(preparedModel, is_ignored, examples, fpAtol, fpRtol); } void Execute(const sp<V1_1::IDevice>& device, std::function<V1_1::Model(void)> create_model, Loading Loading @@ -265,9 +266,13 @@ void Execute(const sp<V1_1::IDevice>& device, std::function<V1_1::Model(void)> c EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus); ASSERT_NE(nullptr, preparedModel.get()); // If in relaxed mode, set the error range to be 5ULP of FP16. float fpRange = !model.relaxComputationFloat32toFloat16 ? 1e-5f : 5.0f * 0.0009765625f; EvaluatePreparedModel(preparedModel, is_ignored, examples, fpRange); // TODO: Adjust the error limit based on testing. // If in relaxed mode, set the absolute tolerance to be 5ULP of FP16. float fpAtol = !model.relaxComputationFloat32toFloat16 ? 1e-5f : 5.0f * 0.0009765625f; // Set the relative tolerance to be 5ULP of the corresponding FP precision. float fpRtol = !model.relaxComputationFloat32toFloat16 ? 5.0f * 1.1920928955078125e-7f : 5.0f * 0.0009765625f; EvaluatePreparedModel(preparedModel, is_ignored, examples, fpAtol, fpRtol); } } // namespace generated_tests Loading Loading
neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp +12 −7 Original line number Diff line number Diff line Loading @@ -66,8 +66,8 @@ void copy_back(MixedTyped* dst, const std::vector<RequestArgument>& ra, char* sr // Top level driver for models and examples generated by test_generator.py // Test driver for those generated from ml/nn/runtime/test/spec void EvaluatePreparedModel(sp<IPreparedModel>& preparedModel, std::function<bool(int)> is_ignored, const std::vector<MixedTypedExampleType>& examples, float fpRange = 1e-5f) { const std::vector<MixedTypedExampleType>& examples, float fpAtol = 1e-5f, float fpRtol = 1e-5f) { const uint32_t INPUT = 0; const uint32_t OUTPUT = 1; Loading Loading @@ -175,7 +175,7 @@ void EvaluatePreparedModel(sp<IPreparedModel>& preparedModel, std::function<bool MixedTyped filtered_test = filter(test, is_ignored); // We want "close-enough" results for float compare(filtered_golden, filtered_test, fpRange); compare(filtered_golden, filtered_test, fpAtol, fpRtol); } } Loading Loading @@ -220,7 +220,8 @@ void Execute(const sp<V1_0::IDevice>& device, std::function<V1_0::Model(void)> c EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus); ASSERT_NE(nullptr, preparedModel.get()); EvaluatePreparedModel(preparedModel, is_ignored, examples); float fpAtol = 1e-5f, fpRtol = 5.0f * 1.1920928955078125e-7f; EvaluatePreparedModel(preparedModel, is_ignored, examples, fpAtol, fpRtol); } void Execute(const sp<V1_1::IDevice>& device, std::function<V1_1::Model(void)> create_model, Loading Loading @@ -265,9 +266,13 @@ void Execute(const sp<V1_1::IDevice>& device, std::function<V1_1::Model(void)> c EXPECT_EQ(ErrorStatus::NONE, prepareReturnStatus); ASSERT_NE(nullptr, preparedModel.get()); // If in relaxed mode, set the error range to be 5ULP of FP16. float fpRange = !model.relaxComputationFloat32toFloat16 ? 1e-5f : 5.0f * 0.0009765625f; EvaluatePreparedModel(preparedModel, is_ignored, examples, fpRange); // TODO: Adjust the error limit based on testing. // If in relaxed mode, set the absolute tolerance to be 5ULP of FP16. float fpAtol = !model.relaxComputationFloat32toFloat16 ? 1e-5f : 5.0f * 0.0009765625f; // Set the relative tolerance to be 5ULP of the corresponding FP precision. float fpRtol = !model.relaxComputationFloat32toFloat16 ? 5.0f * 1.1920928955078125e-7f : 5.0f * 0.0009765625f; EvaluatePreparedModel(preparedModel, is_ignored, examples, fpAtol, fpRtol); } } // namespace generated_tests Loading