Skip to content

Better way to specify axis for layers operating on rec time axis #781

@Zettelkasten

Description

@Zettelkasten

This is a special case of #597.

I noticed that for #776 in WindowLayer, but also for e.g. CumsumLayer that operate on the rec time axis, we have a check like this:

    if axis == "T" and data.time_dim_axis is None:
      # Assume inside RecLayer.
      # (then the code for a single step)
    else:
      axis = data.get_axis_from_description(axis)
      # (then the code for all steps at once, operating on `axis`)

This is flawed as soon as the input has two dynamic dims: Then the input might have a time_dim_axis even in the recurrent case, and the layer will silently behave very wrongly.

Instead, I would propose to allow axis to be a DimensionTag. Then, we can just check axis == network.get_rec_parent_layer(inside_loop=False).time_dim_tag.
Would we also want to allow the stag:description syntax here?
Also, in #391 for CumConcatLayer, we briefly thought of allowing :i as axis name. Maybe allow this too?

I worked on this a month ago, for CumsumLayer, see #780. But I never tested this, it was just something a colleague of mine stumbled across but then gave up on. Now with #776, and dim tags becoming popular, I remembered to raise this issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions