Howdy @Ajinkya_Bankar! Perhaps you’re looking for these functions; I’m sure you could find more succinct usages similar to your use case in Torch tutorials and examples if you search for these fns in their awesome docs:
https://pytorch.org/docs/stable/generated/torch.from_numpy.html#torch.from_numpy 10
https://pytorch.org/docs/stable/tensors.html#torch.Tensor.numpy 3
Be sure to review how .detach() and device transfer works.