hasktorch-0.2.0.0: Functional differentiable programming in Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Torch.HList

Synopsis

Documentation

type family ListLength (xs :: [k]) :: Nat where ... Source #

Equations

ListLength '[] = 0 
ListLength (_h ': t) = 1 + ListLength t 

data family HList (xs :: [k]) Source #

Instances

Instances details
HasToDevice device' device (HList xs) (HList ys) => ReduceGradients device' '[device] ('[HList xs] :: [Type]) (ys :: [k]) Source # 
Instance details

Defined in Torch.Typed.NN.DataParallel

Methods

reduceGradients :: HList '[HList xs] -> HList ys Source #

(HasToDevice device' device (HList xs) (HList ys), ReduceGradients device' devices xxs ys, HZipWith SumF ys ys ys, 1 <= ListLength xxs) => ReduceGradients device' (device ': devices) (HList xs ': xxs :: [Type]) (ys :: [k]) Source # 
Instance details

Defined in Torch.Typed.NN.DataParallel

Methods

reduceGradients :: HList (HList xs ': xxs) -> HList ys Source #

(HasToDevice device' device x x', HasToDevice device' device (HList xs) (HList xs')) => HasToDevice device' device (HList (x ': xs)) (HList (x' ': xs')) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

toDevice :: HList (x ': xs) -> HList (x' ': xs') Source #

HasToDevice device' device (HList ('[] :: [Type])) (HList ('[] :: [Type])) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

toDevice :: HList '[] -> HList '[] Source #

(HasGrad (HList parameters) (HList gradients), Castable (HList gradients) [ATenTensor]) => Apply' GradConcurrentlyF (HList parameters, Loss device dtype) (Concurrently (HList gradients)) Source # 
Instance details

Defined in Torch.Typed.NN.DataParallel

Methods

apply' :: GradConcurrentlyF -> (HList parameters, Loss device dtype) -> Concurrently (HList gradients) Source #

(HConcatFD as bs, HAppendFD a bs cs) => HConcatFD (HList a ': as :: [Type]) (cs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hconcatFD :: HList (HList a ': as) -> HList cs Source #

(HList (x ': y) ~ z, HZip' xs ys zs) => HZip' (x ': xs :: [Type]) (HList y ': ys :: [Type]) (z ': zs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hzip' :: HList (x ': xs) -> HList (HList y ': ys) -> HList (z ': zs) Source #

(IsList (Maybe (HList (a ': as))), a ~ Item (Maybe (HList (a ': as)))) => IsList (Maybe (HList (a ': (a ': as)))) Source # 
Instance details

Defined in Torch.HList

Associated Types

type Item (Maybe (HList (a ': (a ': as)))) Source #

Methods

fromList :: [Item (Maybe (HList (a ': (a ': as))))] -> Maybe (HList (a ': (a ': as))) Source #

fromListN :: Int -> [Item (Maybe (HList (a ': (a ': as))))] -> Maybe (HList (a ': (a ': as))) Source #

toList :: Maybe (HList (a ': (a ': as))) -> [Item (Maybe (HList (a ': (a ': as))))] Source #

