ó ùµÈ[c@@s¶dZddlmZddlZddlmZddlmZmZddlm Z m Z ddlm Z d e fd „ƒYZ dad „Zd „Zd e fd„ƒYZdS(sNDArray configuration API.i(tabsolute_importNi(t_LIB(t c_str_arraytc_handle_array(t NDArrayHandletCachedOpHandle(t check_callt NDArrayBasecB@s8eZdZddgZed„Zd„Zd„ZRS(sBase data structure for ndarraythandletwritablecC@s:|dk r$t|tƒs$t‚n||_||_dS(s‹initialize a new NDArray Parameters ---------- handle : NDArrayHandle NDArray handle of C API N(tNonet isinstanceRtAssertionErrorRR (tselfRR ((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyt__init__%s  cC@sttj|jƒƒdS(N(RRt MXNDArrayFreeR(R ((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyt__del__2scC@std|jƒfS(N(N(t _ndarray_clsR t __getstate__(R ((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyt __reduce__5s(t__name__t __module__t__doc__t __slots__tTrueRRR(((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyR s   cC@s |adS(s Set the symbolic class to be clsN(R(tcls((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyt_set_ndarray_class;sc C@sÇ|dk rl|}t|tƒr-|f}ntjt|ƒƒ}t|ƒ}tj|tjt ƒƒ}n'd}tjt ƒƒ}tjdƒ}tjtjƒƒ}t t j tj |ƒtjt|ƒƒt|ƒtj|ƒtj|ƒtjt|ƒƒt|ƒtg|D]} t| ƒ^qƒtj|ƒƒ ƒ|dk rP|S|jdkrƒttj|dt ƒd|dƒSgt|jƒD],} ttj|| t ƒd|| ƒ^q“SdS(s2ctypes implementation of imperative invoke wrapperiitstypeN(R R Rtctypestc_inttlenRtcasttPOINTERRRRtMXImperativeInvokeExtc_void_ptbyrefRtstrtvalueRtrange( Rtndargstkeystvalstouttoriginal_outputt num_outputt output_varst out_stypeststi((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyt_imperative_invokeAs8         "  tCachedOpcB@s5eZdZdgZdd„Zd„Zd„ZRS(sCached operator handle.Rc C@sˆtƒ|_ttj|jt|ƒtg|D]\}}|^q.ƒtg|D]\}}t|ƒ^qPƒtj |jƒƒƒdS(N( RRRRtMXCreateCachedOpExRRR$RR#(R tsymtflagstkeyt_tval((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyRls   "(cC@sttj|jƒƒdS(N(RRtMXFreeCachedOpR(R ((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyRvsc O@s¾|jddƒ}|dk r~|}t|tƒr?|f}ntjt|ƒƒ}t|ƒ}tj|tj t ƒƒ}n'd}tj t ƒƒ}tjdƒ}|rÍt ddj |j ƒƒƒ‚ntj tjƒƒ}ttj|jtjt|ƒƒt|ƒtj|ƒtj|ƒtj|ƒƒƒ|dk rG|S|jdkrzttj|dt ƒd|dƒSgt|jƒD],}ttj||t ƒd||ƒ^qŠSdS(s2ctypes implementation of imperative invoke wrapperR*is6CachedOp.__call__ got unexpected keyword argument(s): s, iRN(tpopR R RRRRRRR Rt TypeErrortjoinR(RRtMXInvokeCachedOpExRR#R%RR&( R targstkwargsR*R+R,R-R.R0((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyt__call__ys<         ((RRRRRRR@(((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyR2is   (Rt __future__Rt_absRtbaseRRRRRRtobjectRR RRR1R2(((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/_ctypes/ndarray.pyts   (