When compiling the code below, there are a lot of deprecated warnings.
AT_DISPATCH_FLOATING_TYPES(x.type(), "comp_cuda",
([&] {
comp_cuda_kernel<scalar_t><<<grid_size, threads>>>(
x.data<scalar_t>(), h.data<scalar_t>(), out.data<scalar_t>(),
B, F, C, H, W);
}));
As far I noticed, the warnings basically are:
warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
And
warning: ‘T* at::Tensor::data() const [with T = double]’ is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations]
The documentation, here here, does not provide an alternative to x.type()
. However it does suggests a different way to refer to x.data<scalar_t>()
as in
gates.packed_accessor<scalar_t,3,torch::RestrictPtrTraits,size_t>(),
What specifically are these arguments?
- 3
- torch::RestrictPtrTraits
Would the first and last argument always be scalar_t
and size_t
?