You could try something like this:
num_classes = 22
output = Variable(torch.randn(1, num_classes, 96, 96))
_, pred = torch.max(output, dim=1)

import matplotlib.pyplot as plt

cmap = plt.get_cmap('viridis', num_classes)
seg_arr = pred[0, ...].data.numpy()
plt.imshow(seg_arr, cmap=cmap)

Let me know if this is what you are looking for.