Fix msan test in tf_saved_model_lift_variables test

Now, all the tenors, generated from lift_variables_test.h, has initialized
values.

PiperOrigin-RevId: 316969327
Change-Id: If7f68aacf0c931430804dfaa1d73c0ea4be70c75
This commit is contained in:
Jaesung Chung 2020-06-17 14:47:39 -07:00 committed by TensorFlower Gardener
parent b6ff68822a
commit ed2b3d6e1e

View File

@ -96,15 +96,19 @@ class FakeSession : public tensorflow::Session {
for (const std::string& output_name : output_names) {
Tensor output;
if (output_name == "dense/bias") {
outputs->push_back(
Tensor(tensorflow::DT_FLOAT, tensorflow::TensorShape({50})));
Tensor t = Tensor(tensorflow::DT_FLOAT, tensorflow::TensorShape({50}));
t.flat<float>().setZero();
outputs->push_back(t);
} else if (output_name == "dense/kernel") {
outputs->push_back(
Tensor(tensorflow::DT_FLOAT, tensorflow::TensorShape({100, 50})));
Tensor t =
Tensor(tensorflow::DT_FLOAT, tensorflow::TensorShape({100, 50}));
t.flat<float>().setZero();
outputs->push_back(t);
} else {
// Create a scalar float tensor.
outputs->push_back(
Tensor(tensorflow::DT_FLOAT, tensorflow::TensorShape({})));
Tensor t = Tensor(tensorflow::DT_FLOAT, tensorflow::TensorShape({}));
t.flat<float>()(0) = 1.0f;
outputs->push_back(t);
}
}
return Status::OK();