The answer appears to be that Torch has significant overhead for small problems:

  
    
    
    Why is my numpy implementation 8x faster than pytorch forward pass? 
  
  
    I ran the profiler as you suggested. First I made the code easier to profile by splitting the pytorch and my numpy runs. See below. 
Not sure what exactly you expected. Nothing jumps out to me other than everything looks slow. The times 13.7 and 8.44 don’t add up to 14.1 s. Not sure what to make of that. 
 [image]
import IPython as ipy
import numpy as np
import torch
import time

class Net(torch.nn.Module):
    def __init__(self, input_size, layer_width):
        super(Net, self).__init__()
    …
  


This is good to keep in mind.