Skip to content

Specify dim tags for layers that create new axes #597

@Zettelkasten

Description

@Zettelkasten

E.g. CumConcatLayer from #589 allows (even enforces) you to specify dim_tag: DimensionTag for the output axis.

I propose something similar for all other layers that introduce new dims. Basically for all layers introducing a new dynamic seq length here that could be useful.

This is already possible to do using an additional ReinterpretDataLayer (or so, something that lets you specify new dim tags. I don't think this exists yet, but is easy to add). Then you would do:

'x_': {'class': 'split_dims',  ...},
'x': {'class': 'reinterpret_data', 'from': 'x_', 'set_dim_tags': {
  'stag:split_dims0': DimensionTag(...), 'stag:split_dims1': DimensionTag(...)}}

Here, split_dims0 and so on are the tag descriptions that SplitDimsLayer internally sets.
Not only is this solution pretty verbose, it also relies on these internal tag descriptions. As a user, you would need to look them up frequently, and we would need to make sure that they don't change internally.
I would like to avoid this, proposing to add a dim_tags: List[DimensionTag] option directly to SplitDimsLayer.
With other layers, its the same idea.
This also promotes the best-practice that you should always name your axes properly.

Maybe, for some layers, we would even enforce the use of this. Especially for layers that really introduce an entirely new dim (like SplitDimsLayer). But also for others. When enforced, this would need a new behavior version (#508).

(Related to that I would also allow to specify just a string with the description as dim_tag to make this easier to use. Calling the DimensionTag constructor is not that nice in Sisyphus configs.)


List of layers which need this

Also see: Operations on dimension tags

Layers (potentially) introducing a new dynamic seq length

List

Layers involving some linear transformation on the features

Layers with fixed output shape

Others

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions