def forward(data): global fc6, fc7, fc8 conv1 = ConvForward(data, conv1_filters, conv1_bias, kernel_size=(11, 11), padding=(0, 0), stride=(4, 4)) conv1 = ReluForward(conv1) norm1, norm1_scale = LrnForward(conv1, alpha=alpha, beta=beta, local_size=local_size, k=1) pool1, pool1_mask = PoolForward(norm1, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) conv2 = ConvForward(pool1, conv2_filters, conv2_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) conv2 = ReluForward(conv2) norm2, norm2_scale = LrnForward(conv2, alpha=alpha, beta=beta, local_size=local_size, k=1) pool2, pool2_mask = PoolForward(norm2, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) conv3 = ConvForward(pool2, conv3_filters, conv3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) conv3 = ReluForward(conv3) conv4 = ConvForward(conv3, conv4_filters, conv4_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) conv4 = ReluForward(conv4) conv5 = ConvForward(conv4, conv5_filters, conv5_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) conv5 = ReluForward(conv5) pool5, pool5_mask = PoolForward(conv5, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) np.dot(pool5.reshape(pool5.shape[0], fc6_filters.shape[1]), fc6_filters.T, fc6) fc6 += fc6_bias fc6 = ReluForward(fc6) np.dot(fc6, fc7_filters.T, fc7) fc7 += fc7_bias fc7 = ReluForward(fc7) np.dot(fc7, fc8_filters.T, fc8) fc8 += fc8_bias prob = SoftmaxForward(fc8) return prob
def hm_forward(top, bottom): top = SoftmaxForward(bottom) return top
def fn(bottom, label, top): top = SoftmaxForward(bottom, label) return top
def forward(data): conv1_7x7_s2 = ConvForward(data, conv1_7x7_s2_filters, conv1_7x7_s2_bias, kernel_size=(7, 7), padding=(3, 3), stride=(2, 2)) conv1_7x7_s2 = ReluForward(conv1_7x7_s2) pool1_3x3_s2, pool1_3x3_s2_mask = PoolForward(conv1_7x7_s2, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) pool1_norm1, pool1_norm1_scale = LrnForward(pool1_3x3_s2, alpha=0.0001, beta=0.75, local_size=5, k=1) conv2_3x3_reduce = ConvForward(pool1_norm1, conv2_3x3_reduce_filters, conv2_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) conv2_3x3_reduce = ReluForward(conv2_3x3_reduce) conv2_3x3 = ConvForward(conv2_3x3_reduce, conv2_3x3_filters, conv2_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) conv2_3x3 = ReluForward(conv2_3x3) conv2_norm2, conv2_norm2_scale = LrnForward(conv2_3x3, alpha=0.0001, beta=0.75, local_size=5, k=1) pool2_3x3_s2, pool2_3x3_s2_mask = PoolForward(conv2_norm2, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) inception_3a_1x1 = ConvForward(pool2_3x3_s2, inception_3a_1x1_filters, inception_3a_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3a_1x1 = ReluForward(inception_3a_1x1) inception_3a_3x3_reduce = ConvForward(pool2_3x3_s2, inception_3a_3x3_reduce_filters, inception_3a_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3a_3x3_reduce = ReluForward(inception_3a_3x3_reduce) inception_3a_3x3 = ConvForward(inception_3a_3x3_reduce, inception_3a_3x3_filters, inception_3a_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_3a_3x3 = ReluForward(inception_3a_3x3) inception_3a_5x5_reduce = ConvForward(pool2_3x3_s2, inception_3a_5x5_reduce_filters, inception_3a_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3a_5x5_reduce = ReluForward(inception_3a_5x5_reduce) inception_3a_5x5 = ConvForward(inception_3a_5x5_reduce, inception_3a_5x5_filters, inception_3a_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_3a_5x5 = ReluForward(inception_3a_5x5) inception_3a_pool, inception_3a_pool_mask = PoolForward(pool2_3x3_s2, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_3a_pool_proj = ConvForward(inception_3a_pool, inception_3a_pool_proj_filters, inception_3a_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3a_pool_proj = ReluForward(inception_3a_pool_proj) inception_3a_output = ConcatForward(inception_3a_1x1, inception_3a_3x3, inception_3a_5x5, inception_3a_pool_proj) inception_3b_1x1 = ConvForward(inception_3a_output, inception_3b_1x1_filters, inception_3b_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3b_1x1 = ReluForward(inception_3b_1x1) inception_3b_3x3_reduce = ConvForward(inception_3a_output, inception_3b_3x3_reduce_filters, inception_3b_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3b_3x3_reduce = ReluForward(inception_3b_3x3_reduce) inception_3b_3x3 = ConvForward(inception_3b_3x3_reduce, inception_3b_3x3_filters, inception_3b_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_3b_3x3 = ReluForward(inception_3b_3x3) inception_3b_5x5_reduce = ConvForward(inception_3a_output, inception_3b_5x5_reduce_filters, inception_3b_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3b_5x5_reduce = ReluForward(inception_3b_5x5_reduce) inception_3b_5x5 = ConvForward(inception_3b_5x5_reduce, inception_3b_5x5_filters, inception_3b_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_3b_5x5 = ReluForward(inception_3b_5x5) inception_3b_pool, inception_3b_pool_mask = PoolForward(inception_3a_output, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_3b_pool_proj = ConvForward(inception_3b_pool, inception_3b_pool_proj_filters, inception_3b_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_3b_pool_proj = ReluForward(inception_3b_pool_proj) inception_3b_output = ConcatForward(inception_3b_1x1, inception_3b_3x3, inception_3b_5x5, inception_3b_pool_proj) pool3_3x3_s2, pool3_3x3_s2_mask = PoolForward(inception_3b_output, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) inception_4a_1x1 = ConvForward(pool3_3x3_s2, inception_4a_1x1_filters, inception_4a_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4a_1x1 = ReluForward(inception_4a_1x1) inception_4a_3x3_reduce = ConvForward(pool3_3x3_s2, inception_4a_3x3_reduce_filters, inception_4a_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4a_3x3_reduce = ReluForward(inception_4a_3x3_reduce) inception_4a_3x3 = ConvForward(inception_4a_3x3_reduce, inception_4a_3x3_filters, inception_4a_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4a_3x3 = ReluForward(inception_4a_3x3) inception_4a_5x5_reduce = ConvForward(pool3_3x3_s2, inception_4a_5x5_reduce_filters, inception_4a_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4a_5x5_reduce = ReluForward(inception_4a_5x5_reduce) inception_4a_5x5 = ConvForward(inception_4a_5x5_reduce, inception_4a_5x5_filters, inception_4a_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_4a_5x5 = ReluForward(inception_4a_5x5) inception_4a_pool, inception_4a_pool_mask = PoolForward(pool3_3x3_s2, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4a_pool_proj = ConvForward(inception_4a_pool, inception_4a_pool_proj_filters, inception_4a_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4a_pool_proj = ReluForward(inception_4a_pool_proj) inception_4a_output = ConcatForward(inception_4a_1x1, inception_4a_3x3, inception_4a_5x5, inception_4a_pool_proj) inception_4b_1x1 = ConvForward(inception_4a_output, inception_4b_1x1_filters, inception_4b_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4b_1x1 = ReluForward(inception_4b_1x1) inception_4b_3x3_reduce = ConvForward(inception_4a_output, inception_4b_3x3_reduce_filters, inception_4b_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4b_3x3_reduce = ReluForward(inception_4b_3x3_reduce) inception_4b_3x3 = ConvForward(inception_4b_3x3_reduce, inception_4b_3x3_filters, inception_4b_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4b_3x3 = ReluForward(inception_4b_3x3) inception_4b_5x5_reduce = ConvForward(inception_4a_output, inception_4b_5x5_reduce_filters, inception_4b_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4b_5x5_reduce = ReluForward(inception_4b_5x5_reduce) inception_4b_5x5 = ConvForward(inception_4b_5x5_reduce, inception_4b_5x5_filters, inception_4b_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_4b_5x5 = ReluForward(inception_4b_5x5) inception_4b_pool, inception_4b_pool_mask = PoolForward(inception_4a_output, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4b_pool_proj = ConvForward(inception_4b_pool, inception_4b_pool_proj_filters, inception_4b_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4b_pool_proj = ReluForward(inception_4b_pool_proj) inception_4b_output = ConcatForward(inception_4b_1x1, inception_4b_3x3, inception_4b_5x5, inception_4b_pool_proj) inception_4c_1x1 = ConvForward(inception_4b_output, inception_4c_1x1_filters, inception_4c_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4c_1x1 = ReluForward(inception_4c_1x1) inception_4c_3x3_reduce = ConvForward(inception_4b_output, inception_4c_3x3_reduce_filters, inception_4c_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4c_3x3_reduce = ReluForward(inception_4c_3x3_reduce) inception_4c_3x3 = ConvForward(inception_4c_3x3_reduce, inception_4c_3x3_filters, inception_4c_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4c_3x3 = ReluForward(inception_4c_3x3) inception_4c_5x5_reduce = ConvForward(inception_4b_output, inception_4c_5x5_reduce_filters, inception_4c_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4c_5x5_reduce = ReluForward(inception_4c_5x5_reduce) inception_4c_5x5 = ConvForward(inception_4c_5x5_reduce, inception_4c_5x5_filters, inception_4c_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_4c_5x5 = ReluForward(inception_4c_5x5) inception_4c_pool, inception_4c_pool_mask = PoolForward(inception_4b_output, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4c_pool_proj = ConvForward(inception_4c_pool, inception_4c_pool_proj_filters, inception_4c_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4c_pool_proj = ReluForward(inception_4c_pool_proj) inception_4c_output = ConcatForward(inception_4c_1x1, inception_4c_3x3, inception_4c_5x5, inception_4c_pool_proj) inception_4d_1x1 = ConvForward(inception_4c_output, inception_4d_1x1_filters, inception_4d_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4d_1x1 = ReluForward(inception_4d_1x1) inception_4d_3x3_reduce = ConvForward(inception_4c_output, inception_4d_3x3_reduce_filters, inception_4d_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4d_3x3_reduce = ReluForward(inception_4d_3x3_reduce) inception_4d_3x3 = ConvForward(inception_4d_3x3_reduce, inception_4d_3x3_filters, inception_4d_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4d_3x3 = ReluForward(inception_4d_3x3) inception_4d_5x5_reduce = ConvForward(inception_4c_output, inception_4d_5x5_reduce_filters, inception_4d_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4d_5x5_reduce = ReluForward(inception_4d_5x5_reduce) inception_4d_5x5 = ConvForward(inception_4d_5x5_reduce, inception_4d_5x5_filters, inception_4d_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_4d_5x5 = ReluForward(inception_4d_5x5) inception_4d_pool, inception_4d_pool_mask = PoolForward(inception_4c_output, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4d_pool_proj = ConvForward(inception_4d_pool, inception_4d_pool_proj_filters, inception_4d_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4d_pool_proj = ReluForward(inception_4d_pool_proj) inception_4d_output = ConcatForward(inception_4d_1x1, inception_4d_3x3, inception_4d_5x5, inception_4d_pool_proj) inception_4e_1x1 = ConvForward(inception_4d_output, inception_4e_1x1_filters, inception_4e_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4e_1x1 = ReluForward(inception_4e_1x1) inception_4e_3x3_reduce = ConvForward(inception_4d_output, inception_4e_3x3_reduce_filters, inception_4e_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4e_3x3_reduce = ReluForward(inception_4e_3x3_reduce) inception_4e_3x3 = ConvForward(inception_4e_3x3_reduce, inception_4e_3x3_filters, inception_4e_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4e_3x3 = ReluForward(inception_4e_3x3) inception_4e_5x5_reduce = ConvForward(inception_4d_output, inception_4e_5x5_reduce_filters, inception_4e_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4e_5x5_reduce = ReluForward(inception_4e_5x5_reduce) inception_4e_5x5 = ConvForward(inception_4e_5x5_reduce, inception_4e_5x5_filters, inception_4e_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_4e_5x5 = ReluForward(inception_4e_5x5) inception_4e_pool, inception_4e_pool_mask = PoolForward(inception_4d_output, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_4e_pool_proj = ConvForward(inception_4e_pool, inception_4e_pool_proj_filters, inception_4e_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_4e_pool_proj = ReluForward(inception_4e_pool_proj) inception_4e_output = ConcatForward(inception_4e_1x1, inception_4e_3x3, inception_4e_5x5, inception_4e_pool_proj) pool4_3x3_s2, pool4_3x3_s2_mask = PoolForward(inception_4e_output, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) inception_5a_1x1 = ConvForward(pool4_3x3_s2, inception_5a_1x1_filters, inception_5a_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5a_1x1 = ReluForward(inception_5a_1x1) inception_5a_3x3_reduce = ConvForward(pool4_3x3_s2, inception_5a_3x3_reduce_filters, inception_5a_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5a_3x3_reduce = ReluForward(inception_5a_3x3_reduce) inception_5a_3x3 = ConvForward(inception_5a_3x3_reduce, inception_5a_3x3_filters, inception_5a_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_5a_3x3 = ReluForward(inception_5a_3x3) inception_5a_5x5_reduce = ConvForward(pool4_3x3_s2, inception_5a_5x5_reduce_filters, inception_5a_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5a_5x5_reduce = ReluForward(inception_5a_5x5_reduce) inception_5a_5x5 = ConvForward(inception_5a_5x5_reduce, inception_5a_5x5_filters, inception_5a_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_5a_5x5 = ReluForward(inception_5a_5x5) inception_5a_pool, inception_5a_pool_mask = PoolForward(pool4_3x3_s2, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_5a_pool_proj = ConvForward(inception_5a_pool, inception_5a_pool_proj_filters, inception_5a_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5a_pool_proj = ReluForward(inception_5a_pool_proj) inception_5a_output = ConcatForward(inception_5a_1x1, inception_5a_3x3, inception_5a_5x5, inception_5a_pool_proj) inception_5b_1x1 = ConvForward(inception_5a_output, inception_5b_1x1_filters, inception_5b_1x1_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5b_1x1 = ReluForward(inception_5b_1x1) inception_5b_3x3_reduce = ConvForward(inception_5a_output, inception_5b_3x3_reduce_filters, inception_5b_3x3_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5b_3x3_reduce = ReluForward(inception_5b_3x3_reduce) inception_5b_3x3 = ConvForward(inception_5b_3x3_reduce, inception_5b_3x3_filters, inception_5b_3x3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_5b_3x3 = ReluForward(inception_5b_3x3) inception_5b_5x5_reduce = ConvForward(inception_5a_output, inception_5b_5x5_reduce_filters, inception_5b_5x5_reduce_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5b_5x5_reduce = ReluForward(inception_5b_5x5_reduce) inception_5b_5x5 = ConvForward(inception_5b_5x5_reduce, inception_5b_5x5_filters, inception_5b_5x5_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) inception_5b_5x5 = ReluForward(inception_5b_5x5) inception_5b_pool, inception_5b_pool_mask = PoolForward(inception_5a_output, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) inception_5b_pool_proj = ConvForward(inception_5b_pool, inception_5b_pool_proj_filters, inception_5b_pool_proj_bias, kernel_size=(1, 1), padding=(0, 0), stride=(1, 1)) inception_5b_pool_proj = ReluForward(inception_5b_pool_proj) inception_5b_output = ConcatForward(inception_5b_1x1, inception_5b_3x3, inception_5b_5x5, inception_5b_pool_proj) pool5_7x7_s1= AvePoolForward(inception_5b_output, kernel_size=(7, 7), padding=(0, 0), stride=(1, 1)) loss3_classifier = InnerProductForward(pool5_7x7_s1, loss3_classifier_filters, loss3_classifier_bias) prob = SoftmaxForward(loss3_classifier) return prob
def forward(data): global fc6, fc7, fc8 conv1 = ConvForward(data, conv1_filters, conv1_bias, kernel_size=(11, 11), padding=(0, 0), stride=(4, 4)) conv1 = ReluForward(conv1) norm1, norm1_scale = LrnForward(conv1, alpha=alpha, beta=beta, local_size=local_size, k=1) pool1, pool1_mask = PoolForward(norm1, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) conv2 = ConvForward(pool1, conv2_filters, conv2_bias, kernel_size=(5, 5), padding=(2, 2), stride=(1, 1)) conv2 = ReluForward(conv2) norm2, norm2_scale = LrnForward(conv2, alpha=alpha, beta=beta, local_size=local_size, k=1) pool2, pool2_mask = PoolForward(norm2, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) conv3 = ConvForward(pool2, conv3_filters, conv3_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) conv3 = ReluForward(conv3) conv4 = ConvForward(conv3, conv4_filters, conv4_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) conv4 = ReluForward(conv4) conv5 = ConvForward(conv4, conv5_filters, conv5_bias, kernel_size=(3, 3), padding=(1, 1), stride=(1, 1)) conv5 = ReluForward(conv5) pool5, pool5_mask = PoolForward(conv5, kernel_size=(3, 3), padding=(0, 0), stride=(2, 2)) N = fc6.shape[1] K = np.prod(pool5.shape[1:]) M = pool5.shape[0] sgemm(False, True, 1.0, pool5, 0, K, fc6_filters, 0, K, 0.0, fc6, 0, N, M, N, K) sgemm(False, False, 1.0, fc6_bias_multiplier, 0, 1, fc6_bias, 0, N, 1.0, fc6, 0, N, M, N, 1) fc6 = ReluForward(fc6) N = fc7.shape[1] K = np.prod(fc6.shape[1:]) M = fc6.shape[0] sgemm(False, True, 1.0, fc6, 0, K, fc7_filters, 0, K, 0.0, fc7, 0, N, M, N, K) sgemm(False, False, 1.0, fc7_bias_multiplier, 0, 1, fc7_bias, 0, N, 1.0, fc7, 0, N, M, N, 1) fc7 = ReluForward(fc7) N = fc8.shape[1] K = np.prod(fc7.shape[1:]) M = fc7.shape[0] sgemm(False, True, 1.0, fc7, 0, K, fc8_filters, 0, K, 0.0, fc8, 0, N, M, N, K) sgemm(False, False, 1.0, fc8_bias_multiplier, 0, 1, fc8_bias, 0, N, 1.0, fc8, 0, N, M, N, 1) prob = SoftmaxForward(fc8) return prob