x is an image.
R = x[0,0,:,:]
G = x[0,1,:,:]
B = x[0,2,:,:]
v_p = torch.tensor([R, G, B, torch.pow(R,2), torch.pow(G,2), torch.pow(B,2), R * G, G * B, B * R, 1.0])
The problem is many of the elements have different dtype.
The following is the error,
ValueError Traceback (most recent call last)
in ()
----> 1 v_p = model.get_param(img)
2 v_p.shapein get_param(x)
—> 67 v_p = torch.tensor([R, G, B, torch.pow(R,2), torch.pow(G,2), torch.pow(B,2), R * G, G * B, B * R, 1.0])
68 return v_p.reshape(1,10)
69ValueError: only one element tensors can be converted to Python scalars
I don’t want to convert to numpy*