backprop-0.2.0.0: Heterogeneous automatic differentation (backpropagation)

Copyright(c) Justin Le 2018
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Prelude.Backprop.Num

Contents

Description

Provides the exact same API as Prelude.Backprop, except requiring Num instances for all types involved instead of Backprop instances.

Since: 0.2.0.0

Synopsis

Foldable and Traversable

sum :: forall t a s. (Foldable t, Functor t, Num (t a), Num a, Reifies s W) => BVar s (t a) -> BVar s a Source #

Lifted sum

product :: forall t a s. (Foldable t, Functor t, Num (t a), Fractional a, Reifies s W) => BVar s (t a) -> BVar s a Source #

Lifted product

length :: forall t a b s. (Foldable t, Num (t a), Num b, Reifies s W) => BVar s (t a) -> BVar s b Source #

Lifted length.

minimum :: forall t a s. (Foldable t, Functor t, Num a, Ord a, Num (t a), Reifies s W) => BVar s (t a) -> BVar s a Source #

Lifted minimum. Undefined for situations where minimum would be undefined.

maximum :: forall t a s. (Foldable t, Functor t, Num a, Ord a, Num (t a), Reifies s W) => BVar s (t a) -> BVar s a Source #

Lifted maximum. Undefined for situations where maximum would be undefined.

traverse :: forall t f a b s. (Traversable t, Applicative f, Foldable f, Num a, Num b, Num (f (t b)), Num (t b), Reifies s W) => (BVar s a -> f (BVar s b)) -> BVar s (t a) -> BVar s (f (t b)) Source #

Lifted traverse. Lifts backpropagatable functions to be backpropagatable functions on Traversable Functors.

Functor and Applicative

fmap :: forall f a b s. (Traversable f, Num a, Num b, Num (f b), Reifies s W) => (BVar s a -> BVar s b) -> BVar s (f a) -> BVar s (f b) Source #

Lifted fmap. Lifts backpropagatable functions to be backpropagatable functions on Traversable Functors.

(<$>) :: forall f a b s. (Traversable f, Num a, Num b, Num (f b), Reifies s W) => (BVar s a -> BVar s b) -> BVar s (f a) -> BVar s (f b) Source #

Alias for fmap.

pure :: forall t a s. (Foldable t, Applicative t, Num (t a), Num a, Reifies s W) => BVar s a -> BVar s (t a) Source #

Lifted pure.

liftA2 :: forall f a b c s. (Traversable f, Applicative f, Num a, Num b, Num c, Num (f c), Reifies s W) => (BVar s a -> BVar s b -> BVar s c) -> BVar s (f a) -> BVar s (f b) -> BVar s (f c) Source #

Lifted liftA2. Lifts backpropagatable functions to be backpropagatable functions on Traversable Applicatives.

liftA3 :: forall f a b c d s. (Traversable f, Applicative f, Num a, Num b, Num c, Num d, Num (f d), Reifies s W) => (BVar s a -> BVar s b -> BVar s c -> BVar s d) -> BVar s (f a) -> BVar s (f b) -> BVar s (f c) -> BVar s (f d) Source #

Lifted liftA3. Lifts backpropagatable functions to be backpropagatable functions on Traversable Applicatives.

Misc

coerce :: forall a b s. Coercible a b => BVar s a -> BVar s b Source #

Coerce items inside a BVar.