MCPcopy Create free account
hub / github.com/davisking/dlib / affine_transform_conv

Function affine_transform_conv

dlib/cuda/cpu_dlib.cpp:599–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597 // -----------------------------------------------------------------------------------
598
599 void affine_transform_conv(
600 tensor& dest,
601 const tensor& src,
602 const tensor& A,
603 const tensor& B
604 )
605 {
606 DLIB_CASSERT(have_same_dimensions(dest,src));
607 DLIB_CASSERT(have_same_dimensions(A,B));
608 DLIB_CASSERT(A.num_samples() == 1 &&
609 A.nr() == 1 &&
610 A.nc() == 1 &&
611 A.k() == src.k());
612
613 auto d = dest.host();
614 auto s = src.host();
615 const auto a = A.host();
616 const auto b = B.host();
617 for (long n = 0; n < dest.num_samples(); ++n)
618 {
619 for (long k = 0; k < dest.k(); ++k)
620 {
621 for (long r = 0; r < dest.nr(); ++r)
622 {
623 for (long c = 0; c < dest.nc(); ++c)
624 {
625 *d++ = a[k]*(*s++) + b[k];
626 }
627 }
628 }
629 }
630 }
631
632 // ----------------------------------------------------------------------------------------
633

Callers 2

test_more_ops2Function · 0.50
forward_inplaceMethod · 0.50

Calls 6

have_same_dimensionsFunction · 0.70
num_samplesMethod · 0.45
nrMethod · 0.45
ncMethod · 0.45
kMethod · 0.45
hostMethod · 0.45

Tested by 1

test_more_ops2Function · 0.40