orthotope-hmatrix-0.1.2.0: Some algorithms from hmatrix
Safe HaskellNone
LanguageHaskell2010

Data.Array.Shaped.Convolve

Synopsis

Documentation

convolve :: forall (n :: Nat) ish ksh osh wsh a ksc ksf i ws isp iwc. (i ~ Rank ish, ws ~ Take n ksh, Window ws ish wsh, KnownNat (Rank ws), ksc ~ Size (Take i ksh), ksf ~ Size (Drop i ksh), isp ~ Size (Take n wsh), iwc ~ Size (Drop n wsh), iwc ~ ksc, osh ~ (Take n wsh ++ Drop i ksh), Size wsh ~ (isp * iwc), Size ksh ~ (ksc * ksf), Size osh ~ (isp * ksf), Shape wsh, Shape ksh, Shape osh, KnownNat ksc, KnownNat isp, KnownNat ksf, Numeric a) => Array ish a -> Array ksh a -> Array osh a Source #

Convolve the n outer dimensions with the given kernel. There is no padding nor striding. The input has shape spatialSh ++ channelSh, the kernel has shape spatialKernelSh ++ channelSh ++ featureSh, and the result has shape spatialOutSh ++ featureSh. The n gives the rank of the spatialSh.

Example: i :: Array [20,30,3] T -- 20x30 image with 3 channels k :: Array [5,5,3,8] T -- 5x5 kernel with 8 output features convolve 2 i k :: Array [16,26,8] T @