Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ipython-kernel-*.json
/dist
/_setup_info_generated.py

# via test cases run directly in this directory
/dataset_id*
# via test cases run directly in this directory, or maybe in the tests dir
dataset_id*

# via GitHub codespaces
/pythonenv*
2 changes: 1 addition & 1 deletion returnn/tf/layers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ def get_rec_initial_output(cls, batch_dim, name, output, rec_layer, initial_outp
def get_rec_initial_extra_outputs(cls, batch_dim, rec_layer, **kwargs):
"""
:param tf.Tensor batch_dim: for this layer, might be with beam
:param TFNetworkRecLayer.RecLayer rec_layer:
:param returnn.tf.layers.rec.RecLayer rec_layer:
:rtype: dict[str,tf.Tensor]
"""
return {}
Expand Down
3 changes: 2 additions & 1 deletion returnn/tf/layers/rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,8 @@ def __call__(lself, name, is_prev_time_frame=False):
try:
assert not self.layer_data_templates, "do not call this multiple times"
get_templated_layer.construct("output")
assert "output" in self.layer_data_templates
if "output" not in self.layer_data_templates:
raise ConstructCtx.recent_exception
assert not ConstructCtx.layers

if "end" in self.net_dict: # used to specify ending of a sequence
Expand Down
2 changes: 1 addition & 1 deletion returnn/tf/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def __init__(self, config=None, extern_data=None, rnd_seed=None,
inside_rec_time_dim=None,
absolute_name_prefix=None, name=None):
"""
:param Config.Config config: only needed to init extern_data if not specified explicitly
:param returnn.config.Config config: only needed to init extern_data if not specified explicitly
:param ExternData|None extern_data:
:param int|None rnd_seed:
:param bool|tf.Tensor train_flag: True if we want to use this model in training, False if in eval, or dynamic
Expand Down
16 changes: 9 additions & 7 deletions returnn/tf/util/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def short_repr(self):
desc += "(%i)" % self.dimension
else:
if self.dyn_size_ext:
desc += "[%s]" % ",".join(self.dyn_size_ext.get_batch_axes_short_description())
desc += "[%s]" % ",".join(self.dyn_size_ext.get_batch_axes_short_description(special_axes=False))
else:
desc += "[?]"
return desc
Expand Down Expand Up @@ -1467,8 +1467,9 @@ def get_description(self, with_name=True, with_placeholder=False, catch_exceptio
args += ["batch_shape_meta=" + batch_shape_meta]
return "Data(%s)" % ", ".join(args)

def get_batch_axes_short_description(self):
def get_batch_axes_short_description(self, special_axes=True):
"""
:param bool special_axes: special markers for old-style time_dim_axis and feature_dim_axis
:rtype: list[str]
"""
res = []
Expand All @@ -1479,18 +1480,19 @@ def get_batch_axes_short_description(self):
descriptions.append(self.batch.short_repr())
else:
descriptions.append("B?")
if axis == self.time_dim_axis:
descriptions.append("T")
if axis == self.feature_dim_axis:
descriptions.append("F")
if special_axes:
if axis == self.time_dim_axis:
descriptions.append("T")
if axis == self.feature_dim_axis:
descriptions.append("F")
if self.batch_shape[axis] is None:
if axis == self.batch_dim_axis:
pass # expected
else:
descriptions.append(dim_tag.short_repr())
elif axis != self.batch_dim_axis or not self.batch:
descriptions.append(dim_tag.short_repr())
res.append("|".join(descriptions))
res.append("|".join(descriptions) or "?")
return res

def get_compare_key(self):
Expand Down