def addStaticData(self, data):
"""
Set the data of the network, not managed within training iterations, e.g. used for validation or other small data
:param data: training data and labels specified as dictionary
:return: None
"""
if not isinstance(data, dict):
raise ValueError("Error: expected dictionary for data!")
for key in data:
# no need to cache validation data
setattr(self, key+'DB', data[key])
# shared variable already exists?
if hasattr(self, key):
print("Reusing shared variables!")
getattr(self, key).set_value(getattr(self, key+'DB'), borrow=True)
else:
# create shared data
setattr(self, key, theano.shared(getattr(self, key+'DB'), name=key, borrow=True))
评论列表
文章目录