ofnote/tsalib

Updating DimVar's value best practice

Opened this issue ยท 4 comments

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?

@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?

@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!

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.

That sounds great, especially the update_len call is what I needed ๐Ÿ‘