Display data loaded by pytorch dataloader after augmentation?

I am new to pytorch and I am trying to work on project of human activit recognition.from my understanding the transforms operations are applied to the original data at every batch generation and upon every epoch you get different version of the dataset but the original is left unchanged and unused.
But wen I get data with the shape for exemple (112,112,16,3)
where 112 are height and width , 16 are the number of rgb frames
know after applying a series of transformation using pytorch,if I want to visualize the data after augmentation using the matplotlib librairy for exemple
what should I take into consideration ?
I ve tried something like this

for batch in train_data_loader:
inputs, targets = batch
for img in inputs:
image = img.cpu().numpy()
# transpose image to fit plt input
image = image.T
# normalise image
data_min = np.min(image, axis=(1,2), keepdims=True)
data_max = np.max(image, axis=(1,2), keepdims=True)
scaled_data = (image - data_min) / (data_max - data_min)
# show image

But got an error TypeError : invalid shape ( for image data

plt.imshow expects a valid image format while you are trying to visualize 16 images at once.
You would thus need to either visualize a single slice only or create a subplot and iterate the tensor in dim2 to visualize each slice separately.
Here is a minimal code snippet:

x = torch.randint(0, 256, (112, 112, 16, 3)).byte()

# visualize first slice only
plt.imshow(x[:, :, 0])

# visualize all
fig, axarr = plt.subplots(4, 4)
axarr = axarr.reshape(-1)
for idx in range(x.size(2)):
    x_ = x[:, :, idx]
    ax = axarr[idx]

thank you for your answer @ptrblck
juste another question if I want to read the frames from the dataloader
this is the exemple I am working with

train_loader = torch.utils.data.DataLoader(train_data,batch_size=opt.batch_size, shuffle=(train_sampler is None), num_workers=opt.n_threads,pin_memory=True, sampler=train_sampler, worker_init_fn=worker_init_fn)

I should read the image from train data ?
and if I am executing the file from the anaconda prompt terminal is there any instructions I should be adding to visaulize the images ?

You can read the data from any dataset or DataLoader and could then iterate the samples using my code.

To visualize images from your terminal you would need to add plt.show():

import numpy as np
import matplotlib.pyplot as plt

x = np.random.randint(0, 256, (224, 224, 3)).astype(np.uint8)

I used the code

 for x, l in enumerate (train_loader):
    x = torch.randint(0, 256, (112, 112, 16, 3)).byte()
     fig, axarr = plt.subplots(4, 4)
     axarr = axarr.reshape(-1)
     for idx in range(x.size(2)):
      x_ = x[:, :, idx]
      ax = axarr[idx]

But I got nothing

what could it the problem?

The figure is properly showing one subplot. If you want to show all, move the plt.show() command out of the loop.