[Docs] Fix docs for torch.chunk (#61097)
Summary:
torch.chunk may return less than the requested number of chunks silently if some undocumented division constraints are not met. The functionality that users expect is provided by another function: torch.tensor_split
This has led to confusion countless times and who knows how many systems out there are fragile because of this.
My changes describe the discrepancy, show an example and direct users to the usually preferred function.
Issues mentioning this problem:
https://github.com/pytorch/pytorch/issues/9382
https://github.com/torch/torch7/issues/617
I considered documenting the constraint for when an unexpected number of chunks may be returned (it is chunks*chunks>input.size[dim] ), so that users could quickly tell if their code may be affected. Please let me know if you think this should be in the docs or not.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61097
Reviewed By: heitorschueroff
Differential Revision: D29660280
Pulled By: ezyang
fbshipit-source-id: 675086bc8a8882c1685a50a2c083ae8dd1854384