Fix log_softmax and softmax if any dimension is 0-d (#17651)
Summary:
- Test added
- test_dim_function_empty: softmax and log_softmax on last dimension
fixes: #17262
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17651
Differential Revision: D14349009
Pulled By: gchanan
fbshipit-source-id: b6f728f5c6be8ae7615749e3f0c201886632923e