victoresque / pytorch-template

PyTorch deep learning projects made easy.
MIT License
4.7k stars 1.08k forks source link

stacking uni-channeled image thrice to make it 3-channeled image #36

Closed arslansadiq closed 5 years ago

arslansadiq commented 5 years ago

Hi again,

Background: I am working on uncertainty estimation so, I need to test models trained on one dataset (say MNIST) on test data from different datasets(say Fashion MNIST, NOTMINIST).

Problem: So I am testing trained models for one dataset on various datasets' test data. Suppose one scenario is testing Mnist model trained on MNIST on CIFAR-10's test data. Now as you know that CIFAR-10 has RGB images whereas MNIST has gray-scale images. So testing of trained model on MNIST will pose dimension clash on CIFAR-10's test data upon computation of fully connected layers, since it is RGB data. I am looking to find a way to stack the gray-scale image of MNIST thrice and make it 3 channeled grayscle image with all channels being the same so that it doesn't pose dimension clash further.

Any help would be great.

SunQpark commented 5 years ago

Use tensor.expand(). And use stackoverflow or something like that instead of this board for the next question. This board is here for issues of pytorch template, not for any kind of questions about pytorch.