Enforce non-negativity of tensor construction (#17077)
Summary:
Apparently, before the only way we enforced it was size>=0 in alloc_cpu. So empty((5,-5)) would fail but empty((-5,-5)) would hang :)
Please suggest better place to enforce it if any.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17077
Differential Revision: D14077930
Pulled By: dzhulgakov
fbshipit-source-id: 1120513300fd5448e06fa15c2d72f9b0ee5734e4