def _build_validate_function(self):
print 'building validate function'
t1 = datetime.datetime.now()
data = self.val_data
captions = self.val_data_captions
self._index_im_val = T.vector(dtype='int32') # index to the minibatch
self._index_cap_val = T.vector(dtype='int32')
self._cap_len_val = T.scalar(dtype='int32')
self._validate_function = theano.function(inputs=[self._index_im_val, self._index_cap_val, self._cap_len_val, self._run_steps],
outputs=[self._kl_final, self._logpxz, self._log_likelihood],
updates=self._updates_train,
givens={
self._x: data[self._index_im_val],
self._y: captions[self._index_cap_val,0:self._cap_len_val]
})
t2 = datetime.datetime.now()
print (t2-t1)
评论列表
文章目录