Revert "Fix possible out-of-range error of 'as_nd' util function (#82393)"
This reverts commit 1ac0285cd459f37ab5f2dc40c721923e2f98a72c.
Reverted https://github.com/pytorch/pytorch/pull/82393 on behalf of https://github.com/zengk95 due to this is breaking Linux on trunk https://hud.pytorch.org/pytorch/pytorch/commit/1ac0285cd459f37ab5f2dc40c721923e2f98a72c