Tensors in Pytorch have new_zeros, new_empty that make sure devices are consistent. While ATen has at::zeros_like and at::empty_like it seems the tensors do not have new_zeros.
So if I call:
auto ious = at::zeros(xy.type(), {10, 3, 1, 1, 2});
It makes sure the type is same as xy, but what about the device?
If I want to create a tensor with a new type (e.g. int) I can call:
auto gt_target = at::empty(at::CUDA(at::kInt), {10, 3, 1, 1, 2});
Which device will this tensor be using? can I multiply ious to gt_target
ATen currently does not have any concept of a “device” beyond CPU vs. CUDA (i.e. the “ordinal” part is missing from ATen’s model). I’m working on changing this right now, so you can expect this to be fixed soon