Skip to content

Commit

Permalink
Explicit Tensorflow import in lambda layer
Browse files Browse the repository at this point in the history
This prevents a crash when `change_ordering = True`.
  • Loading branch information
ElteHupkes committed Mar 8, 2019
1 parent 73b5232 commit d9d88cc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pytorch2keras/operation_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def convert_clip(params, w_name, scope_name, inputs, layers, weights, names):
print('Converting clip ...')

def target_layer(x, vmin=params['min'], vmax=params['max']):
import tensorflow as tf
return tf.clip_by_value(x, vmin, vmax)

lambda_layer = keras.layers.Lambda(target_layer)
Expand Down

0 comments on commit d9d88cc

Please sign in to comment.