I need to save the tensor in a file after converting it into a list of arrays. I tried that
results = []
vec=model(preprocess(image).unsqueeze(0))
vec1=vec.numpy()
for ind in range(1):
results.append(vec1[ind])
return results
and got
RuntimeError: Can’t call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.
then tried to convert this line vec1=vec.numpy()
to vec1=vec.detach().cpu().numpy()
but got killed
after some time