Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Do not clip gradient if gradient is None #349

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion seq2seq/models/seq2seq_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _clip_gradients(self, grads_and_vars):
clipped_gradients = []
variables = []
for gradient, variable in grads_and_vars:
if "embedding" in variable.name:
if "embedding" in variable.name and gradient != None:
tmp = tf.clip_by_norm(
gradient.values, self.params["optimizer.clip_embed_gradients"])
gradient = tf.IndexedSlices(tmp, gradient.indices, gradient.dense_shape)
Expand Down