-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplifying DimensionTag
user interface
#782
Comments
Renaming
I like this. Like you said, I would avoid having a I think I would also add positional arguments for
s.t. I can just write |
I also renamed |
I put these changes into PR #822 now. |
As
DimensionTag
is now becoming more consistently and more often used in user configs (e.g. #597), I think we should maybe simplify the API a bit, to make it shorter and easier to write. The current usage is a bit verbose and long.Current usage example:
Note that
BatchDim
is not a class but a global object. Not sure if this is maybe misleading or confusing already. We could also change that, as it is not widely used yet and only introduced very recently.However, I think the Python convention is to use CamelCase or all UPPER for global variables. In RETURNN, we almost consistently used CamelCase for globals.
I'm just thinking about renaming
DimensionTag
toDim
(and for old code, have some aliasDimensionTag = Dim
). That would already shorten it quite a bit:Some further suggestions have been made in rwth-i6/returnn_common#17.
E.g. we could maybe introduce
SpatialDim
andFeatureDim
as wrappers like:Or similar just as derived classes, like:
In that case, however we maybe should disallow to create instances of
Dim
directly and only allowSpatialDim
,FeatureDim
(andBatchDim
) instances, because otherwise some code maybe checksisinstance(dim, SpatialDim)
which could then be inconsistent to thedim.kind
attribute and this would be confusing?Related is also #775.
The text was updated successfully, but these errors were encountered: