Skip to content

Commit 75d68f5

Browse files
committed
fix pylint
1 parent d0d22a7 commit 75d68f5

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

tf2onnx/onnx_opset/tensor.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,13 +1823,13 @@ def version_11(cls, ctx, node, **kwargs):
18231823
class MatrixDiagPartV2V3:
18241824
@classmethod
18251825
def version_11(cls, ctx, node, **kwargs):
1826-
Input = node.input[0]
1827-
K = ctx.make_node('Cast', [node.input[1]], attr={'to': TensorProto.INT64}).output[0]
1828-
Padding = node.input[2]
1829-
Align = 'LEFT_LEFT'
1826+
input_tensor = node.input[0]
1827+
k = ctx.make_node('Cast', [node.input[1]], attr={'to': TensorProto.INT64}).output[0]
1828+
padding = node.input[2]
1829+
align = 'LEFT_LEFT'
18301830
if node.op.op_type == 'MatrixDiagPartV3':
1831-
Align = node.get_attr_str('align') if 'align' in node.attr else 'LEFT_RIGHT'
1832-
input_rank = len(ctx.get_shape(Input))
1831+
align = node.get_attr_str('align') if 'align' in node.attr else 'LEFT_RIGHT'
1832+
input_rank = len(ctx.get_shape(input_tensor))
18331833
raw_input_shape = [-1] * input_rank
18341834
per_loop_shape = raw_input_shape[:-1]
18351835
raw_output_shape = raw_input_shape[:-2] + [-1]
@@ -1845,23 +1845,23 @@ def version_11(cls, ctx, node, **kwargs):
18451845
const_neg_one = ctx.make_const(utils.make_name(node.name) + 'const_neg_one', np.array([-1]).astype(np.int64))
18461846
const_neg_two = ctx.make_const(utils.make_name(node.name) + 'const_neg_two', np.array([-2]).astype(np.int64))
18471847
# prepare new_shape of input
1848-
input_shape = ctx.make_node('Shape', [Input])
1848+
input_shape = ctx.make_node('Shape', [input_tensor])
18491849
shape_input_shape = ctx.make_node('Shape', [input_shape.output[0]])
18501850
matrix_shape = ctx.make_node('Slice',
18511851
[input_shape.output[0], const_neg_two.output[0], shape_input_shape.output[0]])
18521852
min_dim = ctx.make_node('ReduceMin', [matrix_shape.output[0]])
18531853
input_depth = ctx.make_node('Slice', [matrix_shape.output[0], const_neg_two.output[0], const_neg_one.output[0]])
18541854
input_width = ctx.make_node('Slice', [matrix_shape.output[0], const_neg_one.output[0], const_two.output[0]])
18551855
temp_shape = ctx.make_node('Concat', [const_neg_one.output[0], matrix_shape.output[0]], attr={'axis': 0})
1856-
temp_input = ctx.make_node('Reshape', [Input, temp_shape.output[0]])
1856+
temp_input = ctx.make_node('Reshape', [input_tensor, temp_shape.output[0]])
18571857
temp_transposed = ctx.make_node('Transpose', [temp_input.output[0]], attr={'perm': [0, 2, 1]})
18581858
half_shape = ctx.make_node('Slice', [input_shape.output[0], const_zero.output[0], const_neg_two.output[0]])
18591859
new_shape = ctx.make_node('Concat', [half_shape.output[0], input_width.output[0], input_depth.output[0]],
18601860
attr={'axis': 0})
18611861
# define body graph for main loop
1862-
k_shape = ctx.make_node('Shape', [K])
1863-
k_start = ctx.make_node('Slice', [K, const_zero.output[0], const_one.output[0]])
1864-
k_end = ctx.make_node('Slice', [K, const_neg_one.output[0], k_shape.output[0]])
1862+
k_shape = ctx.make_node('Shape', [k])
1863+
k_start = ctx.make_node('Slice', [k, const_zero.output[0], const_one.output[0]])
1864+
k_end = ctx.make_node('Slice', [k, const_neg_one.output[0], k_shape.output[0]])
18651865
raw_total_k = ctx.make_node('Sub', [k_end.output[0], k_start.output[0]])
18661866
total_k = ctx.make_node('Add', [raw_total_k.output[0], const_one.output[0]])
18671867
trip_name = utils.make_name(node.name + "_i")
@@ -1873,7 +1873,7 @@ def version_11(cls, ctx, node, **kwargs):
18731873
# identity of input
18741874
identity_input_graph = body_graph.create_new_graph_with_same_config()
18751875
identity_input_graph.parent_graph = body_graph
1876-
identity_input = identity_input_graph.make_node('Identity', [Input])
1876+
identity_input = identity_input_graph.make_node('Identity', [input_tensor])
18771877
identity_input_graph.add_graph_output(identity_input.output[0], ctx.get_dtype(node.input[0]), raw_input_shape)
18781878
# transposed input
18791879
transposed_input_graph = body_graph.create_new_graph_with_same_config()
@@ -1927,14 +1927,14 @@ def version_11(cls, ctx, node, **kwargs):
19271927
gap_pos_k_graph = body_graph.create_new_graph_with_same_config()
19281928
gap_pos_k_graph.parent_graph = body_graph
19291929
gap_pos_k = gap_pos_k_graph.make_node('Concat', [const_zero.output[0], processed_gap.output[0]], attr={'axis': 0}) \
1930-
if Align.startswith('LEFT') \
1930+
if align.startswith('LEFT') \
19311931
else gap_pos_k_graph.make_node('Concat', [processed_gap.output[0], const_zero.output[0]], attr={'axis': 0})
19321932
gap_pos_k_graph.add_graph_output(gap_pos_k.output[0], TensorProto.INT64, [-1])
19331933
# gap_neg_k_graph
19341934
gap_neg_k_graph = body_graph.create_new_graph_with_same_config()
19351935
gap_neg_k_graph.parent_graph = body_graph
19361936
gap_neg_k = gap_neg_k_graph.make_node('Concat', [const_zero.output[0], processed_gap.output[0]], attr={'axis': 0}) \
1937-
if Align.endswith('LEFT') \
1937+
if align.endswith('LEFT') \
19381938
else gap_neg_k_graph.make_node('Concat', [processed_gap.output[0], const_zero.output[0]], attr={'axis': 0})
19391939
gap_neg_k_graph.add_graph_output(gap_neg_k.output[0], TensorProto.INT64, [-1])
19401940
# pad output with gap
@@ -1945,7 +1945,7 @@ def version_11(cls, ctx, node, **kwargs):
19451945
gap_right = body_graph.make_node('Slice', [gap_k.output[0], const_one.output[0], const_two.output[0]])
19461946
gap_all = body_graph.make_node('Concat', [sliced_zero.output[0], gap_left.output[0], sliced_zero.output[0],
19471947
gap_right.output[0]], attr={'axis': 0})
1948-
padded_output = body_graph.make_node('Pad', [raw_output.output[0], gap_all.output[0], Padding])
1948+
padded_output = body_graph.make_node('Pad', [raw_output.output[0], gap_all.output[0], padding])
19491949
cond_output = body_graph.make_node('Identity', [cond_name])
19501950
body_graph.add_graph_output(cond_output.output[0], TensorProto.BOOL, [])
19511951
body_graph.add_graph_output(padded_output.output[0], ctx.get_dtype(node.input[0]), per_loop_shape)

0 commit comments

Comments
 (0)