tf-keras-skeleton.py 文件源码

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

项目:LIE 作者: EmbraceLife 项目源码 文件源码
def add_weight(self,
                         name,
                         shape,
                         dtype=None,
                         initializer=None,
                         regularizer=None,
                         trainable=True,
                         constraint=None):
            """Adds a weight variable to the layer.

            Arguments:
                name: String, the name for the weight variable.
                shape: The shape tuple of the weight.
                dtype: The dtype of the weight.
                initializer: An Initializer instance (callable).
                regularizer: An optional Regularizer instance.
                trainable: A boolean, whether the weight should
                    be trained via backprop or not (assuming
                    that the layer itself is also trainable).
                constraint: An optional Constraint instance.

            Returns:
                The created weight variable.
            """
            if dtype is None:
              dtype = K.floatx()
            weight = self.add_variable(
                name, shape, dtype=dtype,
                initializer=initializer, regularizer=regularizer, trainable=trainable)
            if constraint is not None:
              self.constraints[weight] = constraint
            return weight
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号