params.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:AMBR 作者: Algomorph 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号