Fix issue with extracting padding
@@ -2752,11 +2752,19 @@ def extract_conv_layer(layer_table):
conv_layer_config['truncation_factor'] = conv_layer_config['trunc_fact']
del conv_layer_config['trunc_fact']
- if layer_table['_DLNumVal_'][layer_table['_DLKey1_'] == 'convopts.no_bias'].any():
+ dl_numval = layer_table['_DLNumVal_']
+ if dl_numval[layer_table['_DLKey1_'] == 'convopts.no_bias'].any():
conv_layer_config['include_bias'] = False
else:
conv_layer_config['include_bias'] = True
+ padding_width = dl_numval[layer_table['_DLKey1_'] == 'convopts.pad_left'].tolist()[0]
+ padding_height = dl_numval[layer_table['_DLKey1_'] == 'convopts.pad_top'].tolist()[0]
+ if padding_width != -1:
+ conv_layer_config['padding_width'] = padding_width
+ if padding_height != -1:
+ conv_layer_config['padding_height'] = padding_height
+
layer = Conv2d(**conv_layer_config)
return layer
@@ -2788,6 +2796,13 @@ def extract_pooling_layer(layer_table):
del pool_layer_config['poolingtype']
pool_layer_config['name'] = layer_table['_DLKey0_'].unique()[0]
+ padding_width = layer_table['_DLNumVal_'][layer_table['_DLKey1_'] == 'poolingopts.pad_left'].tolist()[0]
+ padding_height = layer_table['_DLNumVal_'][layer_table['_DLKey1_'] == 'poolingopts.pad_top'].tolist()[0]
+ if padding_width != -1:
+ pool_layer_config['padding_width'] = padding_width
+ if padding_height != -1:
+ pool_layer_config['padding_height'] = padding_height
+
layer = Pooling(**pool_layer_config)
return layer
