| 519 | |
| 520 | template <typename T> |
| 521 | void TestSetTensorValue(DataType type, int val, bool success, |
| 522 | absl::string_view error_msg) { |
| 523 | Tensor t(type, TensorShape({})); |
| 524 | Status s = SetTensorValue(t.dtype(), val, &t); |
| 525 | EXPECT_EQ(s.ok(), success); |
| 526 | if (s.ok()) { |
| 527 | test::ExpectTensorEqual<T>(Tensor(static_cast<T>(val)), t); |
| 528 | } else { |
| 529 | EXPECT_EQ(s.error_message(), error_msg); |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | TEST(SetTensorValueTest, Quantized) { |
| 534 | auto int_min_error = [](DataType type) { |
nothing calls this directly
no test coverage detected