[Vulkan] Implement arithmetic ops where one of the arguments is a tensor wrapping a scalar. (#81726)
Summary:
Increased support for already existing arithmetic ops.
The first or second argument for each of the ops: `sub`, `add`, `mul` and `div` can now be a tensor that is wrapping a scalar i.e. something like `at::tensor(1.0f)`.
Added tests cases to check each of the new functionality (where `*` is either `add`, `sub`, `mul` or `div`):
- `*_scalar_wrapped`: Tests the functionality of performing an arithmetic op between a tensor (first argument) and a scalar wrapped into a tensor (second argument), i.e. something like: `at::add(x, at::tensor(1.0f))`.
- `*_scalar_wrapped_`: Tests the functionality of performing an arithmetic op that modifies a tensor by performing an arithmetic op where the argument is a scalar wrapped into a tensor, i.e something like: `x.mul(at::tensor(2.0f))`.
- `*_to_scalar`: Tests the functionality of performing an arithmetic op where the first argument is a scalar wrapped into a tensor, i.e. something like: `at::sub(at::tensor(1.0f), x)`.
Test Plan:
Added test cases to `/xplat/caffe2/aten/src/ATen/test/vulkan_api_test.cpp`
On Mac:
```
buck run //xplat/caffe2:pt_vulkan_api_test_binAppleMac
```
On Android:
```
buck build -c ndk.custom_libcxx=false -c pt.enable_qpl=0 //xplat/caffe2:pt_vulkan_api_test_binAndroid\#android-arm64 --show-output
adb push buck-out/gen/xplat/caffe2/pt_vulkan_api_test_binAndroid\#android-arm64 /data/local/tmp/vulkan_api_test
adb shell "/data/local/tmp/vulkan_api_test"
```
Reviewed By: SS-JIA
Differential Revision: D37932313
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81726
Approved by: https://github.com/SS-JIA