def _setup_vars(self, sparse_input):
'''Setup Theano variables for our network.
Parameters
----------
sparse_input : bool
If True, create an input variable that can hold a sparse matrix.
Defaults to False, which assumes all arrays are dense.
Returns
-------
vars : list of theano variables
A list of the variables that this network requires as inputs.
'''
# x represents our network's input.
self.x = TT.matrix('x')
if sparse_input:
self.x = SS.csr_matrix('x')
# for a classifier, this specifies the correct labels for a given input.
self.labels = TT.ivector('labels')
# and the weights are reshaped to be just a vector.
self.weights = TT.vector('weights')
if self.weighted:
return [self.x, self.labels, self.weights]
return [self.x, self.labels]
评论列表
文章目录