IsList (Maybe (HList '[a])) Source # 
Instance details

Defined in Torch.HList

Associated Types

type Item (Maybe (HList '[a])) Source #

Methods

fromList :: [Item (Maybe (HList '[a]))] -> Maybe (HList '[a]) Source #

fromListN :: Int -> [Item (Maybe (HList '[a]))] -> Maybe (HList '[a]) Source #

toList :: Maybe (HList '[a]) -> [Item (Maybe (HList '[a]))] Source #

(Monoid a, Monoid (HList as)) => Monoid (HList (a ': as)) Source # 
Instance details

Defined in Torch.HList

Methods

mempty :: HList (a ': as) Source #

mappend :: HList (a ': as) -> HList (a ': as) -> HList (a ': as) Source #

mconcat :: [HList (a ': as)] -> HList (a ': as) Source #

Monoid (HList ('[] :: [k])) Source # 
Instance details

Defined in Torch.HList

Methods

mempty :: HList '[] Source #

mappend :: HList '[] -> HList '[] -> HList '[] Source #

mconcat :: [HList '[]] -> HList '[] Source #

(Semigroup a, Semigroup (HList as)) => Semigroup (HList (a ': as)) Source # 
Instance details

Defined in Torch.HList

Methods

(<>) :: HList (a ': as) -> HList (a ': as) -> HList (a ': as) Source #

sconcat :: NonEmpty (HList (a ': as)) -> HList (a ': as) Source #

stimes :: Integral b => b -> HList (a ': as) -> HList (a ': as) Source #

Semigroup (HList ('[] :: [k])) Source # 
Instance details

Defined in Torch.HList

Methods

(<>) :: HList '[] -> HList '[] -> HList '[] Source #

sconcat :: NonEmpty (HList '[]) -> HList '[] Source #

stimes :: Integral b => b -> HList '[] -> HList '[] Source #

(Show e, Show (HList l)) => Show (HList (e ': l)) Source # 
Instance details

Defined in Torch.HList

Methods

showsPrec :: Int -> HList (e ': l) -> ShowS Source #

show :: HList (e ': l) -> String Source #

showList :: [HList (e ': l)] -> ShowS Source #

Show (HList ('[] :: [k])) Source # 
Instance details

Defined in Torch.HList

Methods

showsPrec :: Int -> HList '[] -> ShowS Source #

show :: HList '[] -> String Source #

showList :: [HList '[]] -> ShowS Source #

(Eq x, Eq (HList xs)) => Eq (HList (x ': xs)) Source # 
Instance details

Defined in Torch.HList

Methods

(==) :: HList (x ': xs) -> HList (x ': xs) -> Bool Source #

(/=) :: HList (x ': xs) -> HList (x ': xs) -> Bool Source #

Eq (HList ('[] :: [k])) Source # 
Instance details

Defined in Torch.HList

Methods

(==) :: HList '[] -> HList '[] -> Bool Source #

(/=) :: HList '[] -> HList '[] -> Bool Source #

(Parameterized f, Parameterized (HList fs), HAppendFD (Parameters f) (Parameters (HList fs)) (Parameters f ++ Parameters (HList fs))) => Parameterized (HList (f ': fs)) Source # 
Instance details

Defined in Torch.Typed.Parameter

Associated Types

type Parameters (HList (f ': fs)) :: [Type] Source #

Methods

flattenParameters :: HList (f ': fs) -> HList (Parameters (HList (f ': fs))) Source #

replaceParameters :: HList (f ': fs) -> HList (Parameters (HList (f ': fs))) -> HList (f ': fs) Source #

Parameterized (HList ('[] :: [k])) Source # 
Instance details

Defined in Torch.Typed.Parameter

Associated Types

type Parameters (HList '[]) :: [Type] Source #

(HFoldrM IO TensorListFold [ATenTensor] l [ATenTensor], Apply TensorListUnfold [ATenTensor] res, HUnfoldM IO TensorListUnfold res l, res ~ HUnfoldMRes IO [ATenTensor] l) => Castable (HList l) [ATenTensor] Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

cast :: HList l -> ([ATenTensor] -> IO r) -> IO r Source #

uncast :: [ATenTensor] -> (HList l -> IO r) -> IO r Source #

Castable (HList l) [ATenTensor] => Castable (HList l) (ForeignPtr TensorList) Source # 
Instance details

Defined in Torch.Typed.Tensor

Methods

cast :: HList l -> (ForeignPtr TensorList -> IO r) -> IO r Source #

uncast :: ForeignPtr TensorList -> (HList l -> IO r) -> IO r Source #

(Randomizable xSpec x, Randomizable (HList xsSpec) (HList xs)) => Randomizable (HList (xSpec ': xsSpec)) (HList (x ': xs)) Source # 
Instance details

Defined in Torch.Typed.Parameter

Methods

sample :: HList (xSpec ': xsSpec) -> IO (HList (x ': xs)) Source #

Randomizable (HList ('[] :: [Type])) (HList ('[] :: [Type])) Source # 
Instance details

Defined in Torch.Typed.Parameter

Methods

sample :: HList '[] -> IO (HList '[]) Source #

(HasGrad a b, HasGrad (HList as) (HList bs), Castable (HList (b ': bs)) [ATenTensor]) => HasGrad (HList (a ': as)) (HList (b ': bs)) Source # 
Instance details

Defined in Torch.Typed.Autograd

Methods

grad :: forall (dtype :: DType) (device :: (DeviceType, Nat)). Tensor device dtype '[] -> HList (a ': as) -> HList (b ': bs) Source #

toDependent :: HList (a ': as) -> HList (b ': bs)

HasGrad (HList ('[] :: [Type])) (HList ('[] :: [Type])) Source # 
Instance details

Defined in Torch.Typed.Autograd

Methods

grad :: forall (dtype :: DType) (device :: (DeviceType, Nat)). Tensor device dtype '[] -> HList '[] -> HList '[] Source #

toDependent :: HList '[] -> HList '[]

data HList ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

data HList ('[] :: [k]) = HNil
newtype HList (x ': xs :: [Type]) Source # 
Instance details

Defined in Torch.HList

newtype HList (x ': xs :: [Type]) = HCons (x, HList xs)
type Item (Maybe (HList (a ': (a ': as)))) Source # 
Instance details

Defined in Torch.HList

type Item (Maybe (HList (a ': (a ': as)))) = a
type Item (Maybe (HList '[a])) Source # 
Instance details

Defined in Torch.HList

type Item (Maybe (HList '[a])) = a
type UnHList (HList a) Source # 
Instance details

Defined in Torch.HList

type UnHList (HList a) = a
type Parameters (HList (f ': fs)) Source # 
Instance details

Defined in Torch.Typed.Parameter

type Parameters (HList (f ': fs)) = Parameters f ++ Parameters (HList fs)
type Parameters (HList ('[] :: [k])) Source # 
Instance details

Defined in Torch.Typed.Parameter

type Parameters (HList ('[] :: [k])) = '[] :: [Type]

pattern (:.) :: forall x (xs :: [Type]). x -> HList xs -> HList (x ': xs) infixr 2 Source #

class Apply f a b where Source #

Methods

apply :: f -> a -> b Source #

Instances

Instances details
Castable x ATenTensor => Apply TensorListUnfold [ATenTensor] (IO (HJust (x, [ATenTensor]))) Source # 
Instance details

Defined in Torch.Typed.Tensor

Apply TensorListUnfold [ATenTensor] (IO HNothing) Source # 
Instance details

Defined in Torch.Typed.Tensor

class Apply' f a b | f a -> b where Source #

Stronger version of Apply that allows for better inference of the return type

Methods

apply' :: f -> a -> b Source #

Instances

Instances details
(HZip' a b c, x ~ (HList a, HList b), y ~ HList c) => Apply' HZipF x y Source # 
Instance details

Defined in Torch.HList

Methods

apply' :: HZipF -> x -> y Source #

(momentum ~ Tensor device dtype shape, KnownDevice device, KnownDType dtype, shape ~ Reverse (Reverse shape), BasicArithmeticDTypeIsValid device dtype) => Apply' AdamBiasAdjustment momentum momentum Source #

bias adjustment

Instance details

Defined in Torch.Typed.Optim

Methods

apply' :: AdamBiasAdjustment -> momentum -> momentum Source #

(parameter ~ Parameter device dtype shape, momentum ~ Tensor device dtype shape, TensorOptions shape dtype device) => Apply' ZerosLike parameter momentum Source # 
Instance details

Defined in Torch.Typed.Optim

Methods

apply' :: ZerosLike -> parameter -> momentum Source #

Apply' AFst (a, b) a Source # 
Instance details

Defined in Torch.HList

Methods

apply' :: AFst -> (a, b) -> a Source #

Apply' ASnd (a, b) b Source # 
Instance details

Defined in Torch.HList

Methods

apply' :: ASnd -> (a, b) -> b Source #

Num y => Apply' SumF (y, y) y Source # 
Instance details

Defined in Torch.Typed.NN.DataParallel

Methods

apply' :: SumF -> (y, y) -> y Source #

(gradient ~ Tensor device dtype shape, momentum1 ~ Tensor device dtype shape, KnownDevice device) => Apply' AdamMomentum1Update (momentum1, gradient) momentum1 Source #

decaying average of the first momenta

Instance details

Defined in Torch.Typed.Optim

Methods

apply' :: AdamMomentum1Update -> (momentum1, gradient) -> momentum1 Source #

(gradient ~ Tensor device dtype shape, momentum2 ~ Tensor device dtype shape, shape ~ Broadcast shape shape, KnownDevice device, BasicArithmeticDTypeIsValid device dtype) => Apply' AdamMomentum2Update (momentum2, gradient) momentum2 Source #

decaying average of the second momenta

Instance details

Defined in Torch.Typed.Optim

Methods

apply' :: AdamMomentum2Update -> (momentum2, gradient) -> momentum2 Source #

HasForward model input output => Apply' ForwardConcurrentlyF (model, input) (Concurrently output) Source # 
Instance details

Defined in Torch.Typed.NN.DataParallel

Methods

apply' :: ForwardConcurrentlyF -> (model, input) -> Concurrently output Source #

(HasGrad (HList parameters) (HList gradients), Castable (HList gradients) [ATenTensor]) => Apply' GradConcurrentlyF (HList parameters, Loss device dtype) (Concurrently (HList gradients)) Source # 
Instance details

Defined in Torch.Typed.NN.DataParallel

Methods

apply' :: GradConcurrentlyF -> (HList parameters, Loss device dtype) -> Concurrently (HList gradients) Source #

Castable x ATenTensor => Apply' TensorListFold (x, IO [ATenTensor]) (IO [ATenTensor]) Source # 
Instance details

Defined in Torch.Typed.Tensor

Apply' MakeIndependent (Tensor device dtype shape) (IO (Parameter device dtype shape)) Source # 
Instance details

Defined in Torch.Typed.Parameter

Methods

apply' :: MakeIndependent -> Tensor device dtype shape -> IO (Parameter device dtype shape) Source #

Apply' ToParameter (Tensor dev dtype shape) (Parameter dev dtype shape) Source # 
Instance details

Defined in Torch.Typed.Optim.CppOptim

Methods

apply' :: ToParameter -> Tensor dev dtype shape -> Parameter dev dtype shape Source #

Apply' ToDependent (Parameter device dtype shape) (Tensor device dtype shape) Source # 
Instance details

Defined in Torch.Typed.Parameter

Methods

apply' :: ToDependent -> Parameter device dtype shape -> Tensor device dtype shape Source #

(parameter ~ Tensor device dtype shape, gradient ~ Tensor device dtype shape, shape ~ Broadcast ('[] :: [Nat]) shape, BasicArithmeticDTypeIsValid device dtype, KnownDevice device) => Apply' (GDStep device dtype) (parameter, gradient) parameter Source # 
Instance details

Defined in Torch.Typed.Optim

Methods

apply' :: GDStep device dtype -> (parameter, gradient) -> parameter Source #

(parameter ~ Tensor device dtype shape, momentum ~ Tensor device dtype shape, shape ~ Broadcast ('[] :: [Nat]) shape, KnownDevice device, BasicArithmeticDTypeIsValid device dtype, StandardFloatingPointDTypeValidation device dtype) => Apply' (AdamParameterUpdate device dtype) (parameter, momentum, momentum) parameter Source #

parameter update

Instance details

Defined in Torch.Typed.Optim

Methods

apply' :: AdamParameterUpdate device dtype -> (parameter, momentum, momentum) -> parameter Source #

(parameter ~ Tensor device dtype shape, gradient ~ Tensor device dtype shape, momentum ~ Tensor device dtype shape, shape ~ Broadcast ('[] :: [Nat]) shape, KnownDevice device, BasicArithmeticDTypeIsValid device dtype) => Apply' (GDMStep device dtype) (parameter, gradient, momentum) (parameter, momentum) Source # 
Instance details

Defined in Torch.Typed.Optim

Methods

apply' :: GDMStep device dtype -> (parameter, gradient, momentum) -> (parameter, momentum) Source #

(1 <= numHeads, embedDim ~ (headDim * numHeads), All KnownNat '[embedDim, numHeads, seqLen, batchSize, headDim], IsSuffixOf '[embedDim] '[batchSize, seqLen, embedDim], KnownDType dtype, StandardFloatingPointDTypeValidation device dtype, MatMulDTypeIsValid device dtype, BasicArithmeticDTypeIsValid device dtype, dtype ~ SumDType dtype, SumDTypeIsValid device dtype, KnownDevice device) => Apply' (FoldLayers batchSize seqLen dtype device) (TransformerLayer embedDim embedDim embedDim numHeads ffnDim dtype device, IO (Tensor device dtype '[batchSize, seqLen, embedDim])) (IO (Tensor device dtype '[batchSize, seqLen, embedDim])) Source # 
Instance details

Defined in Torch.Typed.NN.Transformer

Methods

apply' :: FoldLayers batchSize seqLen dtype device -> (TransformerLayer embedDim embedDim embedDim numHeads ffnDim dtype device, IO (Tensor device dtype '[batchSize, seqLen, embedDim])) -> IO (Tensor device dtype '[batchSize, seqLen, embedDim]) Source #

data AFst Source #

Constructors

AFst 

Instances

Instances details
Apply' AFst (a, b) a Source # 
Instance details

Defined in Torch.HList

Methods

apply' :: AFst -> (a, b) -> a Source #

data ASnd Source #

Constructors

ASnd 

Instances

Instances details
Apply' ASnd (a, b) b Source # 
Instance details

Defined in Torch.HList

Methods

apply' :: ASnd -> (a, b) -> b Source #

class HMap f (xs :: [k]) (ys :: [k]) where Source #

Methods

hmap :: f -> HList xs -> HList ys Source #

Instances

Instances details
HMap f ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hmap :: f -> HList '[] -> HList '[] Source #

(Apply f x y, HMap f xs ys) => HMap f (x ': xs :: [Type]) (y ': ys :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hmap :: f -> HList (x ': xs) -> HList (y ': ys) Source #

class HMap' f (xs :: [k]) (ys :: [k]) | f xs -> ys where Source #

Alternative version of HMap with better type inference based on Apply`

Methods

hmap' :: f -> HList xs -> HList ys Source #

Instances

Instances details
HMap' f ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hmap' :: f -> HList '[] -> HList '[] Source #

(Apply' f x y, HMap' f xs ys) => HMap' f (x ': xs :: [Type]) (y ': ys :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hmap' :: f -> HList (x ': xs) -> HList (y ': ys) Source #

class HMapM m f (xs :: [k]) (ys :: [k]) where Source #

Methods

hmapM :: f -> HList xs -> m (HList ys) Source #

Instances

Instances details
Monad m => HMapM m f ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hmapM :: f -> HList '[] -> m (HList '[]) Source #

(Monad m, Apply f x (m y), HMapM m f xs ys) => HMapM m f (x ': xs :: [Type]) (y ': ys :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hmapM :: f -> HList (x ': xs) -> m (HList (y ': ys)) Source #

class HMapM' m f (xs :: [k]) (ys :: [k]) | f xs -> ys where Source #

Methods

hmapM' :: f -> HList xs -> m (HList ys) Source #

Instances

Instances details
Applicative m => HMapM' m f ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hmapM' :: f -> HList '[] -> m (HList '[]) Source #

(Applicative m, Apply' f x (m y), HMapM' m f xs ys) => HMapM' m f (x ': xs :: [Type]) (y ': ys :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hmapM' :: f -> HList (x ': xs) -> m (HList (y ': ys)) Source #

class Applicative f => HSequence f (xs :: [k]) (ys :: [k]) | xs -> ys, ys f -> xs where Source #

Methods

hsequence :: HList xs -> f (HList ys) Source #

Instances

Instances details
Applicative f => HSequence f ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hsequence :: HList '[] -> f (HList '[]) Source #

(Applicative g, HSequence f xs ys, y ~ x, f ~ g) => HSequence g (f x ': xs :: [Type]) (y ': ys :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hsequence :: HList (f x ': xs) -> g (HList (y ': ys)) Source #

class HFoldr f acc xs res | f acc xs -> res where Source #

Methods

hfoldr :: f -> acc -> HList xs -> res Source #

Instances

Instances details
acc ~ res => HFoldr f acc ('[] :: [k]) res Source # 
Instance details

Defined in Torch.HList

Methods

hfoldr :: f -> acc -> HList '[] -> res Source #

(Apply' f (x, res) res', HFoldr f acc xs res) => HFoldr f acc (x ': xs :: [Type]) res' Source # 
Instance details

Defined in Torch.HList

Methods

hfoldr :: f -> acc -> HList (x ': xs) -> res' Source #

class HFoldrM m f acc xs res | m f acc xs -> res where Source #

Methods

hfoldrM :: f -> acc -> HList xs -> m res Source #

Instances

Instances details
(Monad m, acc ~ res) => HFoldrM (m :: Type -> Type) f acc ('[] :: [k]) (res :: Type) Source # 
Instance details

Defined in Torch.HList

Methods

hfoldrM :: f -> acc -> HList '[] -> m res Source #

(Monad m, Apply' f (x, m res) (m res'), HFoldrM m f acc xs res) => HFoldrM (m :: Type -> Type) f acc (x ': xs :: [Type]) (res' :: Type) Source # 
Instance details

Defined in Torch.HList

Methods

hfoldrM :: f -> acc -> HList (x ': xs) -> m res' Source #

data HNothing Source #

Constructors

HNothing 

Instances

Instances details
HUnfold f HNothing ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldr' :: f -> HNothing -> HList '[] Source #

Monad m => HUnfoldM m f (m HNothing) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldrM' :: f -> m HNothing -> m (HList '[]) Source #

Apply TensorListUnfold [ATenTensor] (IO HNothing) Source # 
Instance details

Defined in Torch.Typed.Tensor

newtype HJust x Source #

Constructors

HJust x 

Instances

Instances details
(Monad m, HUnfoldM m f res xs, Apply f s res, res ~ HUnfoldMRes m s xs) => HUnfoldM m f (m (HJust (x, s))) (x ': xs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldrM' :: f -> m (HJust (x, s)) -> m (HList (x ': xs)) Source #

(Apply f s res, HUnfold f res xs, res ~ HUnfoldRes s xs) => HUnfold f (HJust (x, s)) (x ': xs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldr' :: f -> HJust (x, s) -> HList (x ': xs) Source #

Castable x ATenTensor => Apply TensorListUnfold [ATenTensor] (IO (HJust (x, [ATenTensor]))) Source # 
Instance details

Defined in Torch.Typed.Tensor

class HUnfold f res xs where Source #

Methods

hunfoldr' :: f -> res -> HList xs Source #

Instances

Instances details
HUnfold f HNothing ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldr' :: f -> HNothing -> HList '[] Source #

(Apply f s res, HUnfold f res xs, res ~ HUnfoldRes s xs) => HUnfold f (HJust (x, s)) (x ': xs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldr' :: f -> HJust (x, s) -> HList (x ': xs) Source #

type family HUnfoldRes s xs where ... Source #

Equations

HUnfoldRes _ '[] = HNothing 
HUnfoldRes s (x ': _) = HJust (x, s) 

hunfoldr :: forall f res (xs :: [Type]) a. (Apply f a res, HUnfold f res xs, res ~ HUnfoldRes a xs) => f -> a -> HList xs Source #

class HUnfoldM m f res xs where Source #

Methods

hunfoldrM' :: f -> res -> m (HList xs) Source #

Instances

Instances details
Monad m => HUnfoldM m f (m HNothing) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldrM' :: f -> m HNothing -> m (HList '[]) Source #

(Monad m, HUnfoldM m f res xs, Apply f s res, res ~ HUnfoldMRes m s xs) => HUnfoldM m f (m (HJust (x, s))) (x ': xs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hunfoldrM' :: f -> m (HJust (x, s)) -> m (HList (x ': xs)) Source #

type family HUnfoldMRes m s xs where ... Source #

Equations

HUnfoldMRes m _ '[] = m HNothing 
HUnfoldMRes m s (x ': _) = m (HJust (x, s)) 

hunfoldrM :: forall (m :: Type -> Type) f res (xs :: [Type]) a. (HUnfoldM m f res xs, Apply f a res, res ~ HUnfoldMRes m a xs) => f -> a -> m (HList xs) Source #

hreplicate :: forall n e. HReplicate n e => e -> HList (HReplicateR n e) Source #

class HReplicateFD (n :: Nat) (e :: Type) (es :: [Type]) | n e -> es where Source #

Methods

hreplicateFD :: e -> HList es Source #

Instances

Instances details
(HReplicateFD (n - 1) e es, es' ~ (e ': es), 1 <= n) => HReplicateFD n e es' Source # 
Instance details

Defined in Torch.HList

Methods

hreplicateFD :: e -> HList es' Source #

HReplicateFD 0 e ('[] :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hreplicateFD :: e -> HList '[] Source #

type family HReplicateR (n :: Nat) (e :: a) :: [a] where ... Source #

Equations

HReplicateR 0 _ = '[] 
HReplicateR n e = e ': HReplicateR (n - 1) e 

type HConcat xs = HConcatFD xs (HConcatR xs) Source #

hconcat :: HConcat xs => HList xs -> HList (HConcatR xs) Source #

type family HConcatR (a :: [Type]) :: [Type] Source #

Instances

Instances details
type HConcatR ('[] :: [Type]) Source # 
Instance details

Defined in Torch.HList

type HConcatR ('[] :: [Type]) = '[] :: [Type]
type HConcatR (x ': xs) Source # 
Instance details

Defined in Torch.HList

type HConcatR (x ': xs) = UnHList x ++ HConcatR xs

type family UnHList a :: [Type] Source #

Instances

Instances details
type UnHList (HList a) Source # 
Instance details

Defined in Torch.HList

type UnHList (HList a) = a

class HConcatFD (xxs :: [k]) (xs :: [k]) | xxs -> xs where Source #

Methods

hconcatFD :: HList xxs -> HList xs Source #

Instances

Instances details
HConcatFD ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hconcatFD :: HList '[] -> HList '[] Source #

(HConcatFD as bs, HAppendFD a bs cs) => HConcatFD (HList a ': as :: [Type]) (cs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hconcatFD :: HList (HList a ': as) -> HList cs Source #

type HAppend as bs = HAppendFD as bs (as ++ bs) Source #

happend :: HAppend as bs => HList as -> HList bs -> HList (as ++ bs) Source #

hunappend :: (cs ~ (as ++ bs), HAppend as bs) => HList cs -> (HList as, HList bs) Source #

class HAppendFD (a :: [k]) (b :: [k]) (ab :: [k]) | a b -> ab, a ab -> b where Source #

Methods

happendFD :: HList a -> HList b -> HList ab Source #

hunappendFD :: HList ab -> (HList a, HList b) Source #

Instances

Instances details
HAppendFD ('[] :: [k]) (b :: [k]) (b :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

happendFD :: HList '[] -> HList b -> HList b Source #

hunappendFD :: HList b -> (HList '[], HList b) Source #

HAppendFD as bs cs => HAppendFD (a ': as :: [Type]) (bs :: [Type]) (a ': cs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

happendFD :: HList (a ': as) -> HList bs -> HList (a ': cs) Source #

hunappendFD :: HList (a ': cs) -> (HList (a ': as), HList bs) Source #

type family (as :: [k]) ++ (bs :: [k]) :: [k] where ... Source #

Equations

'[] ++ bs = bs 
(a ': as) ++ bs = a ': (as ++ bs) 

class HZip (xs :: [k]) (ys :: [k]) (zs :: [k]) | xs ys -> zs, zs -> xs ys where Source #

Methods

hzip :: HList xs -> HList ys -> HList zs Source #

hunzip :: HList zs -> (HList xs, HList ys) Source #

Instances

Instances details
HZip ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hzip :: HList '[] -> HList '[] -> HList '[] Source #

hunzip :: HList '[] -> (HList '[], HList '[]) Source #

((x, y) ~ z, HZip xs ys zs) => HZip (x ': xs :: [Type]) (y ': ys :: [Type]) (z ': zs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hzip :: HList (x ': xs) -> HList (y ': ys) -> HList (z ': zs) Source #

hunzip :: HList (z ': zs) -> (HList (x ': xs), HList (y ': ys)) Source #

class HZip' (xs :: [k]) (ys :: [k]) (zs :: [k]) | xs ys -> zs where Source #

Methods

hzip' :: HList xs -> HList ys -> HList zs Source #

Instances

Instances details
HZip' ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hzip' :: HList '[] -> HList '[] -> HList '[] Source #

(HList (x ': y) ~ z, HZip' xs ys zs) => HZip' (x ': xs :: [Type]) (HList y ': ys :: [Type]) (z ': zs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hzip' :: HList (x ': xs) -> HList (HList y ': ys) -> HList (z ': zs) Source #

data HZipF Source #

Constructors

HZipF 

Instances

Instances details
(HZip' a b c, x ~ (HList a, HList b), y ~ HList c) => Apply' HZipF x y Source # 
Instance details

Defined in Torch.HList

Methods

apply' :: HZipF -> x -> y Source #

htranspose :: forall (acc :: [Type]) (xs :: [Type]) (xxs :: [Type]) (res :: Type). (HReplicateFD (ListLength xs) (HList ('[] :: [Type])) acc, HFoldr HZipF (HList acc) (HList xs ': xxs) res) => HList (HList xs ': xxs) -> res Source #

class HZipWith f (xs :: [k]) (ys :: [k]) (zs :: [k]) | f xs ys -> zs where Source #

Methods

hzipWith :: f -> HList xs -> HList ys -> HList zs Source #

Instances

Instances details
HZipWith f ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hzipWith :: f -> HList '[] -> HList '[] -> HList '[] Source #

(Apply' f (x, y) z, HZipWith f xs ys zs) => HZipWith f (x ': xs :: [Type]) (y ': ys :: [Type]) (z ': zs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hzipWith :: f -> HList (x ': xs) -> HList (y ': ys) -> HList (z ': zs) Source #

class HZipWithM m f (xs :: [k]) (ys :: [k]) (zs :: [k]) | f xs ys -> zs where Source #

Methods

hzipWithM :: f -> HList xs -> HList ys -> m (HList zs) Source #

Instances

Instances details
Applicative m => HZipWithM m f ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hzipWithM :: f -> HList '[] -> HList '[] -> m (HList '[]) Source #

(Applicative m, Apply' f (x, y) (m z), HZipWithM m f xs ys zs) => HZipWithM m f (x ': xs :: [Type]) (y ': ys :: [Type]) (z ': zs :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hzipWithM :: f -> HList (x ': xs) -> HList (y ': ys) -> m (HList (z ': zs)) Source #

class HZip3 (as :: [k]) (bs :: [k]) (cs :: [k]) (ds :: [k]) | as bs cs -> ds, ds -> as bs cs where Source #

Methods

hzip3 :: HList as -> HList bs -> HList cs -> HList ds Source #

hunzip3 :: HList ds -> (HList as, HList bs, HList cs) Source #

Instances

Instances details
HZip3 ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hzip3 :: HList '[] -> HList '[] -> HList '[] -> HList '[] Source #

hunzip3 :: HList '[] -> (HList '[], HList '[], HList '[]) Source #

((a, b, c) ~ d, HZip3 as bs cs ds) => HZip3 (a ': as :: [Type]) (b ': bs :: [Type]) (c ': cs :: [Type]) (d ': ds :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hzip3 :: HList (a ': as) -> HList (b ': bs) -> HList (c ': cs) -> HList (d ': ds) Source #

hunzip3 :: HList (d ': ds) -> (HList (a ': as), HList (b ': bs), HList (c ': cs)) Source #

class HZipWith3 f (as :: [k]) (bs :: [k]) (cs :: [k]) (ds :: [k]) | f as bs cs -> ds where Source #

Methods

hzipWith3 :: f -> HList as -> HList bs -> HList cs -> HList ds Source #

Instances

Instances details
HZipWith3 f ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hzipWith3 :: f -> HList '[] -> HList '[] -> HList '[] -> HList '[] Source #

(Apply' f (a, b, c) d, HZipWith3 f as bs cs ds) => HZipWith3 f (a ': as :: [Type]) (b ': bs :: [Type]) (c ': cs :: [Type]) (d ': ds :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hzipWith3 :: f -> HList (a ': as) -> HList (b ': bs) -> HList (c ': cs) -> HList (d ': ds) Source #

class HCartesianProduct (xs :: [k]) (ys :: [k]) (zs :: [k]) | xs ys -> zs where Source #

Methods

hproduct :: HList xs -> HList ys -> HList zs Source #

Instances

Instances details
HCartesianProduct ('[] :: [k]) (ys :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hproduct :: HList '[] -> HList ys -> HList '[] Source #

(HCartesianProduct xs ys zs, HAttach x ys xys, HAppendFD xys zs zs') => HCartesianProduct (x ': xs :: [Type]) (ys :: [Type]) (zs' :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hproduct :: HList (x ': xs) -> HList ys -> HList zs' Source #

class HAttach x (ys :: [k]) (zs :: [k]) | x ys -> zs where Source #

Methods

hattach :: x -> HList ys -> HList zs Source #

Instances

Instances details
HAttach x ('[] :: [k]) ('[] :: [k]) Source # 
Instance details

Defined in Torch.HList

Methods

hattach :: x -> HList '[] -> HList '[] Source #

HAttach x ys xys => HAttach x (y ': ys :: [Type]) ((x, y) ': xys :: [Type]) Source # 
Instance details

Defined in Torch.HList

Methods

hattach :: x -> HList (y ': ys) -> HList ((x, y) ': xys) Source #