RuntimeError: _Map_base::at when calling Functional Batch Norm

I have saved the parameters of a model which has batch normalization layers. Now I need to selectively use the batch norm layers of this trained model and load them into my new model as non-trainable parameters. So I am using torch.functional.batch_norm to do this. I am assigning all the arguments to the function call, that is weights, bias, running mean and running var. But I am getting the following while doing so. It seems to be emerging from C code underneath pytorch and it isn’t so helpful. Please help me out. Here’s the stack trace for the same,

File "/home/gauravm/py/local/lib/python2.7/site-packages/torch/nn/", line 1012, in batch_norm
    f = torch._C._functions.BatchNorm(running_mean, running_var, training, momentum, eps, torch.backends.cudnn.enabled)
RuntimeError: _Map_base::at

That doesn’t sound very good. One thing you could do is try debugging in gdb.

You can do something like:

gdb python
>> catch throw
>> run <how the script was called>
>> backtrace