I think that’s another registration type, you need operator registry for autograd to handle a function, as in my snippet.

By the way, may I ask how to cast tensor from logic to float in c++?

python ops are normally duplicated in c++, in this case at::Tensor::to(ScalarType) overload would do that.