def predict(self,candidates):
print(colored('Predicting {} samples...'.format(len(candidates)), 'green'))
inputx = [n.input_var for n in self.input_layers]
output = [layers.get_output(n) for n in self.nets] # Actual output
gen_output = [theano.function([inputx[i]], output[i]) for i in range(len(self.nets))]
vs = [gen_output[i](candidates) for i in range(len(self.nets))]
vs = np.transpose(vs)
# TAODEBUG:
print(vs[0])
return vs[0]
# NOTE:
# Sample of [save] / [load] of Lasagne CNN model
# can be found at:
# https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py
# def save(self, path):
# print(colored('Saving the models at {}'.format(path),'green'))
# i = 0
# for net in self.nets:
# print('...Saving {}'.format(path + str(i)))
# np.savez(path + str(i), *lasagne.layers.get_all_param_values(self.nets[i]))
# i += 1
# print('...Done')
评论列表
文章目录