def replaceTrainingData(self, start_idx, end_idx, last=False):
"""
Replace the shared data of the training data
:param start_idx: start index of data
:param end_idx: end index of data
:param last: specify if it is last macro-batch
:return: None
"""
for var in self.managedVar:
if not hasattr(self, var):
raise ValueError("Variable " + var + " not defined!")
if last is True:
getattr(self, var).set_value(getattr(self, var+'DBlast')[start_idx:end_idx], borrow=True)
else:
getattr(self, var).set_value(getattr(self, var+'DB')[start_idx:end_idx], borrow=True)
评论列表
文章目录