horde-ad-0.2.0.0: Higher Order Reverse Derivatives Efficiently - Automatic Differentiation
Safe HaskellNone
LanguageGHC2024

HordeAd.Core.AstSimplify

Description

This module holds smart constructors for AST, that is, term-simplifying combinators corresponding to the Ast constructors. The combinators simplify only on the basis of inspecting the roots of their argument term trees. If the arguments get modified, the modified forms are again inspected and potentially simplified again.

The limited simplification via combinators is enough to uncover redexes for the factorization rules to fire and to undo some of the complication introduced by vectorization. The intention is to leave intact as much as possible of the original terms provided by the user while making sure subterms introduced by vectorization are maximally simplified.

Synopsis

Documentation

data SimplifyKnobs Source #

Constructors

SimplifyKnobs 

Instances

Instances details
Show SimplifyKnobs Source # 
Instance details

Defined in HordeAd.Core.AstSimplify

The simplifying combinators, one for almost each AST constructor

astPair :: forall (s :: AstSpanType) (x :: TK) (y :: TK). AstSpan s => AstTensor 'AstMethodLet s x -> AstTensor 'AstMethodLet s y -> AstTensor 'AstMethodLet s ('TKProduct x y) Source #

astProject1 :: forall (x :: TK) (z :: TK) (s :: AstSpanType). AstSpan s => AstTensor 'AstMethodLet s ('TKProduct x z) -> AstTensor 'AstMethodLet s x Source #

astProject2 :: forall (x :: TK) (z :: TK) (s :: AstSpanType). AstSpan s => AstTensor 'AstMethodLet s ('TKProduct x z) -> AstTensor 'AstMethodLet s z Source #

astFromVector :: forall (y :: TK) (k :: Nat) (s :: AstSpanType). AstSpan s => SNat k -> SingletonTK y -> Vector (AstTensor 'AstMethodLet s y) -> AstTensor 'AstMethodLet s (BuildTensorKind k y) Source #

astSum :: forall (y :: TK) (k :: Nat) (s :: AstSpanType). AstSpan s => SNat k -> SingletonTK y -> AstTensor 'AstMethodLet s (BuildTensorKind k y) -> AstTensor 'AstMethodLet s y Source #

astReplicate :: forall (y :: TK) (k :: Nat) (s :: AstSpanType). AstSpan s => SNat k -> SingletonTK y -> AstTensor 'AstMethodLet s y -> AstTensor 'AstMethodLet s (BuildTensorKind k y) Source #

astMapAccumRDer :: forall (accy :: TK) (by :: TK) (ey :: TK) (k :: Nat) (s :: AstSpanType). AstSpan s => SNat k -> FullShapeTK by -> FullShapeTK ey -> AstHFun s s ('TKProduct accy ey) ('TKProduct accy by) -> AstHFun s s ('TKProduct (ADTensorKind ('TKProduct accy ey)) ('TKProduct accy ey)) (ADTensorKind ('TKProduct accy by)) -> AstHFun s s ('TKProduct (ADTensorKind ('TKProduct accy by)) ('TKProduct accy ey)) (ADTensorKind ('TKProduct accy ey)) -> AstTensor 'AstMethodLet s accy -> AstTensor 'AstMethodLet s (BuildTensorKind k ey) -> AstTensor 'AstMethodLet s ('TKProduct accy (BuildTensorKind k by)) Source #

astMapAccumLDer :: forall (accy :: TK) (by :: TK) (ey :: TK) (k :: Nat) (s :: AstSpanType). AstSpan s => SNat k -> FullShapeTK by -> FullShapeTK ey -> AstHFun s s ('TKProduct accy ey) ('TKProduct accy by) -> AstHFun s s ('TKProduct (ADTensorKind ('TKProduct accy ey)) ('TKProduct accy ey)) (ADTensorKind ('TKProduct accy by)) -> AstHFun s s ('TKProduct (ADTensorKind ('TKProduct accy by)) ('TKProduct accy ey)) (ADTensorKind ('TKProduct accy ey)) -> AstTensor 'AstMethodLet s accy -> AstTensor 'AstMethodLet s (BuildTensorKind k ey) -> AstTensor 'AstMethodLet s ('TKProduct accy (BuildTensorKind k by)) Source #

