@@ -20,54 +20,18 @@ template<>
2020void caffe_cpu_gemm<float >(const CBLAS_TRANSPOSE TransA,
2121 const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
2222 const float alpha, const float * A, const float * B, const float beta,
23- float * C, const bool submanifold_sparse ) {
23+ float * C) {
2424 int lda = (TransA == CblasNoTrans) ? K : M;
2525 int ldb = (TransB == CblasNoTrans) ? N : K;
26-
2726 cblas_sgemm (CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B,
2827 ldb, beta, C, N);
29-
30- if (submanifold_sparse)
31- {
32- // Submanifold sparse active site check
33- // weight: M*K input blob: K*N -> output blob: M*N
34- // LOG(INFO)<<"K="<<K<<", M="<<M<<", N="<<N<<std::endl;
35- LOG (INFO)<<" Use submanifold sparse." <<std::endl;
36- for (int j=0 ;j<N; j++)
37- {
38- bool batch_center_active = false ;
39- for (int b=0 ; b<M; b++)
40- {
41- bool center_active = false ;
42- for (int i=0 ; i<K/M; i++) // K=M*xyz
43- {
44- int index = (b*(K/M)+i)*N+j;
45- if (B[index] != 0 )
46- {
47- if (i == (K/M)/2 )
48- {
49- center_active = true ;
50- // LOG(WARNING)<<"center active!!"<<std::endl;
51- // LOG(INFO)<<"index b="<<b<<", i="<<i<<", j="<<j<<", data="<<B[index]<<" ";
52- }
53- }
54- }
55- batch_center_active = batch_center_active || center_active;
56- }
57- if (!batch_center_active)
58- {
59- for (int t=0 ; t<M; t++)
60- C[t*N+j] = 0 ;
61- }
62- }
63- }
6428}
6529
6630template <>
6731void caffe_cpu_gemm<double >(const CBLAS_TRANSPOSE TransA,
6832 const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K,
6933 const double alpha, const double * A, const double * B, const double beta,
70- double * C, const bool submanifold_sparse ) {
34+ double * C) {
7135 int lda = (TransA == CblasNoTrans) ? K : M;
7236 int ldb = (TransB == CblasNoTrans) ? N : K;
7337 cblas_dgemm (CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B,
0 commit comments