Skip over optional bias tensors.

PiperOrigin-RevId: 285242904
Change-Id: Ie063daa9ff1707ba562eb28f4f053df128037f12
This commit is contained in:
Suharsh Sivakumar 2019-12-12 12:12:15 -08:00 committed by TensorFlower Gardener
parent d5cee81f13
commit 6c9422d7d6
5 changed files with 24 additions and 0 deletions

View File

@ -240,6 +240,7 @@ tf_cc_test(
"//tensorflow/lite/tools/optimize:testdata/mixed.bin",
"//tensorflow/lite/tools/optimize:testdata/multi_input_add_reshape.bin",
"//tensorflow/lite/tools/optimize:testdata/single_avg_pool_min_minus_5_max_plus_5.bin",
"//tensorflow/lite/tools/optimize:testdata/single_conv_no_bias.bin",
"//tensorflow/lite/tools/optimize:testdata/single_conv_weights_min_0_max_plus_10.bin",
"//tensorflow/lite/tools/optimize:testdata/single_conv_weights_min_minus_127_max_plus_127.bin",
"//tensorflow/lite/tools/optimize:testdata/single_softmax_min_minus_5_max_plus_5.bin",

View File

@ -316,6 +316,24 @@ TEST_F(QuantizeConvModelTest, Uint8InputAndOutput) {
}
}
class QuantizeConvNoBiasModelTest : public QuantizeModelTest {
protected:
QuantizeConvNoBiasModelTest() {
input_model_ = ReadModel(internal::kConvModelWithNoBias);
readonly_model_ = input_model_->GetModel();
readonly_model_->UnPackTo(&model_);
}
};
TEST_F(QuantizeConvNoBiasModelTest, QuantizationSucceeds) {
auto status = QuantizeModel(&builder_, &model_, TensorType_INT8,
TensorType_INT8, &error_reporter_);
EXPECT_EQ(status, kTfLiteOk);
const uint8_t* buffer = builder_.GetBufferPointer();
const Model* output_model = GetModel(buffer);
ASSERT_TRUE(output_model);
}
class QuantizeConcatModelTest : public QuantizeModelTest {
protected:
QuantizeConcatModelTest() {

View File

@ -25,6 +25,8 @@ const char* kConvModelWithMinus128Plus127Weights =
const char* kConvModelWith0Plus10Weights =
"single_conv_weights_min_0_max_plus_10.bin";
const char* kConvModelWithNoBias = "single_conv_no_bias.bin";
const char* kSingleSoftmaxModelMinMinus5MaxPlus5 =
"single_softmax_min_minus_5_max_plus_5.bin";

View File

@ -34,6 +34,9 @@ extern const char* kConvModelWithMinus128Plus127Weights;
// Activations have min = 0, max = 10.
extern const char* kConvModelWith0Plus10Weights;
// Test model where no bias is in the conv.
extern const char* kConvModelWithNoBias;
// A floating point model with a single softmax. The input tensor has min
// and max in range [-5, 5], not necessarily -5 or +5.
extern const char* kSingleSoftmaxModelMinMinus5MaxPlus5;

Binary file not shown.