Better assertion message in vectorizing_map.

One situation that triggers this assertion is when trying to tf.print(pfor_config.collect(something)).  Arguably that should just work, but failing that, having the error indicate the nature of the problem is helpful.

PiperOrigin-RevId: 249108396
This commit is contained in:
Alexey Radul 2019-05-20 12:57:14 -07:00 committed by TensorFlower Gardener
parent 12f2364774
commit 17e070371e

View File

@ -993,7 +993,8 @@ class PForConfig(object):
def _lookup_reduction(self, pl):
"""Lookups Placeholder `pl` in the reduction map."""
assert isinstance(pl, ops.Tensor)
msg = "Expected Tensor, got {} of type {}."
assert isinstance(pl, ops.Tensor), msg.format(pl, type(pl))
return self._reduce_concat_map.get(pl, None)