Skip to content

Commit

Permalink
update keras to 2.0.5 and remove patch code
Browse files Browse the repository at this point in the history
  • Loading branch information
icoxfog417 committed Jun 13, 2017
1 parent 02aa8b3 commit 610c09f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
25 changes: 0 additions & 25 deletions model/lang_model_sgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,3 @@ def scheduler(epoch):
return K.get_value(self.lr)

return LearningRateScheduler(scheduler)


# because of https://github.com/fchollet/keras/pull/6859

def clip_norm(g, c, n):
if c > 0:
condition = n >= c
then_expression = tf.scalar_mul(c / n, g)
else_expression = g

if isinstance(then_expression, tf.Tensor):
g_shape = copy.copy(then_expression.get_shape())
elif isinstance(then_expression, tf.IndexedSlices):
g_shape = copy.copy(then_expression.dense_shape)
if condition.dtype != tf.bool:
condition = tf.cast(condition, "bool")
g = tf.cond(condition,
lambda: then_expression,
lambda: else_expression)
if isinstance(then_expression, tf.Tensor):
g.set_shape(g_shape)
elif isinstance(then_expression, tf.IndexedSlices):
g._dense_shape = g_shape

return g
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
chazutsu==0.5.3
h5py==2.7.0
Keras==2.0.4
Keras==2.0.5
tensorflow==1.1.0

0 comments on commit 610c09f

Please sign in to comment.