sksq96 / pytorch-summary

Model summary in PyTorch similar to `model.summary()` in Keras
MIT License
3.98k stars 412 forks source link

Feature request: support multiple input of different ndim #172

Closed ZeyuSun closed 3 years ago

ZeyuSun commented 3 years ago

Feature:

Support multiple input of different dimensions

Motivation:

This is common for in multimodal learning. For example, suppose for each an MNIST image x, we extract 3 additional features stored in z. The following code should work.

x_shape = (1,28,28)
z_shape = (3,)
summary(model, [x_shape, z_shape])

However, the current implementation involves converting [x_shape, z_shape] to a numpy array, which assumes the same dimension of x_shape and z_shape: https://github.com/sksq96/pytorch-summary/blob/345d898d84507b848e92dab4629e03405e19afce/torchsummary/torchsummary.py#L101-L102

ZeyuSun commented 3 years ago

I realized I was not using the latest version.