I don’t think this works directly right now.
If you have compiled torch yourself, you see that in torch/csrc/autograd/generated/python_torch_functions.cpp the factory functions take the Python objects and unpacks them.
The PyBind converters are only present for IntArrayRef and Tensor (toch/csrc/utils/pybind.h 16). You could try to register your own for torch::Device and torch::Dtype – or submit that PR (1.5 years ago, it was only Tensors).
A standard workaround could be to just pass a (potentially empty) tensor and take the device and dtype of that.
Best regards
Thomas