未验证 提交 26a7c1a3 编写于 作者: W wopeizl 提交者: GitHub

add unit test to cover all parameters for print op test=develop (#18089)

上级 b2cfdc38
......@@ -56,6 +56,27 @@ class TestPrintOpCPU(unittest.TestCase):
fetch_list=[loss],
return_numpy=False)
def test_all_parameters(self):
x = layers.data('x', shape=[3], dtype='float32', lod_level=1)
x.stop_gradient = False
for print_tensor_name in [True, False]:
for print_tensor_type in [True, False]:
for print_tensor_shape in [True, False]:
for print_tensor_lod in [True, False]:
layers.Print(
input=x,
print_tensor_name=print_tensor_name,
print_tensor_type=print_tensor_type,
print_tensor_shape=print_tensor_shape,
print_tensor_lod=print_tensor_lod, )
loss = layers.mean(x)
append_backward(loss=loss)
exe = Executor(self.place)
outs = exe.run(feed={'x': self.x_tensor},
fetch_list=[loss],
return_numpy=False)
@unittest.skipIf(not core.is_compiled_with_cuda(),
"core is not compiled with CUDA")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册