| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
MXNet.NN
- data Parameter a = Parameter {
- _param_in :: NDArray a
- _param_grad :: NDArray a
- data Config a = Config {}
- data Session a = Session {
- _sess_param :: !(HashMap String (Parameter a))
- _sess_context :: !Context
- data Exc = MismatchedShape String
- type Initializer a = Context -> [Int] -> IO (NDArray a)
- type TrainM a m = StateT (Session a) m
- train :: (DType a, Monad m) => Session a -> TrainM a m r -> m r
- inferShape :: DType a => Symbol a -> HashMap String (NDArray a) -> IO (HashMap String [Int])
- initialize :: DType a => Symbol a -> Config a -> IO (Session a)
- fit :: (DType a, MonadIO m, MonadThrow m, Optimizer opt, OptArgsCst opt g) => opt a g -> Symbol a -> HashMap String (NDArray a) -> TrainM a m ()
- fitAndEval :: (DType a, MonadIO m, MonadThrow m, Optimizer opt, OptArgsCst opt g, EvalMetricMethod mth) => opt a g -> Symbol a -> HashMap String (NDArray a) -> Metric a mth -> TrainM a m ()
- forwardOnly :: (DType a, MonadIO m, MonadThrow m) => Symbol a -> HashMap String (Maybe (NDArray a)) -> TrainM a m [NDArray a]
- getContext :: Monad m => TrainM a m Context
- sess_param :: forall a a. Lens (Session a) (Session a) (HashMap String (Parameter a)) (HashMap String (Parameter a))
- sess_context :: forall a. Lens' (Session a) Context
- module MXNet.NN.Optimizer
Documentation
Constructors
| Parameter | |
Fields
| |
For every symbol in the neural network, it can be placeholder or a variable. therefore, a Config is to specify the shape of the placeholder and the method to initialize the variables.
Note that it is not right to specify a symbol as both placeholder and initializer, although it is tolerated and such a symbol is considered as a variable.
Note that any symbol not specified will be initialized with the _cfg_default_initializer.
Constructors
| Config | |
Fields | |
Session is all the Parameters and a Context
type Session a = (M.HashMap String (Parameter a), Context)
Constructors
| Session | |
Fields
| |
Possible exception in TrainM
Constructors
| MismatchedShape String |
type Initializer a = Context -> [Int] -> IO (NDArray a) Source #
Initializer is about how to create a NDArray from a given shape.
Usually, it can be a wrapper of MXNet operators, such as random_uniform, random_normal,
random_gamma, etc..
inferShape :: DType a => Symbol a -> HashMap String (NDArray a) -> IO (HashMap String [Int]) Source #
infer the shapes of all the symbols in a symbolic neural network
fit :: (DType a, MonadIO m, MonadThrow m, Optimizer opt, OptArgsCst opt g) => opt a g -> Symbol a -> HashMap String (NDArray a) -> TrainM a m () Source #
single step train. Must provide all the placeholders.
fitAndEval :: (DType a, MonadIO m, MonadThrow m, Optimizer opt, OptArgsCst opt g, EvalMetricMethod mth) => opt a g -> Symbol a -> HashMap String (NDArray a) -> Metric a mth -> TrainM a m () Source #
single step train. Must provide all the placeholders. After fitting, it also update the evaluation metric.
forwardOnly :: (DType a, MonadIO m, MonadThrow m) => Symbol a -> HashMap String (Maybe (NDArray a)) -> TrainM a m [NDArray a] Source #
forward only. Must provide all the placeholders, setting the data to Just xx, and set label to Nothing.
Note that the batch size here can be different from that in the training phase.
sess_param :: forall a a. Lens (Session a) (Session a) (HashMap String (Parameter a)) (HashMap String (Parameter a)) Source #
module MXNet.NN.Optimizer