未验证 提交 77489634 编写于 作者: C chengduo 提交者: GitHub

refine op_test (#12846)

上级 e8b4e0d6
...@@ -56,8 +56,8 @@ def get_numeric_gradient(place, ...@@ -56,8 +56,8 @@ def get_numeric_gradient(place,
def get_output(): def get_output():
sum = [] sum = []
for output_name in output_names:
op.run(scope, place) op.run(scope, place)
for output_name in output_names:
sum.append( sum.append(
np.array(scope.find_var(output_name).get_tensor()).mean()) np.array(scope.find_var(output_name).get_tensor()).mean())
return np.array(sum).mean() return np.array(sum).mean()
......
...@@ -153,9 +153,6 @@ def append_input_output(block, op_proto, np_list, is_input, dtype): ...@@ -153,9 +153,6 @@ def append_input_output(block, op_proto, np_list, is_input, dtype):
def append_loss_ops(block, output_names): def append_loss_ops(block, output_names):
mean_inputs = list(map(block.var, output_names)) mean_inputs = list(map(block.var, output_names))
# for item in mean_inputs:
# print(item)
# print("Item", item.dtype)
if len(mean_inputs) == 1: if len(mean_inputs) == 1:
loss = block.create_var(dtype=mean_inputs[0].dtype, shape=[1]) loss = block.create_var(dtype=mean_inputs[0].dtype, shape=[1])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册