Fusion tensors into one multidimensional

Hey torch-expert :),
I need to create my trainloader using Dataloader class from pytorch library.
The problem is that I’ve 1 tensor of feature extracted, 1 tensor for labels and 1 tensor 28x28 extracted by fashion_mnist dataset. How can I combine different tensor into one, such that I can send into my model? (resnet18). These 3 tensors are separated at this moment due by necessity. In the specific, I have (128,2), (128) and (28x28) tensors.
Thanks in advance :slight_smile:

How would you like to combine these tensors?
Resnet expects an image tensor of [batch_size, 3, 224, 224] as its input.
I’m currently unsure, how to construct such a tensor using your input values.

Exactly. I have to construct a tensor with that shape. How can I do? Thanks

i need to replicate the train loader using these information. The main reason that i’m working only on features. After that, i need to compact these tensor into one, in order to be accepted by resnet18. These information are saved into
class_list[y].append([instance, single_instance[-1], labels]) where,
each object is a tensor (features, 28x28 tensor, 28 tensor label).
When i try to convert this into Tensor, i obtain an error of shape caused by 28x28 tensor…

I’m really not sure how you would like to create a tensor of [3, 224, 224] using your data.
Your raw data has 128*2+128+28*28 = 1168 values, while the expected image tensor has 150528 values.
Would you like to upsample the features somehow?
While this could make sense for the MNIST data, I’m not sure, how you would like to treat your features.