@@ -165,21 +165,23 @@ def convert_keras_conv_core(scope, operator, container, is_transpose, n_dims, in
165
165
n_dims ,
166
166
weight_perm_axes , parameters , attrs ['auto_pad' ])
167
167
168
+ # Permute the output back of its original format
169
+ transpose_output_name = scope .get_unique_variable_name ('transpose_output' )
170
+ if not channels_first :
171
+ # Generate a final transposer.
172
+ apply_transpose (scope , intermediate_output_name , transpose_output_name , container , perm = output_perm_axes )
173
+ else :
174
+ apply_identity (scope , intermediate_output_name , transpose_output_name , container )
175
+
168
176
# The construction of convolution is done. Now, we create an activation operator to apply the activation specified
169
177
# in this Keras layer.
170
178
apply_activation_function = activation_map [op .activation ]
171
- activation_output_name = scope .get_unique_variable_name ('activation_output' )
172
- if apply_activation_function in [activation_get ('softmax' ), keras .activations .softmax ]:
173
- apply_softmax (scope , intermediate_output_name , activation_output_name , container , axis = - 1 )
179
+ if op .activation in [activation_get ('softmax' ), keras .activations .softmax ]:
180
+ apply_softmax (scope , transpose_output_name , operator .outputs [0 ].full_name , container , axis = - 1 )
174
181
else :
175
- apply_activation_function (scope , intermediate_output_name , activation_output_name , container )
182
+ apply_activation_function (scope , transpose_output_name , operator .outputs [0 ].full_name , container )
183
+
176
184
177
- # Permute the output back of its original format
178
- if not channels_first :
179
- # Generate a final transposer.
180
- apply_transpose (scope , activation_output_name , operator .outputs [0 ].full_name , container , perm = output_perm_axes )
181
- else :
182
- apply_identity (scope , activation_output_name , operator .outputs [0 ].full_name , container )
183
185
184
186
185
187
def get_converter_config (dims , is_conv_transpose ):
0 commit comments