The input is expected to have the shape [batch_size, channels, height, width]
You would have to add a batch dimension in dim0 via:
ran = ran.unsqueeze(0)

or initialize the batch dimension directly via:
ran = torch.rand((1, 3, 224, 224))