func TestCorrMultiBankStrideBLAS_vsNaive(t *testing.T) { const ( m = 40 n = 30 w = 100 h = 80 numIn = 4 numOut = 6 r = 3 eps = 1e-9 ) f := randMulti(w, h, numIn) g := randMultiBank(w, h, numIn, numOut) naive, err := slide.CorrMultiBankStrideNaive(f, g, r) if err != nil { t.Fatal(err) } blas, err := slide.CorrMultiBankStrideBLAS(f, g, r) if err != nil { t.Fatal(err) } if err := errIfNotEqMulti(naive, blas, eps); err != nil { t.Fatal(err) } }
func (phi *ConvMulti) Apply(x *rimg64.Multi) (*rimg64.Multi, error) { if x.Channels != phi.Filters.Channels { err := fmt.Errorf( "channels: image has %d, filter bank has %d", x.Channels, phi.Filters.Channels, ) return nil, err } if phi.Stride <= 1 { return slide.CorrMultiBankBLAS(x, phi.Filters) } return slide.CorrMultiBankStrideBLAS(x, phi.Filters, phi.Stride) }