Transferring pytorch model to caffe2 using onnx gives attribute error

I have converted a pytorch model to onnx format and then to caffe2.

When I am verifying the numerical correctness of the model it gives attribute error
AtrributError:‘nonetype’ object has no attribute ‘data’

I followed instructions from pytorch documentation.
np.testing.assert_almost_equal(torch_model1.data.cpu().numpy(),c2_out,decimal=3)