Beispiel #1
0
 def initialize(self):
     self.pool_method = self.pool_dict["method"]
     self.pool_size = self.pool_dict["size"]  #卷积核的大小,为一个正方形
     self.stride = self.pool_dict["stride"]
     self.padding = self.pool_dict["padding"]
     h, w = util.getPadedOutShape(self.preLayer.A1_shape, self.pool_size,
                                  self.stride, self.padding)
     self.A1_shape = (h, w, self.preLayer.A1_shape[2])
     self.A1_size = h * w * self.preLayer.A1_shape[2]
Beispiel #2
0
 def initialize(self):
     channels = self.preLayer.A1_shape[2]
     size = self.filter_dict["size"]  #卷积核的大小,为一个正方形
     filter_count = self.filter_dict["count"]  #卷积后的通道数
     #就是过滤器filter的矩阵,实质就是权重参数
     self.W = np.random.randn(size, size, channels, filter_count) * 0.01
     #确定B的shape,这其实也是本层输出的shape
     stride = self.filter_dict["stride"]
     padding = self.filter_dict["padding"]
     h, w = util.getPadedOutShape(self.preLayer.A1_shape, size, stride,
                                  padding)
     self.A1_shape = (h, w, filter_count)
     self.A1_size = h * w * filter_count
     #         self.B = np.random.randn(h,w,filter_count) #初始化B
     self.B = np.zeros((1, 1, filter_count), dtype=float)  #初始化B