4-2这里l2正则化的代码
来源:4-2 全连接层GPU实现 代码实现

佐仓千代
2017-11-13
self.layers[-1].cost(self)这里的.cost(self)是什么意思 看了很久没搞懂
写回答
1回答
-
class SoftmaxLayer(object):
def cost(self, net):
"Return the log-likelihood cost."
return -T.mean(T.log(self.output_dropout)[T.arange(net.y.shape[0]), net.y])
self.layers[-1] 是一个类
self.layers[-1].cost() 是这个类方法
self.layers[-1].cost(self) 这个类方法需要传入另外一个类对象 这里self就是指Network这个类实例本身
012017-11-14
相似问题