ValueError: invalid null reference in method 'NetworkDefinition_mark_output', argument 2 of type 'nvinfer1::ITensor &'

I am running tensorrt 3.0.4 on Ubuntu 14.04 , with CUDA toolkit 8 and CUDNN 7.1.

I am trying to run the MNIST sample program to convert my caffe model but I keep encountering the following error:

vadmin@ALIVE-DOT98:~/Desktop$ python test.py
Traceback (most recent call last):
File “test.py”, line 18, in
engine = trt.utils.caffe_to_trt_engine(G_LOGGER,MODEL_PROTOTXT,CAFFE_MODEL,1,1 << 20,OUTPUT_LAYERS,trt.infer.DataType.FLOAT)
File “/usr/local/lib/python2.7/dist-packages/tensorrt/utils/_utils.py”, line 319, in caffe_to_trt_engine
layer = network.mark_output(t)
ValueError: invalid null reference in method ‘NetworkDefinition_mark_output’, argument 2 of type ‘nvinfer1::ITensor &’