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

Torch.Typed.Device

Documentation

class HasToDevice (device' :: (DeviceType, Nat)) (device :: (DeviceType, Nat)) (f :: Type) (g :: Type) | device' device f -> g, device' device g -> f where Source #

Methods

toDevice :: f -> g Source #

Instances

Instances details
HasToDevice device' device Double Double Source # 
Instance details

Defined in Torch.Typed.Device

(g ~ ReplaceDevice f device' device, f ~ ReplaceDevice g device device', Generic f, Generic g, GHasToDevice device' device (Rep f) (Rep g)) => HasToDevice device' device f g Source # 
Instance details

Defined in Torch.Typed.Device

Methods

toDevice :: f -> g 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 #

KnownDevice device' => HasToDevice device' device (Parameter device dtype shape) (Parameter device' dtype shape) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

toDevice :: Parameter device dtype shape -> Parameter device' dtype shape Source #

KnownDevice device' => HasToDevice device' device (Tensor device dtype shape) (Tensor device' dtype shape) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

toDevice :: Tensor device dtype shape -> Tensor device' dtype shape Source #

type family ReplaceDevice (f :: k) (device' :: (DeviceType, Nat)) (device :: (DeviceType, Nat)) :: k where ... Source #

Equations

ReplaceDevice (t device) device' device = t device' 
ReplaceDevice (t a) device' device = ReplaceDevice t device' device (ReplaceDevice a device' device) 
ReplaceDevice t _ _ = t 

type family ReplaceDevice' (f :: k) (device' :: (DeviceType, Nat)) :: k where ... Source #

Equations

ReplaceDevice' (t (device :: (DeviceType, Nat))) device' = t device' 
ReplaceDevice' (t a) device' = ReplaceDevice' t device' (ReplaceDevice' a device') 
ReplaceDevice' t _ = t 

class GHasToDevice (device' :: (DeviceType, Nat)) (device :: (DeviceType, Nat)) (f :: Type -> Type) (g :: Type -> Type) where Source #

Methods

gToDevice :: forall a. f a -> g a Source #

Instances

Instances details
GHasToDevice device' device (U1 :: Type -> Type) (U1 :: Type -> Type) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

gToDevice :: U1 a -> U1 a Source #

(GHasToDevice device' device l l', GHasToDevice device' device r r') => GHasToDevice device' device (l :*: r) (l' :*: r') Source # 
Instance details

Defined in Torch.Typed.Device

Methods

gToDevice :: (l :*: r) a -> (l' :*: r') a Source #

HasToDevice device' device f g => GHasToDevice device' device (K1 i f :: Type -> Type) (K1 i g :: Type -> Type) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

gToDevice :: K1 i f a -> K1 i g a Source #

GHasToDevice device' device f g => GHasToDevice device' device (M1 i t f) (M1 i t g) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

gToDevice :: M1 i t f a -> M1 i t g a Source #

class HasReplicate (devices' :: [(DeviceType, Nat)]) (device :: (DeviceType, Nat)) (f :: Type) (gs :: [Type]) | devices' device f -> gs where Source #

Methods

replicate :: f -> HList gs Source #

Instances

Instances details
HasReplicate ('[] :: [(DeviceType, Nat)]) device f ('[] :: [Type]) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

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

(HasReplicate devices' device f gs, HasToDevice device' device f g) => HasReplicate (device' ': devices') device f (g ': gs) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

replicate :: f -> HList (g ': gs) Source #

class HasToDevices (devices' :: [(DeviceType, Nat)]) (devices :: [(DeviceType, Nat)]) (fs :: [Type]) (gs :: [Type]) | devices' devices fs -> gs, devices' devices gs -> fs where Source #

Methods

toDevices :: HList fs -> HList gs Source #

Instances

Instances details
HasToDevices ('[] :: [(DeviceType, Nat)]) ('[] :: [(DeviceType, Nat)]) ('[] :: [Type]) ('[] :: [Type]) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

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

(HasToDevices devices' devices fs gs, HasToDevice device' device f g) => HasToDevices (device' ': devices') (device ': devices) (f ': fs) (g ': gs) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

toDevices :: HList (f ': fs) -> HList (g ': gs) Source #

type family GetDevice (f :: k) :: Maybe (DeviceType, Nat) where ... Source #

Equations

GetDevice (t (device :: (DeviceType, Nat))) = Just device 
GetDevice (t a) = GetDevice t 
GetDevice t = Nothing 

type family GetDevices (fs :: [k]) :: [(DeviceType, Nat)] where ... Source #

Equations

GetDevices '[] = '[] 
GetDevices (f ': fs) = MaybePrepend (GetDevice f) (GetDevices fs) 

class HasScatter devices' device f gs | devices' device f -> gs where Source #

Methods

scatter :: f -> HList gs Source #

Instances

Instances details
(chunks ~ ListLength devices', tensorChunks ~ (Chunk chunks 0 shape dtype device :: [Type]), Castable (HList tensorChunks) [ATenTensor], devices ~ HReplicateR chunks device, HasToDevices devices' devices tensorChunks gs, KnownNat chunks) => HasScatter (devices' :: [(DeviceType, Nat)]) (device :: (DeviceType, Nat)) (Tensor device dtype shape) (gs :: [Type]) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

scatter :: Tensor device dtype shape -> HList gs Source #

class HasGather device' devices fs g | device' devices fs -> g where Source #

Methods

gather :: HList fs -> g Source #

Instances

Instances details
(chunks ~ ListLength fs, devices ~ GetDevices fs, devices' ~ HReplicateR chunks device', HasToDevices devices' devices fs tensorChunks, '(shape, dtype, device') ~ Cat 0 tensorChunks, Castable (HList tensorChunks) [ATenTensor]) => HasGather (device' :: (DeviceType, Nat)) (devices :: [(DeviceType, Nat)]) (fs :: [Type]) (Tensor device' dtype shape) Source # 
Instance details

Defined in Torch.Typed.Device

Methods

gather :: HList fs -> Tensor device' dtype shape Source #