Do the bias addition in the convolution in a separate call (#2656)

* Do the bias addition in the convolution in a separate call

Fixes #2655.
Somehow, doing it in a single call is slower.

* Grammar

* The change should be this, really
This commit is contained in:
Adrià Arrufat 2022-09-01 20:39:19 +09:00 committed by GitHub
parent da2f45b2e5
commit 902c70193a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,19 +232,18 @@ namespace dlib
_stride_x,
padding_y_,
padding_x_);
conv(false, output,
sub.get_output(),
filters(params,0));
// For some reason, doing this is sometimes slower than two separate calls
// conv(false, output,
// sub.get_output(),
// filters(params,0),
// biases(params, filters.size()));
if (use_bias)
{
conv(false, output,
sub.get_output(),
filters(params,0),
biases(params, filters.size()));
}
else
{
conv(false, output,
sub.get_output(),
filters(params,0));
}
tt::add(1,output,1,biases(params,filters.size()));
}
template <typename SUBNET>