Channels-Last stride:  (120000, 1, 600, 3)
```
The input shape stays the same for contiguous and channels-last formats. Internally however, the tensor's layout has changed as you can see in the strides. Now, the number of jumps required to go across channels is only 1 (instead of 40000 in the contiguous tensor).
This better data locality means convolution layers can access all the channels for a given pixel much faster. Let's see now how the memory format affects runtime:
```python
from torchvision.models import resnet34, resnet50, resnet101
m = resnet34(pretrained=False)
m = resnet50(pretrained=False)
m = resnet101(pretrained=False)
def get_optimized_model(mm):
  mm = mm.eval()
  scripted = torch.jit.script(mm)
  optimized = optimize_for_mobile(scripted)  # explicitly call the xnnpack rewrite 
  return scripted, optimized
def compare_contiguous_CL(mm):
  # inference on contiguous
  start = time.perf_counter()
  for i in range(20):
    mm(x)
  end = time.perf_counter()