this code does not work !!

patches_image1 = image.extract_patches_2d(image1['taille'], ((10,10)))
patches_image2 = image.extract_patches_2d(image2['taille'], ((10,10)))
patchesconcatenate = torch.cat((patches_image1, patches_image2),1)
TypeError: expected Tensor as element 0 in argument 0, but got numpy.ndarray
help me plzz
fs4ss1
2
torch.cat()
function expects torch.tensor
as input, not np.ndarray
.
You need to cast patches_image1
and patches_image2
to torch.tensor.
The following way will work: torch.tensor(patches_image1)
and torch.tensor(patches_image1)
.
thanks fs4ss1 but I have another problem
train_x, val_x, train_y, val_y = train_test_split(train_x, train_y, test_size=0.3)
train_x = train_x.reshape(train_x.shape[0], 1, train_x.shape[1], train_x.shape[2])
train_x = torch.from_numpy(train_x)
TypeError: expected np.ndarray (got Tensor)
help me please