summaryrefslogtreecommitdiff
path: root/nn/runtime/test
AgeCommit message (Collapse)Author
2020-04-30Fix null ptr dereference in squeeze cpu implementation.Przemysław Szczepaniak
Squeeze, when used on a single-value tensor with 1s in each dimension, will result in zero-sized tensor without dimensions. This change fixes it, by making its output a tensor of size [1]. Bug: 155238914 Test: squeeze_b155238914.mod.py run on coral. Change-Id: Ia5bf655c647084d9fa094ae8a2048917a8237b81
2020-04-29Fix NNAPI TimingTestsMichael Butler
This CL fixes the ordering of sequences in the test. Specifically: 1) Causes the spin-loop in waitForExecutionToBegin to spin while the execution has not yet started 2) Adds dummyExecution() to the driver implementations of FAIL_LAUNCH 3) Skips getDurationWhileRunning for all DriverKind::CPU test cases Further, this CL adds dummyExecution() to TestPreparedModelLatest::executeFenced to ensure the call to executeFenced will not complete until after the test has called getDuration. This brings executeFenced in line with the other execution methods which call dummyExecution(). Finally, this CL has the following two minor changes: 1) code that was previously running from a detached thread in executeFenced now instead runs synchronously 2) a for-loop that iterated by constant reference now instead iterates by constant value Fixes: 155215099 Test: mma Test: NeuralNetworksTest_static --gtest_filter=Fenced/TimingTest* Change-Id: I69a7448367ce8353791c9462d144122b6c913802
2020-04-29Merge "Fix validateRequest with unknown rank in model." into rvc-devXusong Wang
2020-04-29Regenerate tests.Xusong Wang
Bug: 140641425 Test: NNT_static Change-Id: I3e037df067125b04efbd73f6d84da228d5e24f7a
2020-04-29Re-enable tests that are previously disabled.Xusong Wang
Bug: 140641425 Bug: 151328024 Bug: 152446228 Bug: 152445711 Bug: 152446298 Fixes: 152446228 Test: NNT_static Test: NNT_static_fuzzing Change-Id: Ifd1f45a2b058fe9996dca817a067ce2ad6d47b46
2020-04-29Fix validateRequest with unknown rank in model.Xusong Wang
This CL also re-enables TestUnspecifiedDimensions, which will trigger the bug in validateRequest when sample driver is deployed. Bug: 141294076 Fixes: 155228680 Test: NNT_static with sample driver Change-Id: I268eb67bda8933be180bd58b604ee76b72577697
2020-04-29Merge "Add STRIDED_SLICE validations on neg stride with shrinkMask." into ↵Xusong Wang
rvc-dev
2020-04-28Add STRIDED_SLICE validations on neg stride with shrinkMask.Xusong Wang
Fixes: 154639297 Test: NNT_static Test: NNT_static_fuzzing Change-Id: I2b37dd7fe07f3239682b5bc7f7cef0ae76134ad0
2020-04-28Skip TestRemoveDefaultArguments tests for useCpuOnly = 1Miao Wang
- The tests require mTestDevice being valid to perform the tests, while useCpuOnly will only allow CPU fallback path. Fixes: 155229031 Test: mm Test: NeuralNetworksTest_static Change-Id: Ic866d14de39d0c8f52648ad319bac14bc8fdd666
2020-04-27Create tests for VersionedInterfaces errorsMichael Butler
This CL introduces the following kinds of tests: * device creation and initialization errors * "normal" functional positive and negative tests * HIDL transport error tests * mock service crash tests Fixes: 139189546 Bug: 129572750 Test: mma Test: atest NeuralNetworksTest_static Change-Id: I3e1eb5433732695572044a74f1529ffc9c3a1982
2020-04-24Fix "#define VERBOSE" bit-rot (build failure)David Gross
Test: Build NeuralNetworksTest_static both normally and with #define VERBOSE uncommented in TestPartitioningRandom.cpp Bug: 136735929 Change-Id: I79e33239b63885b050d77b5a819b7be82a80528e
2020-04-22Merge "Add NNT_static internal tests for device memory allocation." into rvc-devXusong Wang
2020-04-22Merge changes I85577481,I43ed11e9 into rvc-devXusong Wang
* changes: Add STRIDED_SLICE with shrinkMask in RGG tests. Increase the fp precision in dumped spec.
2020-04-21Add STRIDED_SLICE with shrinkMask in RGG tests.Xusong Wang
Fixes: 132322549 Test: NNT_static_fuzzing Change-Id: I85577481125e131741992e9d896d12320af67e1a
2020-04-21Merge "Disable a non-sensible RGG test case." into rvc-devXusong Wang
2020-04-20Disable a non-sensible RGG test case.Xusong Wang
In this test, the RGG produces a non-sensible graph with extreme large output gain and highly clamped output range. Fixes: 153690038 Test: NNT_static_fuzzing Change-Id: I7063730e04ea8a18aecd20029eb6e726ac780c2a
2020-04-17Add NNT_static internal tests for device memory allocation.Xusong Wang
These tests use a customized IDevice to test the device memory allocation and fallback logic. This CL also allows the runtime to dispatch device memory allocation with dynamic shape to drivers. Additionally, this CL fixes a bug that a failed device memory allocation will return BAD_DATA -- it should return OP_FAILED instead. Bug: 152209365 Test: NNT_static Change-Id: I1facb2dad345958c3b9b1bab4a9564085c382c4a
2020-04-17Merge "Add a WHILE test with unused outputs" into rvc-devSlava Shklyaev
2020-04-16Merge "Fix failures in TensorRankConstraint Tests" into rvc-devTreeHugger Robot
2020-04-15Fix failures in TensorRankConstraint TestsStefano Galarraga
Fix sporadic failures in CtsNNAPITestCases.TensorRankConstraint tests. Improves description of expectation failures when comparing OperandTypeWithExtraParams instances. Test: CtsNNAPITestCases Bug: 154093710 Change-Id: Ia2b8bc914892f2ff7908d247fa26743fa242f783
2020-04-15Add a WHILE test with unused outputsSlava Shklyaev
Fix: 148208229 Test: NNT_static Change-Id: I853f1f294cedacb0cbb810042ef2a3466a072ffe
2020-04-15Add operand type variations for WHILE testsSlava Shklyaev
Bug: 149199424 Test: NNT_static Test: VTS 1.3 Change-Id: I887be1b8530aad4568db9e75d3260b6b78884d23
2020-04-14Merge "Add WHILE tests with CONSTANT_REFERENCE inputs" into rvc-devTreeHugger Robot
2020-04-13Merge "Compute RGG golden results from FP model." into rvc-devXusong Wang
2020-04-09Merge "Add some V1_3 operations to Seed/RandomPartitioningTest.*" into rvc-devDavid Gross
2020-04-09Add WHILE tests with CONSTANT_REFERENCE inputsSlava Shklyaev
Before this change, we only had tests with CONSTANT_COPY constant inputs (the default). This change adds CONSTANT_REFERENCE counterparts of those tests. Bug: 137836124 Test: NNT_static Change-Id: If6a0b897636f49b19ac7ccc1bc7ded3eee764744
2020-04-08Add some V1_3 operations to Seed/RandomPartitioningTest.*David Gross
Note that this change potentially changes EVERY pseudorandom test case in this particular test set. Test: NeuralNetworksTest_static --gtest_filter=Seed/RandomPartitioningTest.* Also verified that some randomly generated graphs include the newly-added V1_3 operations. Bug: 141704808 Change-Id: Ib762c5fe8f7c42825025a6e57b61631040e0911a
2020-04-08Merge changes I54642338,Ica52243a into rvc-devXusong Wang
* changes: Prevent RGG from generating NaN values. Add broadcast with different ranks in RGG.
2020-04-07Merge "Fix control flow partial CPU fallback bug" into rvc-devTreeHugger Robot
2020-04-07Merge "Handle CONSTANT_REFERENCEs in generated CTS tests" into rvc-devTreeHugger Robot
2020-04-07Merge "Fix HARD_SWISH rank requirement" into rvc-devTreeHugger Robot
2020-04-07Compute RGG golden results from FP model.Xusong Wang
Before this CL, the golden results in RGG tests are computed from nnapi-reference with the actual data type. This CL changes the logic to compute the golden results from an equivalent float32 model to avoid bias if possible. Currently only the golden results of single-operation models are computed from fp32 models. This is because there is no multi-operation quant model in RGG tests yet. Fixes: 150805665 Test: NNT_static Change-Id: I4e268d3aadeebdcdae1d7010a4d0564f45b11b82
2020-04-07Prevent RGG from generating NaN values.Xusong Wang
This CL introduces "ValueProperty" to RGG, which defines the required properties of input values as well as the guaranteed properties of the output values. During the graph generation process, an operation input may only be wired to an operation output with compatible properties. E.g., the input of SQRT will not come from CONV_2D because CONV_2D cannot guarantee non-negative output values; while it could come from RELU because RELU guarantees that the output values are always non-negative. Additionally, fixes the issue that REDUCE_PROD may generate NaN values because 0 * inf evaluates to NaN in C++. Bug: 145188288 Bug: 150805665 Test: NNT_static_fuzzing Change-Id: I5464233839a91afbe2022b8fe603e4296825a7a4
2020-04-07Add broadcast with different ranks in RGG.Xusong Wang
Fixes: 132323699 Test: NNT_static_fuzzing Change-Id: Ica52243ad5fda8d290289febea8ab4f1206dab36
2020-04-07Handle CONSTANT_REFERENCEs in generated CTS testsSlava Shklyaev
Fix: 152963626 Test: NNT_static Change-Id: Ie4d003d071533479719f7b73f792d00eb62de145
2020-04-07Add operand type variations for IF testsSlava Shklyaev
Bug: 149199424 Test: NNT_static Change-Id: If6ae373876fa309580198526d44018576a4ebdd1
2020-04-07Add SUBGRAPH support for DataTypeConverterSlava Shklyaev
The following construct is used to specify subgraph conversions: converter = DataTypeConverter().Identify({ op1: (target_type, target_scale, target_zero_point), ... subgraphOp: DataTypeConverter().Identify({ ... }), }) Implicit conversion is supported as well. Bug: 149199424 Test: NNT_static Change-Id: I3f28d36159f19a50e50bc6f438bb98331f77a5f9
2020-04-07Merge "Add more tests for getOutputOperand*() and for burst and fenced ↵TreeHugger Robot
execution" into rvc-dev
2020-04-06Add more tests for getOutputOperand*() and for burst and fenced executionDavid Gross
Test that getOutputOperand*() fails with ANEURALNETWORKS_BAD_STATE if called on a running Execution. Bring burstCompute() and startComputeWithDependencies() testing to parity with compute() and startCompute() testing: Ensure that driver errors are handled properly, and that getOutputOperand*() is handled properly. Also add NeuralNetworksWrapper::startComputeWithDependencies(). Bug: 148804027 Test: NeuralNetworksTest_static --gtest_filter=*ExecutionTest*Wait* Change-Id: I7cca4d43d7f6369845d7fedac4e37ca2cc8b7afe
2020-04-06Merge changes I4226bdb1,I59070aff,I5cc4c48e into rvc-devTreeHugger Robot
* changes: Add rank check to LOCAL_RESPONSE_NORMALIZATION validation Add rank check to FLOOR validation Add rank checks to validation functions
2020-04-06Merge "Add POW op test with same inputs shapes to increase code coverage" ↵TreeHugger Robot
into rvc-dev
2020-04-06Fix control flow partial CPU fallback bugSlava Shklyaev
Before this change, ExecutionPlan::Controller::mLastStepIndex is only updated at the beginning of the ExecutionPlan::next() call. When interpreted control flow is involved, this call might result in several logical steps being processed until an ExecutionStep is reached. When an interpreted CF loop terminates successfully but the next step is an ExecutionStep that fails, ExecutionPlan::fallback() restarts from mLastStepIndex, which happens to be the index of the WhileStep. This results in the loop being executed again. This happens forever. This change fixes the bug by updating mLastStepIndex when nextCompound(const ExecutionStep* ...) is called. This change renames mLastStepIndex to mFallbackNextStepIndex to reflect its usage. Fix: 152623151 Test: NNT_static Change-Id: Iff3b68f541adb8facf078e968abac2a6ae8e74c1
2020-04-06Fix HARD_SWISH rank requirementLev Proleev
Also add rank check to HARD_SWISH validation. This commit removes nnAssert from the utility function that converts NNAPI Shape to TF Lite's RuntimeShape. The assert would cause a crash if the function was passed a shape with rank > 4 even though RuntimeShape supports such shapes. Bug: 152945527 Bug: 139957496 Test: NNTest_static Change-Id: I69147915669bee525c8883e48fd53ff0f899a501
2020-04-06Add rank check to LOCAL_RESPONSE_NORMALIZATION validationLev Proleev
Also move LOCAL_RESPONSE_NORMALIZATION operation to OperationResolver Bug: 124041202 Bug: 139957496 Test: NNTest_static Change-Id: I4226bdb101d6ee0a744448e61357344db019dd70
2020-04-06Add rank check to FLOOR validationLev Proleev
Also move FLOOR operation to OperationResolver Bug: 124041202 Bug: 139957496 Test: NNTest_static Change-Id: I59070aff36ddfa57085258974168a314176ed27b
2020-04-06Add rank checks to validation functionsLev Proleev
The change adds rank checks to validation of operations that only support tensors of rank 4 or less. This requirement comes from legacy TF Lite code and is likely to be relaxed in the future to be on par with TF Lite. Adding the checks to validation is benefitial for the TF Lite delegate since in case of a validation error NNAPI node will be fully rejected by the delegation but execution error will cause TF Lite to run NNAPI node during every invocation only to receive an error and do the calculation using CPU implementation. Bug: 139957496 Test: NNTest_static Change-Id: I5cc4c48e775826a237d5ac54c3d2078254bd17a2
2020-04-06Add POW op test with same inputs shapes to increase code coverageLev Proleev
Fix: 129571542 Test: NNTest_static Change-Id: Ie94a0a36b1df10afff6a5269f9375f99bc6ffba7
2020-04-06Remove stale TODOsSlava Shklyaev
The tests have been added in change I15ad10dd. Bug: 152405977 Test: N/A Change-Id: I477e50025e88cf1d04952746a47a4b0f0923d2d7
2020-04-04Merge "Add 1.3 RESIZE_* tests with default values" into rvc-devTreeHugger Robot
2020-04-04Merge "Fix optional argument remover bugs" into rvc-devTreeHugger Robot