Fix for pylint Failed

test=develop
revert-15774-anakin_subgraph_engine
Krzysztof Binias 6 years ago
parent 1578c60bdd
commit 309ea6f2de

@ -112,7 +112,7 @@ class TestMKLDNNReluPrimitivesAlreadyExist(unittest.TestCase):
out_grad = np.random.random_sample(x.shape).astype(np.float32) out_grad = np.random.random_sample(x.shape).astype(np.float32)
x_grad = out_grad * np.sign(x) # Abs grad calculation x_grad = out_grad * np.sign(x) # Abs grad calculation
var_dict = {'x':x, 'out':out, 'out@GRAD':out_grad, 'x@GRAD':x_grad} var_dict = {'x': x, 'out': out, 'out@GRAD': out_grad, 'x@GRAD': x_grad}
var_names = list(var_dict.keys()) var_names = list(var_dict.keys())
ground_truth = {name: var_dict[name] for name in var_names} ground_truth = {name: var_dict[name] for name in var_names}
@ -121,14 +121,12 @@ class TestMKLDNNReluPrimitivesAlreadyExist(unittest.TestCase):
block = program.global_block() block = program.global_block()
for name in ground_truth: for name in ground_truth:
block.create_var( block.create_var(
name=name, name=name, dtype='float32', shape=ground_truth[name].shape)
dtype='float32',
shape=ground_truth[name].shape)
relu_op = block.append_op( relu_op = block.append_op(
type="abs", type="abs",
inputs={"X": block.var('x'),}, inputs={"X": block.var('x'), },
outputs={"Out": block.var('out') }, outputs={"Out": block.var('out')},
attrs={"use_mkldnn": True}) attrs={"use_mkldnn": True})
# Generate backward op_desc # Generate backward op_desc
@ -149,8 +147,10 @@ class TestMKLDNNReluPrimitivesAlreadyExist(unittest.TestCase):
# Do at least 2 iterations # Do at least 2 iterations
for i in range(2): for i in range(2):
out = exe.run(program, out = exe.run(
feed={name: var_dict[name] for name in ['x', 'out@GRAD']}, program,
feed={name: var_dict[name]
for name in ['x', 'out@GRAD']},
fetch_list=['x@GRAD']) fetch_list=['x@GRAD'])
self.__assert_close(x_grad, out[0], "x@GRAD") self.__assert_close(x_grad, out[0], "x@GRAD")

Loading…
Cancel
Save