Mimic torch.bucketsize in 1.5

Pytorch 1.6 beta offers the new function torch.bucketsize
Is it possible to mimic this function in torch 1.5.1?

Thank you

You could either cherry-pick all PRs for this feature into your 1.5.1 branch, solve all merge conflicts, and rebuild PyTorch or alternatively try to copy-paste the code for this feature into custom classes and treat it as custom functions.

However, what’s the reason you cannot update PyTorch, which seems to be easier?

Thanks. Because Pytorch 1.6 is currently in beta.

Wops, 1.6 has just been released!