astApply :: forall (x :: TK) (z :: TK) (s1 :: AstSpanType) (s :: AstSpanType). (AstSpan s1, AstSpan s) => AstHFun s1 s x z -> AstTensor 'AstMethodLet s1 x -> AstTensor 'AstMethodLet s z Source #

astConcreteS :: forall r (sh :: [Nat]). GoodScalar r => Concrete (TKS sh r) -> AstTensor 'AstMethodLet 'PrimalSpan (TKS sh r) Source #

astLet :: forall (y :: TK) (z :: TK) (s :: AstSpanType) (s2 :: AstSpanType). (AstSpan s, AstSpan s2) => AstVarName s y -> AstTensor 'AstMethodLet s y -> AstTensor 'AstMethodLet s2 z -> AstTensor 'AstMethodLet s2 z Source #

astFloorS :: forall r1 r2 (sh :: [Nat]). (GoodScalar r1, RealFrac r1, Integral r2, GoodScalar r2) => AstTensor 'AstMethodLet 'PrimalSpan (TKS sh r1) -> AstTensor 'AstMethodLet 'PrimalSpan (TKS sh r2) Source #

astCastS :: forall r1 r2 (s :: AstSpanType) (sh :: [Nat]). (GoodScalar r1, GoodScalar r2, RealFrac r1, RealFrac r2, AstSpan s) => AstTensor 'AstMethodLet s (TKS sh r1) -> AstTensor 'AstMethodLet s (TKS sh r2) Source #

astIndexS :: forall (shm :: [Nat]) (shn :: [Nat]) (s :: AstSpanType) (r :: TK). AstSpan s => ShS shn -> AstTensor 'AstMethodLet s ('TKS2 (shm ++ shn) r) -> AstIxS 'AstMethodLet shm -> AstTensor 'AstMethodLet s ('TKS2 shn r) Source #

astIndexKnobsS :: forall (shm :: [Nat]) (shn :: [Nat]) (s :: AstSpanType) (r :: TK). AstSpan s => SimplifyKnobs -> ShS shn -> AstTensor 'AstMethodLet s ('TKS2 (shm ++ shn) r) -> AstIxS 'AstMethodLet shm -> AstTensor 'AstMethodLet s ('TKS2 shn r) Source #

astScatterS :: forall (shm :: [Nat]) (shn :: [Nat]) (shp :: [Nat]) (r :: TK) (s :: AstSpanType). AstSpan s => ShS shn -> AstTensor 'AstMethodLet s ('TKS2 (shm ++ shn) r) -> (AstVarListS shm, AstIxS 'AstMethodLet shp) -> AstTensor 'AstMethodLet s ('TKS2 (shp ++ shn) r) Source #

astGatherS :: forall (shm :: [Nat]) (shn :: [Nat]) (shp :: [Nat]) (r :: TK) (s :: AstSpanType). AstSpan s => ShS shn -> AstTensor 'AstMethodLet s ('TKS2 (shp ++ shn) r) -> (AstVarListS shm, AstIxS 'AstMethodLet shp) -> AstTensor 'AstMethodLet s ('TKS2 (shm ++ shn) r) Source #

astGatherKnobsS :: forall (shm :: [Nat]) (shn :: [Nat]) (shp :: [Nat]) (r :: TK) (s :: AstSpanType). AstSpan s => SimplifyKnobs -> ShS shn -> AstTensor 'AstMethodLet s ('TKS2 (shp ++ shn) r) -> (AstVarListS shm, AstIxS 'AstMethodLet shp) -> AstTensor 'AstMethodLet s ('TKS2 (shm ++ shn) r) Source #

astAppendS :: forall (s :: AstSpanType) (m :: Nat) (sh :: [Nat]) (r :: TK) (n :: Nat). AstSpan s => AstTensor 'AstMethodLet s ('TKS2 (m ': sh) r) -> AstTensor 'AstMethodLet s ('TKS2 (n ': sh) r) -> AstTensor 'AstMethodLet s ('TKS2 ((m + n) ': sh) r) Source #

astSliceS :: forall (i :: Nat) (n :: Nat) (k :: Nat) (sh :: [Natural]) (s :: AstSpanType) (r :: TK). AstSpan s => SNat i -> SNat n -> SNat k -> AstTensor 'AstMethodLet s ('TKS2 (((i + n) + k) ': sh) r) -> AstTensor 'AstMethodLet s ('TKS2 (n ': sh) r) Source #

astReverseS :: forall (n :: Nat) (sh :: [Nat]) (s :: AstSpanType) (r :: TK). AstSpan s => AstTensor 'AstMethodLet s ('TKS2 (n ': sh) r) -> AstTensor 'AstMethodLet s ('TKS2 (n ': sh) r) Source #

astTransposeS :: forall (perm :: [Natural]) (sh :: [Nat]) (s :: AstSpanType) (r :: TK). (IsPermutation perm, Rank perm <= Rank sh, AstSpan s) => Perm perm -> AstTensor 'AstMethodLet s ('TKS2 sh r) -> AstTensor 'AstMethodLet s ('TKS2 (PermutePrefix perm sh) r) Source #

Beware, this does not do full simplification, which often requires the gather form, so astTransposeAsGather needs to be called in addition if full simplification is required.

astReshapeS :: forall (sh :: [Natural]) (sh2 :: [Natural]) (x :: TK) (s :: AstSpanType). (Product sh ~ Product sh2, AstSpan s) => ShS sh2 -> AstTensor 'AstMethodLet s ('TKS2 sh x) -> AstTensor 'AstMethodLet s ('TKS2 sh2 x) Source #

Beware, this does not do full simplification, which often requires the gather form, so astReshapeAsGather needs to be called in addition if full simplification is required.

astConvert :: forall (s :: AstSpanType) (y :: TK) (z :: TK). AstSpan s => TKConversion y z -> AstTensor 'AstMethodLet s y -> AstTensor 'AstMethodLet s z Source #

astFromS' :: forall (y :: TK) (z :: TK) (s :: AstSpanType). AstSpan s => FullShapeTK z -> AstTensor 'AstMethodLet s y -> AstTensor 'AstMethodLet s z Source #

astKFromS' :: forall r (s :: AstSpanType). (AstSpan s, GoodScalar r) => AstTensor 'AstMethodLet s ('TKS2 ('[] :: [Nat]) ('TKScalar r)) -> AstTensor 'AstMethodLet s ('TKScalar r) Source #

astRFromS' :: forall (sh :: [Nat]) (x :: TK) (s :: AstSpanType). AstSpan s => AstTensor 'AstMethodLet s ('TKS2 sh x) -> AstTensor 'AstMethodLet s ('TKR2 (Rank sh) x) Source #

astXFromS' :: forall (sh :: [Nat]) (shx :: [Maybe Nat]) (x :: TK) (s :: AstSpanType). (AstSpan s, Rank sh ~ Rank shx) => StaticShX shx -> AstTensor 'AstMethodLet s ('TKS2 sh x) -> AstTensor 'AstMethodLet s ('TKX2 shx x) Source #

astSFromK' :: forall r (s :: AstSpanType). (GoodScalar r, AstSpan s) => AstTensor 'AstMethodLet s ('TKScalar r) -> AstTensor 'AstMethodLet s (TKS ('[] :: [Nat]) r) Source #

astSFromR' :: forall (sh :: [Nat]) (s :: AstSpanType) (r :: TK). AstSpan s => ShS sh -> AstTensor 'AstMethodLet s ('TKR2 (Rank sh) r) -> AstTensor 'AstMethodLet s ('TKS2 sh r) Source #

astSFromX' :: forall (sh :: [Nat]) (sh' :: [Maybe Nat]) (s :: AstSpanType) (x :: TK). (AstSpan s, Rank sh ~ Rank sh') => ShS sh -> AstTensor 'AstMethodLet s ('TKX2 sh' x) -> AstTensor 'AstMethodLet s ('TKS2 sh x) Source #

astSum0S :: forall (s :: AstSpanType) (sh :: [Nat]) (x :: TK). AstSpan s => AstTensor 'AstMethodLet s ('TKS2 sh x) -> AstTensor 'AstMethodLet s ('TKS2 ('[] :: [Nat]) x) Source #

astDot0S :: forall r (s :: AstSpanType) (sh :: [Nat]). (GoodScalar r, AstSpan s) => AstTensor 'AstMethodLet s (TKS sh r) -> AstTensor 'AstMethodLet s (TKS sh r) -> AstTensor 'AstMethodLet s (TKS ('[] :: [Nat]) r) Source #

astDot1InS :: forall (sh :: [Nat]) (n :: Nat) r (s :: AstSpanType). GoodScalar r => ShS sh -> SNat n -> AstTensor 'AstMethodLet s (TKS (sh ++ '[n]) r) -> AstTensor 'AstMethodLet s (TKS (sh ++ '[n]) r) -> AstTensor 'AstMethodLet s (TKS sh r) Source #

astMatmul2S :: forall r (m :: Nat) (n :: Nat) (p :: Nat) (s :: AstSpanType). GoodScalar r => SNat m -> SNat n -> SNat p -> AstTensor 'AstMethodLet s (TKS '[m, n] r) -> AstTensor 'AstMethodLet s (TKS '[n, p] r) -> AstTensor 'AstMethodLet s (TKS '[m, p] r) Source #

Helper combinators

astLetFun :: forall (y :: TK) (z :: TK) (s :: AstSpanType) (s2 :: AstSpanType). (AstSpan s, AstSpan s2) => AstTensor 'AstMethodLet s y -> (AstTensor 'AstMethodLet s y -> AstTensor 'AstMethodLet s2 z) -> AstTensor 'AstMethodLet s2 z Source #

Substitution operations

substituteAst :: forall (s :: AstSpanType) (s2 :: AstSpanType) (y :: TK) (z :: TK). (AstSpan s, AstSpan s2) => AstTensor 'AstMethodLet s2 z -> AstVarName s2 z -> AstTensor 'AstMethodLet s y -> AstTensor 'AstMethodLet s y Source #

We assume no variable is shared between a binding and its nested binding and nobody substitutes into variables that are bound. This keeps the substitution code simple, because we never need to compare variables to any variable in the bindings.

substituteAstIxS :: forall (s :: AstSpanType) (y :: TK) (sh :: [Nat]). AstSpan s => AstTensor 'AstMethodLet s y -> AstVarName s y -> AstIxS 'AstMethodLet sh -> AstIxS 'AstMethodLet sh Source #

Orphan instances

AstSpan s => ConvertTensor (AstTensor 'AstMethodLet s) Source # 
Instance details

Methods

tconvert :: forall (a :: TK) (b :: TK). TKConversion a b -> SingletonTK a -> AstTensor 'AstMethodLet s a -> AstTensor 'AstMethodLet s b Source #

kfromR :: GoodScalar r => AstTensor 'AstMethodLet s (TKR 0 r) -> AstTensor 'AstMethodLet s ('TKScalar r) Source #

kfromS :: GoodScalar r => AstTensor 'AstMethodLet s (TKS ('[] :: [Nat]) r) -> AstTensor 'AstMethodLet s ('TKScalar r) Source #

kfromX :: GoodScalar r => AstTensor 'AstMethodLet s (TKX ('[] :: [Maybe Nat]) r) -> AstTensor 'AstMethodLet s ('TKScalar r) Source #

rfromK :: GoodScalar r => AstTensor 'AstMethodLet s ('TKScalar r) -> AstTensor 'AstMethodLet s (TKR 0 r) Source #

rfromS :: forall (sh :: [Nat]) (x :: TK). (KnownShS sh, KnownSTK x) => AstTensor 'AstMethodLet s ('TKS2 sh x) -> AstTensor 'AstMethodLet s ('TKR2 (Rank sh) x) Source #

rfromX :: forall (sh :: [Maybe Nat]) (x :: TK). KnownSTK x => AstTensor 'AstMethodLet s ('TKX2 sh x) -> AstTensor 'AstMethodLet s ('TKR2 (Rank sh) x) Source #

sfromK :: GoodScalar r => AstTensor 'AstMethodLet s ('TKScalar r) -> AstTensor 'AstMethodLet s (TKS ('[] :: [Nat]) r) Source #

sfromR :: forall (sh :: [Nat]) (x :: TK). (KnownShS sh, KnownSTK x) => AstTensor 'AstMethodLet s ('TKR2 (Rank sh) x) -> AstTensor 'AstMethodLet s ('TKS2 sh x) Source #

sfromX :: forall (sh :: [Nat]) (sh' :: [Maybe Nat]) (x :: TK). (KnownShS sh, Rank sh ~ Rank sh', KnownSTK x) => AstTensor 'AstMethodLet s ('TKX2 sh' x) -> AstTensor 'AstMethodLet s ('TKS2 sh x) Source #

xfromK :: GoodScalar r => AstTensor 'AstMethodLet s ('TKScalar r) -> AstTensor 'AstMethodLet s (TKX ('[] :: [Maybe Nat]) r) Source #

xfromR :: forall (sh' :: [Maybe Nat]) (x :: TK). (KnownShX sh', KnownSTK x) => AstTensor 'AstMethodLet s ('TKR2 (Rank sh') x) -> AstTensor 'AstMethodLet s ('TKX2 sh' x) Source #

xfromS :: forall (sh :: [Nat]) (sh' :: [Maybe Nat]) (x :: TK). (KnownShS sh, KnownShX sh', Rank sh ~ Rank sh', KnownSTK x) => AstTensor 'AstMethodLet s ('TKS2 sh x) -> AstTensor 'AstMethodLet s ('TKX2 sh' x) Source #

rzip :: forall (y :: TK) (z :: TK) (n :: Nat). (KnownSTK y, KnownSTK z) => AstTensor 'AstMethodLet s ('TKProduct ('TKR2 n y) ('TKR2 n z)) -> AstTensor 'AstMethodLet s ('TKR2 n ('TKProduct y z)) Source #

runzip :: forall (y :: TK) (z :: TK) (n :: Nat). AstTensor 'AstMethodLet s ('TKR2 n ('TKProduct y z)) -> AstTensor 'AstMethodLet s ('TKProduct ('TKR2 n y) ('TKR2 n z)) Source #

szip :: forall (y :: TK) (z :: TK) (sh :: [Nat]). (KnownSTK y, KnownSTK z) => AstTensor 'AstMethodLet s ('TKProduct ('TKS2 sh y) ('TKS2 sh z)) -> AstTensor 'AstMethodLet s ('TKS2 sh ('TKProduct y z)) Source #

sunzip :: forall (y :: TK) (z :: TK) (sh :: [Nat]). AstTensor 'AstMethodLet s ('TKS2 sh ('TKProduct y z)) -> AstTensor 'AstMethodLet s ('TKProduct ('TKS2 sh y) ('TKS2 sh z)) Source #

xzip :: forall (y :: TK) (z :: TK) (sh :: [Maybe Nat]). (KnownSTK y, KnownSTK z) => AstTensor 'AstMethodLet s ('TKProduct ('TKX2 sh y) ('TKX2 sh z)) -> AstTensor 'AstMethodLet s ('TKX2 sh ('TKProduct y z)) Source #

xunzip :: forall (y :: TK) (z :: TK) (sh :: [Maybe Nat]). AstTensor 'AstMethodLet s ('TKX2 sh ('TKProduct y z)) -> AstTensor 'AstMethodLet s ('TKProduct ('TKX2 sh y) ('TKX2 sh z)) Source #

rnest :: forall (n :: Nat) (m :: Nat) (x :: TK). (KnownNat m, KnownSTK x) => SNat n -> AstTensor 'AstMethodLet s ('TKR2 (n + m) x) -> AstTensor 'AstMethodLet s ('TKR2 n ('TKR2 m x)) Source #

rnestS :: forall (n :: Nat) (sh2 :: [Nat]) (x :: TK). (KnownShS sh2, KnownSTK x) => SNat n -> AstTensor 'AstMethodLet s ('TKX2 (Replicate n ('Nothing :: Maybe Nat) ++ MapJust sh2) x) -> AstTensor 'AstMethodLet s ('TKR2 n ('TKS2 sh2 x)) Source #

rnestX :: forall (n :: Nat) (sh2 :: [Maybe Nat]) (x :: TK). (KnownShX sh2, KnownSTK x) => SNat n -> AstTensor 'AstMethodLet s ('TKX2 (Replicate n ('Nothing :: Maybe Nat) ++ sh2) x) -> AstTensor 'AstMethodLet s ('TKR2 n ('TKX2 sh2 x)) Source #

snestR :: forall (sh1 :: [Nat]) (m :: Nat) (x :: TK). (KnownNat m, KnownSTK x) => ShS sh1 -> AstTensor 'AstMethodLet s ('TKX2 (MapJust sh1 ++ Replicate m ('Nothing :: Maybe Nat)) x) -> AstTensor 'AstMethodLet s ('TKS2 sh1 ('TKR2 m x)) Source #

snest :: forall (sh1 :: [Nat]) (sh2 :: [Nat]) (x :: TK). (KnownShS sh2, KnownSTK x) => ShS sh1 -> AstTensor 'AstMethodLet s ('TKS2 (sh1 ++ sh2) x) -> AstTensor 'AstMethodLet s ('TKS2 sh1 ('TKS2 sh2 x)) Source #

snestX :: forall (sh1 :: [Nat]) (sh2 :: [Maybe Nat]) (x :: TK). (KnownShX sh2, KnownSTK x) => ShS sh1 -> AstTensor 'AstMethodLet s ('TKX2 (MapJust sh1 ++ sh2) x) -> AstTensor 'AstMethodLet s ('TKS2 sh1 ('TKX2 sh2 x)) Source #

xnestR :: forall (sh1 :: [Maybe Nat]) (m :: Nat) (x :: TK). (KnownNat m, KnownSTK x) => StaticShX sh1 -> AstTensor 'AstMethodLet s ('TKX2 (sh1 ++ Replicate m ('Nothing :: Maybe Nat)) x) -> AstTensor 'AstMethodLet s ('TKX2 sh1 ('TKR2 m x)) Source #

xnestS :: forall (sh1 :: [Maybe Nat]) (sh2 :: [Nat]) (x :: TK). (KnownShS sh2, KnownSTK x) => StaticShX sh1 -> AstTensor 'AstMethodLet s ('TKX2 (sh1 ++ MapJust sh2) x) -> AstTensor 'AstMethodLet s ('TKX2 sh1 ('TKS2 sh2 x)) Source #

xnest :: forall (sh1 :: [Maybe Nat]) (sh2 :: [Maybe Nat]) (x :: TK). (KnownShX sh2, KnownSTK x) => StaticShX sh1 -> AstTensor 'AstMethodLet s ('TKX2 (sh1 ++ sh2) x) -> AstTensor 'AstMethodLet s ('TKX2 sh1 ('TKX2 sh2 x)) Source #

runNest :: forall (n :: Nat) (m :: Nat) (x :: TK). (KnownNat n, KnownNat m, KnownSTK x) => AstTensor 'AstMethodLet s ('TKR2 n ('TKR2 m x)) -> AstTensor 'AstMethodLet s ('TKR2 (n + m) x) Source #

runNestS :: forall (n :: Nat) (sh2 :: [Nat]) (x :: TK). (KnownNat n, KnownShS sh2, KnownSTK x) => AstTensor 'AstMethodLet s ('TKR2 n ('TKS2 sh2 x)) -> AstTensor 'AstMethodLet s ('TKX2 (Replicate n ('Nothing :: Maybe Nat) ++ MapJust sh2) x) Source #

runNestX :: forall (n :: Nat) (sh2 :: [Maybe Nat]) (x :: TK). (KnownNat n, KnownShX sh2, KnownSTK x) => AstTensor 'AstMethodLet s ('TKR2 n ('TKX2 sh2 x)) -> AstTensor 'AstMethodLet s ('TKX2 (Replicate n ('Nothing :: Maybe Nat) ++ sh2) x) Source #

sunNestR :: forall (sh1 :: [Nat]) (m :: Nat) (x :: TK). (KnownShS sh1, KnownNat m, KnownSTK x) => AstTensor 'AstMethodLet s ('TKS2 sh1 ('TKR2 m x)) -> AstTensor 'AstMethodLet s ('TKX2 (MapJust sh1 ++ Replicate m ('Nothing :: Maybe Nat)) x) Source #

sunNest :: forall (sh1 :: [Nat]) (sh2 :: [Nat]) (x :: TK). (KnownShS sh1, KnownShS sh2, KnownSTK x) => AstTensor 'AstMethodLet s ('TKS2 sh1 ('TKS2 sh2 x)) -> AstTensor 'AstMethodLet s ('TKS2 (sh1 ++ sh2) x) Source #

sunNestX :: forall (sh1 :: [Nat]) (sh2 :: [Maybe Nat]) (x :: TK). (KnownShS sh1, KnownShX sh2, KnownSTK x) => AstTensor 'AstMethodLet s ('TKS2 sh1 ('TKX2 sh2 x)) -> AstTensor 'AstMethodLet s ('TKX2 (MapJust sh1 ++ sh2) x) Source #

xunNestR :: forall (sh1 :: [Maybe Nat]) (m :: Nat) (x :: TK). (KnownShX sh1, KnownNat m, KnownSTK x) => AstTensor 'AstMethodLet s ('TKX2 sh1 ('TKR2 m x)) -> AstTensor 'AstMethodLet s ('TKX2 (sh1 ++ Replicate m ('Nothing :: Maybe Nat)) x) Source #

xunNestS :: forall (sh1 :: [Maybe Nat]) (sh2 :: [Nat]) (x :: TK). (KnownShX sh1, KnownShS sh2, KnownSTK x) => AstTensor 'AstMethodLet s ('TKX2 sh1 ('TKS2 sh2 x)) -> AstTensor 'AstMethodLet s ('TKX2 (sh1 ++ MapJust sh2) x) Source #

xunNest :: forall (sh1 :: [Maybe Nat]) (sh2 :: [Maybe Nat]) (x :: TK). (KnownShX sh1, KnownShX sh2, KnownSTK x) => AstTensor 'AstMethodLet s ('TKX2 sh1 ('TKX2 sh2 x)) -> AstTensor 'AstMethodLet s ('TKX2 (sh1 ++ sh2) x) Source #

tpairConv :: forall (x :: TK) (z :: TK). AstTensor 'AstMethodLet s x -> AstTensor 'AstMethodLet s z -> AstTensor 'AstMethodLet s ('TKProduct x z) Source #

tunpairConv :: forall (x :: TK) (z :: TK). AstTensor 'AstMethodLet s ('TKProduct x z) -> (AstTensor 'AstMethodLet s x, AstTensor 'AstMethodLet s z) Source #