Skip to content
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

Make shape and dims available? #47

Closed
albertz opened this issue Oct 29, 2021 · 1 comment
Closed

Make shape and dims available? #47

albertz opened this issue Oct 29, 2021 · 1 comment
Milestone

Comments

@albertz
Copy link
Member

albertz commented Oct 29, 2021

Currently, given some LayerRef (which can be thought of as a normal tensor, when comparing our code conceptually to PyTorch or TensorFlow), we cannot really get any information about it (despite the layer ref), such as its dtype or shape.

It would not be too hard to make it available though because all RETURNN layers have get_out_data_from_opts where this can be inferred. And this function get_out_data_from_opts is by design not involving any TF operation, or adding anything to the current active TF computation graph. (There are some smaller technical things to be considered with this approach but they are all easily solvable.)

Having this would allow to more easily check e.g. if the input is sparse (maybe for #38), maybe reusing or checking for specific dim tags, etc.

We can either make just the RETURNN Data instance available as-is (LayerRef.data), or provide some more simple wrappers, like LayerRef.shape = data.dim_tags or (or with #48, more like LayerRef.shape = set(data.dim_tags)) or so.

This is also very related to #17.

@albertz
Copy link
Member Author

albertz commented Dec 20, 2021

We have that now. See e.g. _move_layer_ref_to_new_name_ctx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant