Create batch of size 1 to test trained model


I have a trained model loaded with

model = torch.load(...)

I want to create like an app to take an input (which is an spectrogram of a recorded audio) but the input should be in shape like (batch, height, width)
I only have (H, W) but would want something like (1, H, W).

How can I do this? Thanks a lot.

Assuming input is (H, W), input = input.unsqueeze(0) will make it (1, H, W)


Thank you so much!! :slight_smile:

1 Like