Skip to content

Commit 79bd571

Browse files
committed
Fix PEP8 issues.
1 parent 3302bf4 commit 79bd571

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pytorch2keras/layers.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def convert_conv(params, w_name, scope_name, inputs, layers, weights, short_name
6161
layers[padding_name] = padding_layer(layers[input_name])
6262
input_name = padding_name
6363

64-
weights = None
6564
if has_bias:
6665
weights = [W, biases]
6766
else:
@@ -84,7 +83,7 @@ def convert_conv(params, w_name, scope_name, inputs, layers, weights, short_name
8483
name=tf_name
8584
)
8685
layers[scope_name] = conv(layers[input_name])
87-
elif len(weights[weights_name].numpy().shape) == 4: # 2D conv
86+
elif len(weights[weights_name].numpy().shape) == 4: # 2D conv
8887
W = weights[weights_name].numpy().transpose(2, 3, 1, 0)
8988
height, width, channels, n_filters = W.shape
9089

@@ -104,7 +103,6 @@ def convert_conv(params, w_name, scope_name, inputs, layers, weights, short_name
104103
layers[padding_name] = padding_layer(layers[input_name])
105104
input_name = padding_name
106105

107-
weights = None
108106
if has_bias:
109107
weights = [W, biases]
110108
else:
@@ -122,7 +120,7 @@ def convert_conv(params, w_name, scope_name, inputs, layers, weights, short_name
122120
name=tf_name
123121
)
124122
layers[scope_name] = conv(layers[input_name])
125-
else: # 1D conv
123+
else: # 1D conv
126124
W = weights[weights_name].numpy().transpose(2, 1, 0)
127125
width, channels, n_filters = W.shape
128126

@@ -141,7 +139,6 @@ def convert_conv(params, w_name, scope_name, inputs, layers, weights, short_name
141139
layers[padding_name] = padding_layer(layers[inputs[0]])
142140
input_name = padding_name
143141

144-
weights = None
145142
if has_bias:
146143
weights = [W, biases]
147144
else:
@@ -200,7 +197,6 @@ def convert_convtranspose(params, w_name, scope_name, inputs, layers, weights, s
200197

201198
input_name = inputs[0]
202199

203-
weights = None
204200
if has_bias:
205201
weights = [W, biases]
206202
else:
@@ -835,7 +831,6 @@ def convert_reshape(params, w_name, scope_name, inputs, layers, weights, short_n
835831
short_names: use short names for keras layers
836832
"""
837833
print('Converting reshape ...')
838-
839834
if short_names:
840835
tf_name = 'RESH' + random_string(4)
841836
else:

0 commit comments

Comments
 (0)