Here is the modified mnist example to illustrate this.

  
      gist.github.com
  
  
    https://gist.github.com/psattige/eff61cdc0a70824eb0378cb5a04d749a 12
mnist_test.py
# Without slicing/indexing (0.8s)
# python mnist_test.py 

# With slicing/indexing (1.2s)
# python mnist_test.py --slice

from __future__ import print_function
import argparse
import torch
import torch.nn as nn
This file has been truncated. show original




  
  
    
    
  
  


My current guess is the cost of indexing adds up to a considerable amount if there several of such operations.