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

Updating DimVar's value best practice #19

Open
finngaida opened this issue Mar 29, 2020 · 4 comments
Open

Updating DimVar's value best practice #19

finngaida opened this issue Mar 29, 2020 · 4 comments

Comments

@finngaida
Copy link

finngaida commented Mar 29, 2020

So I'm declaring global DimVars (without a hardcoded value) and later at runtime want to update their values based on some hyperparams to do shape assertions.
I'm aware I can just manipulate their ._val propery, but that seems a bit hacky to me, what's the intended workflow for this kind of problem?

@ekshaks
Copy link
Member

ekshaks commented Apr 13, 2020

@finngaida sorry for the delayed reply. I think there was a DimVar.update function somewhere but not exposed in docs. Will check and get back soon.

Also, can you tell me more about which DimVar you are trying to update? Any reason you can't initialize it upfront from config variables?

@ChenghaoMou
Copy link

@ekshaks same issue here.

For example, the text sequence dimension [batch_size, sequence_size, hidden_size] can vary from batch to batch (padded only at batch level). It would be super helpful to make some kind of dynamic dimension variables.

BTW, thanks for this awesome package!

@ekshaks
Copy link
Member

ekshaks commented May 17, 2020

Thanks @ChenghaoMou and @finngaida for comments on the issue. Added update_dim_vars_len in the commit dd2e747. Please see the README (API) for usage.

Let me know if this works for you.

@finngaida
Copy link
Author

That sounds great, especially the update_len call is what I needed 👍

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

3 participants