Skip to content

Commit ebad143

Browse files
committed
Fixed error with reshape layer in channel ordering change.
1 parent cd69b01 commit ebad143

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pytorch2keras/converter.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ def pytorch_to_keras(
178178
layer['config']['batch_input_shape'][1]
179179
], -1
180180
))
181+
182+
if layer['config'] and 'target_shape' in layer['config']:
183+
layer['config']['target_shape'] = \
184+
tuple(np.reshape(
185+
[
186+
*layer['config']['target_shape'][1:][:],
187+
layer['config']['target_shape'][0]
188+
], -1
189+
))
181190
if layer['config'] and 'data_format' in layer['config']:
182191
layer['config']['data_format'] = 'channels_last'
183192
if layer['config'] and 'axis' in layer['config']:

0 commit comments

Comments
 (0)