Skip to content

Commit

Permalink
Try to update
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed Aug 20, 2019
1 parent e4d3cb6 commit e065c8c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion dabnn/layers/BinConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,22 @@ void BinConv::forward_impl() const {
1, output_mat->c, *output_mat);
}
} else {
pack_mat(*input_mat, *binarized_mat);
// pack_mat(*input_mat, *binarized_mat);
const auto N = input_mat->n;
const auto HWC = input_mat->h * input_mat->w * input_mat->elem_c;
auto *bptr = binarized_mat->point<uint64_t>(0, 0, 0);
FORZ(n, N) {
FORZS(i, HWC, 128) {
const size_t eff_bits = std::max<size_t>(HWC - i, 128);
auto *fptr = ((float *) input_mat->data) + n * HWC + i;
pack_64_bitset(fptr, bptr++,
std::min<size_t>(eff_bits, 64));
pack_64_bitset(
fptr + 64, bptr++,
std::min<size_t>(std::max<size_t>(0, eff_bits - 64), 64));
}
}

baseline_bconv(*binarized_mat, *weight_mat, weight_mat->h,
weight_mat->w, pad_h, pad_w, stride_h, stride_w, 1, 1,
output_mat->c, *output_mat);
Expand Down

0 comments on commit e065c8c

Please sign in to comment.