Skip to content

Commit

Permalink
[bugfix] Fix a bug of wrong hstep, and wrong mat constructor calling
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed May 9, 2019
1 parent d4503cd commit 238c1ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions benchmark/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
#include <dabnn/net.h>

static void BM_pack_mat_64(benchmark::State &state) {
const bnn::Mat a(1, 64, 64, 128, bnn::DataType::Float, 0);
bnn::Mat b(1, 64, 64, 128, bnn::DataType::Bit, 0);
const bnn::Mat a(1, 64, 64, 128, bnn::DataType::Float);
bnn::Mat b(1, 64, 64, 128, bnn::DataType::Bit);
for (auto _ : state) {
pack_mat_64(a, b);
}
}

static void BM_pack_mat_128(benchmark::State &state) {
const bnn::Mat a(1, 64, 64, 128, bnn::DataType::Float, 0);
bnn::Mat b(1, 64, 64, 128, bnn::DataType::Bit, 0);
const bnn::Mat a(1, 64, 64, 128, bnn::DataType::Float);
bnn::Mat b(1, 64, 64, 128, bnn::DataType::Bit);
for (auto _ : state) {
pack_mat_128(a, b);
}
Expand Down
4 changes: 2 additions & 2 deletions dabnn/mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ inline Mat::Mat(int _n, int _w, int _h, int _c, void *_data, DataType data_type,
if (require_align) {
hstep = ncnn::alignSize(w * c * elemsize, 16) / elemsize;
} else {
hstep = w * c * elemsize;
hstep = w * c;
}
BNN_ASSERT(hstep > 0, hstep);

Expand Down Expand Up @@ -523,7 +523,7 @@ inline void Mat::create(int _n, int _w, int _h, int _c, DataType _data_type,
if (require_align) {
hstep = ncnn::alignSize(w * c * elemsize, 16) / elemsize;
} else {
hstep = w * c * elemsize;
hstep = w * c;
}
BNN_ASSERT(hstep > 0, hstep);

Expand Down

0 comments on commit 238c1ee

Please sign in to comment.