vTensor cleanup 3/N - Introduce conversion constructors for `vec` types (#5423)
Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/5423
## Context
Introduce implicit conversion functions to `vec` types. This allows the following pattern:
```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2 = v1;
```
Whereas before, we would have to do
```cpp
utils::ivec3 v1{4, 5, 2};
utils::uvec3 v2(
safe_downcast<uint32_t>(v1[0],
safe_downcast<uint32_t>(v1[1],
safe_downcast<uint32_t>(v1[2]);
```
The connection with `vTensor` class cleanup is that this will allow for consolidation of `vTensor` class methods, specifically circumventing the need to provide two functions to retrieve the logical limits of the `Tensor`, one to retrieve it as a `ivec3` and another to retrieve it as a `uvec3`.
ghstack-source-id: 243309910
exported-using-ghexport
Reviewed By: jorgep31415
Differential Revision: D62878650
fbshipit-source-id: 8ed9e8ecfcc35aaf8ba6277fcf3e56c97e8fe8c7 S
Stephen Jia committed
958afe13be0a7abc6884ec1b2f4ecfa99a2986dc
Parent: ebff33c
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 9/18/2024, 4:59:53 PM