Using convolutions without specifying input_channels

You could try something like Inferring shape via flatten operator , but it’s a workaround. PyTorch defines the graph dynamically, so it requires you to specify the number of input channels beforehand.