Fix tensor^tensor derivative for 0 base entries
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/32062
Test Plan: Imported from OSS
Differential Revision: D19394259
Pulled By: agolynski
fbshipit-source-id: 836525e03573af838511ad5b4cc87ec2c1536a5e