PyTorch doesn't seem to have a module for LRN yet. This is needed for running models pre-trained with LRN layers (mainly AlexNet based models). I have a workaround using the legacy API
from torch import nn
from torch.autograd import Variable
from torch.legacy.nn import SpatialCrossMapLRN
class LRN(nn.Module):
def __init__(self, size, alpha=1e-4, beta=0.75, k=1):
super().__init__()
self.lrn = SpatialCrossMapLRN(size, alpha, beta, k)
def forward(self, x):
self.lrn.clearState()
return Variable(self.lrn.updateOutput(x.data))
but that doesn't seem to have a CUDA binding.