Allow conversion between Tensor<> specializations

This commit is contained in:
Po-Yen, Chen
2022-08-19 00:30:53 -04:00
parent 30ed3e218c
commit cbbe2485b2

View File

@@ -266,6 +266,9 @@ struct Tensor
Tensor(const Tensor& other) : mDesc(other.mDesc), mData(other.mData) {}
template <typename OtherT, typename = std::enable_if_t<sizeof(T) == sizeof(OtherT) && std::is_convertible_v<T, OtherT>>>
Tensor(const Tensor<OtherT>& other) : mDesc(other.mDesc), mData(std::begin(other.mData), std::end(other.mData)) {}
Tensor& operator=(const Tensor& other)
{
mDesc = other.mDesc;