ó ùµÈ[c@sodZddlZddlmZmZddlmZddddd „Zd „Z d „Z dd „Z dS( s5Functions for constructing recurrent neural networks.iÿÿÿÿNi(tsave_checkpointtload_checkpointi(t BaseRNNCellttNTCc Cs5tjdƒ|jd|d|d|d|d|ƒS(s*Deprecated. Please use cell.unroll insteads;rnn_unroll is deprecated. Please call cell.unroll directly.tlengthtinputst begin_statet input_prefixtlayout(twarningstwarntunroll(tcellRRRRR ((sM/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/rnn/rnn.pyt rnn_unrolls cCsUt|tƒr|g}nx|D]}|j|ƒ}q"Wt|||||ƒdS(s½Save checkpoint for model using RNN cells. Unpacks weight before saving. Parameters ---------- cells : RNNCell or list of RNNCells The RNN cells used by this symbol. prefix : str Prefix of model name. epoch : int The epoch number of the model. symbol : Symbol The input symbol arg_params : dict of str to NDArray Model parameter, dict of name to NDArray of net's weights. aux_params : dict of str to NDArray Model parameter, dict of name to NDArray of net's auxiliary states. Notes ----- - ``prefix-symbol.json`` will be saved for symbol. - ``prefix-epoch.params`` will be saved for parameters. N(t isinstanceRtunpack_weightsR(tcellstprefixtepochtsymbolt arg_paramst aux_paramsR ((sM/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/rnn/rnn.pytsave_rnn_checkpoint s   cCs`t||ƒ\}}}t|tƒr3|g}nx|D]}|j|ƒ}q:W|||fS(süLoad model checkpoint from file. Pack weights after loading. Parameters ---------- cells : RNNCell or list of RNNCells The RNN cells used by this symbol. prefix : str Prefix of model name. epoch : int Epoch number of model we would like to load. Returns ------- symbol : Symbol The symbol configuration of computation network. arg_params : dict of str to NDArray Model parameter, dict of name to NDArray of net's weights. aux_params : dict of str to NDArray Model parameter, dict of name to NDArray of net's auxiliary states. Notes ----- - symbol will be loaded from ``prefix-symbol.json``. - parameters will be loaded from ``prefix-epoch.params``. (RRRt pack_weights(RRRtsymtargtauxR ((sM/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/rnn/rnn.pytload_rnn_checkpoint>s   cs7ttdˆƒƒ‰ddd‡‡‡fd†}|S(sñMake a callback to checkpoint Module to prefix every epoch. unpacks weights used by cells before saving. Parameters ---------- cells : RNNCell or list of RNNCells The RNN cells used by this symbol. prefix : str The file prefix to checkpoint to period : int How many epochs to wait before checkpointing. Default is 1. Returns ------- callback : function The callback function that can be passed as iter_end_callback to fit. ics8|dˆdkr4tˆˆ|d|||ƒndS(sThe checkpoint function.iiN(R(titer_noRRR(RtperiodR(sM/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/rnn/rnn.pyt _callbackusN(tinttmaxtNone(RRRR((RRRsM/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/rnn/rnn.pytdo_rnn_checkpointas( t__doc__R tmodelRRtrnn_cellRR"RRRR#(((sM/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/rnn/rnn.pyts   #