Skip to content

Commit 41b95d7

Browse files
committed
DimensionTag, nicer short_repr
1 parent 913f6aa commit 41b95d7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

returnn/tf/util/data.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def short_repr(self):
9595
desc += "(%i)" % self.dimension
9696
else:
9797
if self.dyn_size_ext:
98-
desc += "[%s]" % ",".join(self.dyn_size_ext.get_batch_axes_short_description())
98+
desc += "[%s]" % ",".join(self.dyn_size_ext.get_batch_axes_short_description(special_axes=False))
9999
else:
100100
desc += "[?]"
101101
return desc
@@ -1467,8 +1467,9 @@ def get_description(self, with_name=True, with_placeholder=False, catch_exceptio
14671467
args += ["batch_shape_meta=" + batch_shape_meta]
14681468
return "Data(%s)" % ", ".join(args)
14691469

1470-
def get_batch_axes_short_description(self):
1470+
def get_batch_axes_short_description(self, special_axes=True):
14711471
"""
1472+
:param bool special_axes: special markers for old-style time_dim_axis and feature_dim_axis
14721473
:rtype: list[str]
14731474
"""
14741475
res = []
@@ -1479,18 +1480,19 @@ def get_batch_axes_short_description(self):
14791480
descriptions.append(self.batch.short_repr())
14801481
else:
14811482
descriptions.append("B?")
1482-
if axis == self.time_dim_axis:
1483-
descriptions.append("T")
1484-
if axis == self.feature_dim_axis:
1485-
descriptions.append("F")
1483+
if special_axes:
1484+
if axis == self.time_dim_axis:
1485+
descriptions.append("T")
1486+
if axis == self.feature_dim_axis:
1487+
descriptions.append("F")
14861488
if self.batch_shape[axis] is None:
14871489
if axis == self.batch_dim_axis:
14881490
pass # expected
14891491
else:
14901492
descriptions.append(dim_tag.short_repr())
14911493
elif axis != self.batch_dim_axis or not self.batch:
14921494
descriptions.append(dim_tag.short_repr())
1493-
res.append("|".join(descriptions))
1495+
res.append("|".join(descriptions) or "?")
14941496
return res
14951497

14961498
def get_compare_key(self):

0 commit comments

Comments
 (0)