The following code causes a RuntimeError ’ unsupported operation: more than one element of the written-to tensor refers to a single memory location. Please clone() the tensor before performing the operation’. Could anyone help me?
kY0 and kX0 are expanded tensors and as the error message suggest, you could need to clone them before applying inplace operations.
Did you try to use the suggested operation?
Thanks for your suggestion. I thought the meshgrid function is the same as the one in numpy, so I didn’t figure out why I has to clone the tensor first. Now I get it.