def __init__(self, feature_count=None, hidden_unit_count=None, category_count=None, archive=None):
if archive is None and (feature_count is None or hidden_unit_count is None or category_count is None):
raise ValueError(
"If archive is not passed in, an " + Parameters.Globals.__name__ +
" object needs all other constructor arguments to be integers.")
if archive is None:
self.embedding_weights = theano.shared(
(0.01 * np.random.rand(feature_count, hidden_unit_count)).astype(config.floatX), # formerly 'Wemb'
self.embedding_weights_literal)
self.classifier_weights = theano.shared(
0.01 * np.random.randn(hidden_unit_count, category_count).astype(config.floatX),
self.classifier_weights_literal) # formerly 'U'
self.classifier_bias = theano.shared(np.zeros((category_count,)).astype(config.floatX),
self.classifier_bias_literal) # formerly 'b'
else:
self.load_values_from_dict(archive)
评论列表
文章目录