未验证 提交 18960c44 编写于 作者: M Mihai Maruseac 提交者: GitHub

Merge pull request #57596 from tensorflow/fix-r2.9

Fix conflict resolution error
......@@ -428,6 +428,14 @@ class QuantizeAndDequantizeV3OpTest(test_util.TensorFlowTestCase):
input=inputs, input_min=[], input_max=4.0,
out_type=dtypes.quint8))
input_value = constant_op.constant([-0.8, -0.5, 0, 0.3, 0.8, -2.0],
shape=(6,),
dtype=dtypes.float32),
input_min = constant_op.constant(-127, shape=(), dtype=dtypes.float32)
input_max = constant_op.constant(127, shape=(), dtype=dtypes.float32)
# Tensor with invalid shape and invalid number of elements.
num_bits = constant_op.constant([], shape=(0,), dtype=dtypes.int32)
# Test that running the op raises error. It raises different errors
# depending on whether the shape inference is run first or the op's
# Compute() is run first.
......@@ -454,13 +462,16 @@ class QuantizeDownAndShrinkRangeOpTest(test_util.TensorFlowTestCase):
@test_util.run_in_graph_and_eager_modes
def test_invalid_inputs(self):
input_value = constant_op.constant([-0.8, -0.5, 0, 0.3, 0.8, -2.0],
shape=(6,),
dtype=dtypes.float32),
input_min = constant_op.constant(-127, shape=(), dtype=dtypes.float32)
input_max = constant_op.constant(127, shape=(), dtype=dtypes.float32)
# Tensor with invalid shape and invalid number of elements.
num_bits = constant_op.constant([], shape=(0,), dtype=dtypes.int32)
inputs = constant_op.constant(
np.int32(0), shape=[3, 3, 3, 3], dtype=dtypes.qint32)
with self.assertRaisesRegex((ValueError, errors.InvalidArgumentError),
"must be rank 0"):
self.evaluate(
math_ops.quantize_down_and_shrink_range(input=inputs,
input_min=[],
input_max=4.0,
out_type=dtypes.quint8))
if __name__ == "__main__":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册