import caffe
import numpy as np
class DataLabelLoader(caffe.Layer):
def setup(self, bottom, top):
print self
print top
print bottom
# two tops: data and label
if len(top) != 2: #the evil line 16
raise Exception("Need to define two tops: data and label.")
def reshape(self, bottom, top):
pass
def forward(self, bottom, top):
pass
def backward(self, top, propagate_down, bottom):
pass
Traceback (most recent call last):
File "/home/me/python/train/layers.py", line 7, in <module>
class DataLabelLoader(caffe.Layer):
File "/home/me/python/train/layers.py", line 16, in DataLabelLoader
if len(top) != 2:
NameError: name 'top' is not defined
<layers.DataLabelLoader object at 0x7ff489d31db8>
<caffe._caffe.RawBlobVec object at 0x7ff489f59cd0>
<caffe._caffe.RawBlobVec object at 0x7ff489eb8250>