You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try to collect use-cases
If you don't have access to the input API to use pack but still want to unpack it with einops, you would need to know the size of the output. This is not ideal if you known the proportion that you want to unpack into.
x=MyBigPretrainedLibraryImportModel(size='base') # base, large, huge # Instead ofb, s, c=x.shape# c is different depending on model sizec_param=c//2x_mean, x_logvar=unpack(x, [[c_param], [c_param]], 'b s *')
# Accept thisx_mean, x_logvar=unpack(x, [[0.5], [0.5]], 'b s *')
Integrity - does it interplay well with existing operations and notation in einops?
pack and unpack currently only accepts int, so accepting float shouldn't break anything.
Incase of float it will be a bit more job, like ensuring all sum to 1, each proportion will scale up to a proper integer etc.
assertc==512x1, x_2, x_3=unpack(x, [[1/3], [1/3], [1/4], 'b s *') # Raise error as 1/3 + 1/3 + 1/4 != 1x1, x_2, x_3=unpack(x, [[1/3], [1/3], [1/3], 'b s *') # Raise error as 512 is not divisible by 3
Readability
The complexity of checking validity of proportion might not worth adding it to the library and should be handled by a few lines of user code.
The text was updated successfully, but these errors were encountered:
If you don't have access to the input API to use pack but still want to unpack it with einops, you would need to know the size of the output. This is not ideal if you known the proportion that you want to unpack into.
pack and unpack currently only accepts int, so accepting float shouldn't break anything.
Incase of float it will be a bit more job, like ensuring all sum to 1, each proportion will scale up to a proper integer etc.
The complexity of checking validity of proportion might not worth adding it to the library and should be handled by a few lines of user code.
The text was updated successfully, but these errors were encountered: