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

Function EXPECT_DEATH

tensorflow/lite/kernels/fully_connected_test.cc:899–936  ·  view source on GitHub ↗

Note that it is not required that the first dimension be the number of batches. But it is required that the last dimension is the 'input_dim'. For this particular test, it is required for the output to be reformattable into a shape of form {4, 1, 5, ?} but since the output size (the product of output dimensions: units times batches) is 6, this is not possible.

Source from the content-addressed store, hash-verified

897 // into a shape of form {4, 1, 5, ?} but since the output size (the product of
898 // output dimensions: units times batches) is 6, this is not possible.
899 EXPECT_DEATH(FloatFullyConnectedOpModel m(
900 GetRegistration(), /*units=*/3, /*batches=*/2,
901 /*input=*/{TensorType_FLOAT32, {4, 1, 5, 1}},
902 /*output=*/{TensorType_FLOAT32},
903 /*keep_num_dims=*/true),
904 "Cannot allocate tensors");
905}
906#endif
907
908TEST_P(QuantizedFullyConnectedOpTest, SimpleTest4dInputQuantizedUint8) {
909 QuantizedFullyConnectedOpModel m(
910 GetRegistration(), /*units=*/3, /*batches=*/2,
911 /*input=*/{TensorType_UINT8, {4, 1, 5, 1}, -63.5, 64},
912 /*output=*/{TensorType_UINT8, {}, -127, 128});
913
914 // input_product_scale < output_scale was not true.
915 m.SetWeights<uint8_t>({
916 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // u = 0
917 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // u = 1
918 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // u = 2
919 });
920 m.SetBias({1, 2, 3});
921
922 m.SetInput<uint8_t>({
923 1, 2, 3, 4, 5, 6, 7, 8, -9, -10, // b = 0
924 1, 2, 3, 4, 5, 6, 7, -8, 9, -10, // b = 1
925 });
926
927 m.Invoke();
928
929 EXPECT_THAT(m.GetDequantizedOutput<uint8_t>(),
930 ElementsAreArray(ArrayFloatNear({
931 24, 25, 26, //
932 58, 59, 60, //
933 })));
934 EXPECT_THAT(m.GetOutput<uint8_t>(),
935 ElementsAre(151, 152, 153, 185, 186, 187));
936}
937
938TEST_P(QuantizedFullyConnectedOpTest,
939 SimpleTest4dInputQuantizedOutputMultiplierGreaterThan1Uint8) {

Callers 15

TEST_FFunction · 0.85
TESTFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TEST_PFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 3

ArrayFloatNearFunction · 0.70
SetBiasMethod · 0.45
InvokeMethod · 0.45

Tested by

no test coverage detected