Thanks for your reply. I haven’t noticed the device of torch.*_like(input) is also the same as that of input until you remind me.  I will check __setattr__ for details. And that’s the second time you answered me. Thanks again!