Visualize image after conv operation

Is there any way of plotting or saving a Variable as image after a conv2d operation?

2 Likes

you can save it / plot it as an image using make_grid or save_image here: https://github.com/pytorch/vision#utils

I didn’t knew this pytorch vision, thanks a lot.

Something doenst fits. In the forward method at my module, I am calling save_image(x.data,"before_conv.png"), for a Variable of shape [1, 4, 80, 80] and gives me an error: RuntimeError: inconsistent tensor size at /py/conda-bld/pytorch_1490980628440/work/torch/lib/TH/generic/THTensorCopy.c:51

you cant save a 4-channel image. You will have to save each of the 80x80 images separately.

save_image(x.data[0, 0, :, :], ...)
1 Like

Yeah, it worked. Thanks a lot!