Rafay_Khan:

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.



Can u try creating the tensor like this?
img_inp = torch.from_numpy(prepare_img(img).transpose(2, 0, 1)[None]).to(dtype=torch.float,device=UR_DEVICE)