Commit 22f37f9a authored by Yuxin Wu's avatar Yuxin Wu

skip gradient packer for grads with undefined shape

parent 0e69750a
...@@ -392,7 +392,10 @@ class GradientPacker(object): ...@@ -392,7 +392,10 @@ class GradientPacker(object):
bool - False if grads cannot be packed due to various reasons. bool - False if grads cannot be packed due to various reasons.
""" """
for g in grads: for g in grads:
assert g.shape.is_fully_defined(), "Shape of {} is {}!".format(g.name, g.shape) if not g.shape.is_fully_defined():
logger.warn("Found gradient with incomplete shape: "
"{} has shape {}".format(g.name, g.shape))
return False
self._shapes = [g.shape for g in grads] self._shapes = [g.shape for g in grads]
self._sizes = [g.shape.num_elements() for g in grads] self._sizes = [g.shape.num_elements() for g in grads]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment