Skip to content
Merged
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
32 changes: 21 additions & 11 deletions returnn/tf/util/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,8 +1592,6 @@ def get_description(self, with_name=True, with_placeholder=False, catch_exceptio
else:
if self.dtype != "float32":
keys.append("dtype")
if with_name:
keys.insert(0, "name")
if with_placeholder:
keys.append("placeholder")
if not self.available_for_inference:
Expand All @@ -1604,6 +1602,17 @@ def get_description(self, with_name=True, with_placeholder=False, catch_exceptio
if not self.batch or self.batch.beam != self.beam:
keys.append("beam")
args = []
if with_name:
name = getattr(self, "name", None)
args += [repr(name) if name else "<undefined>"]
try:
batch_shape_meta = "[%s]" % ",".join(self.get_batch_axes_short_description())
except Exception as exc:
if catch_exceptions:
batch_shape_meta = "<!%s: %s>" % (type(exc).__name__, exc)
else:
raise
args += [batch_shape_meta]
for key in keys:
try:
value_repr = repr(getattr(self, key))
Expand All @@ -1613,15 +1622,16 @@ def get_description(self, with_name=True, with_placeholder=False, catch_exceptio
else:
raise
args += ["%s=%s" % (key, value_repr)]
try:
batch_shape_meta = "[%s]" % ",".join(self.get_batch_axes_short_description())
except Exception as exc:
if catch_exceptions:
batch_shape_meta = "<!%s: %s>" % (type(exc).__name__, exc)
else:
raise
args += ["batch_shape_meta=" + batch_shape_meta]
return "Data(%s)" % ", ".join(args)
if self.control_flow_ctx:
try:
value_repr = self.control_flow_ctx.repr_inner()
except Exception as exc:
if catch_exceptions:
value_repr = "<!%s: %s>" % (type(exc).__name__, exc)
else:
raise
args += ["ctx=" + value_repr]
return "Data{%s}" % ", ".join(args)

def get_batch_axes_short_description(self, special_axes=True):
"""
Expand Down