[c$@`sbdZddlmZddlmZyddlmZWn!ek r]ddlmZnXddl m Z ddl Z ddl Z ddl Z ddlmZddlZdd lmZmZmZdd lmZmZmZmZmZdd lmZmZmZmZdd lmZdd l m!Z!m"Z"ddl#m$Z$ddl#m%Z%ddl$m&Z&ddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5g$Z'd6Z(dZ)dZ*dZ+id6e,6dej-6dej.6dej/6d7ej06d8ej16d9ej26d:ej36Z4ie,d66ej-d6ej.d6ej/d6ej0d76ej1d86ej2d96ej3d:6Z5ie(d;6e)d<6e*d=6e+d>6Z6id;e(6d<e)6d=e*6d>e+6Z7idd?6dd@6d7d6Z8d6Z9dZ:dZ;dAZ<edBZ=dCZ>dDZ?dEZ@de&fdFYZAdGZBddHZCdIZDdJZEdKZFdLZGe,e,dMZHe,ee,dNZIe,e,dOZ dPZJe,dQdeKe,edRZLe,dSZMdTZNdUZOdVZPdWZQdXZRdYZSdZZTd[ZUd\ZVd]ZWd^ZXd_ZYd`ZZdaZ[dbZ\dcZ]ddZ^deZ_de`dfZaddddfe,dd7e,dgZbe,e,dhZcdde,e,diZde,e,djZedke,dlZfe jge,e jhZiedmZjednZkdoZleielZmdpZndqZodrZpdS(ssNDArray API of MXNet.i(tabsolute_import(tdivision(tslice(tarrayN(treducei(t_LIBt numeric_typest integer_types(tc_strtc_arrayt c_array_buftc_handle_arrayt mx_real_t(tmx_uintt NDArrayHandlet check_callt DLPackHandle(t ctypes2buffer(tContexttcurrent_contexti(t _internal(top(t NDArrayBasetNDArrayt concatenatet_DTYPE_NP_TO_MXt_DTYPE_MX_TO_NPt _GRAD_REQ_MAPtonestaddtarangeteyetdividetequaltfulltgreatert greater_equaltimdecodetlessert lesser_equalt logical_andt logical_ort logical_xortmaximumtminimumtmoveaxistmodulotmultiplyt not_equalt onehot_encodetpowertsubtractt true_dividetwaitallt_new_empty_handlet histogramtto_dlpack_for_readtto_dlpack_for_writet from_dlpackiiiiit undefinedtdefaultt row_sparsetcsrtnulltwritecC`s)t}ttjtj||S(sReturns a new empty handle. Empty handle can be used to hold a result. Returns ------- handle A new empty `NDArray` handle. (RRRtMXNDArrayCreateNonetctypestbyref(thdl((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR6ks c C`st}ttjtttd|tt|tj |j tj |j tj t |tj t t tj|jtj||S(sReturn a new handle with specified shape and context. Empty handle is only used to hold results. Returns ------- handle A new empty `NDArray` handle. tI(RRRtMXNDArrayCreateExR R t native_arraytlenRBtc_intt device_typeidt device_idtintRtnptdtypettypeRC(tshapetctxt delay_allocRNRD((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt_new_alloc_handlezs  "c C`s~t}ttjtj|tj|tt|tt|tjt t t j |j tj||S(N(RRRtMXNDArrayCreateFromSharedMemRBRIR R RHRLRRMRNRORC(t shared_pidt shared_idRPRNRD((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt_new_from_shared_mems     "cC`sttjdS(shWait for all async operations to finish in MXNet. This function is used for benchmarking only. N(RRtMXNDArrayWaitAll(((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR5scC`s5tjd}ttj|tj||jS(Ni(RBRIRRtMXNDArrayGetStorageTypeRCtvalue(thandlet storage_type((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt _storage_typescB`seZdZgZdZdZedZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&d#Z'e'Z(d$Z)d%Z*d&Z+d'Z,d(Z-d)Z.d*Z/d+Z0d,Z1d-Z2d.Z3d/Z4d0Z5d1Z6d2Z7d3Z8d4Z9d5Z:d6Z;d7Z<d8Z=d9Z>d:Z?d;Z@d<ZAd=ZBd>ZCd?ZDd@ZEdAZFdBZGdCZHdDZIdEZJdFZKdGZLdHZMdIZNdJZOdKZPdLZQdMZRdNZSdOZTdPZUdQZVdRZWdSdTZXdUZYdVZZdWZ[dXZ\dYZ]dZZ^d[Z_d\Z`d]Zad^Zbd_Zcd`ZddaZedbZfdcZgddZhdeZidfZjdgZkdhZldiZmdjZndkZodlZpdmZqdnZrdoZsdpZtdqZudrZvdsZwdtZxduZydvZzdwZ{dxZ|dyZ}dzZ~d{Zd|Zd}Zd~ZdZdZdZdZdZdZdZedZedZedZedZedZedZedZedZejdZdZdZedZdZdZdZdddZedZdZdeedZdZdZdZRS(s]An array object representing a multidimensional, homogeneous array of fixed-size items. g@@icC`s |jjS(N(R[RZ(tself((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt _tvm_handlescC`sRdjg|jD]}d|^q}dt|j|jj||jfS(s-Returns a string representation of the array.txs%ds %s <%s %s @%s>(tjoinRPtstrtasnumpyt __class__t__name__tcontext(R^R`t shape_info((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__repr__s) cC`std|jfS(N(N(RtNonet __getstate__(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt __reduce__scC`sbtj}tj}ttj|jtj|tj||j|j|j|j fS(N( RBRIRRtMXNDArrayGetSharedMemHandleR[RCRZRPRN(R^RURV((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt_to_shared_mems    %cC`s t||S(s)x.__add__(y) <=> x+y <=> mx.nd.add(x, y) (R(R^tother((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__add__scC`s|jstdnt|tr=tj||d|St|trhtj|t |d|St dt t |dS(sx.__iadd__(y) <=> x+=y s#trying to add to a readonly NDArraytoutstype %s not supportedN( twritablet ValueErrort isinstanceRRt broadcast_addRRt _plus_scalartfloatt TypeErrorRbRO(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__iadd__s cC`s |j|S(N(Ro(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__radd__scC`s t||S(s.x.__sub__(y) <=> x-y <=> mx.nd.subtract(x, y) (R3(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__sub__scC`s|jstdnt|tr=tj||d|St|trhtj|t |d|St dt t |dS(sx.__isub__(y) <=> x-=y s*trying to subtract from a readonly NDArrayRpstype %s not supportedN( RqRrRsRRt broadcast_subRRt _minus_scalarRvRwRbRO(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__isub__s cC`s t||S(s/x.__rsub__(y) <=> y-x <=> mx.nd.subtract(y, x) (R3(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__rsub__scC`s t||S(s.x.__mul__(y) <=> x*y <=> mx.nd.multiply(x, y) (R/(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__mul__scC`stj|dS(sx.__neg__(y) <=> -x g(Rt _mul_scalar(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__neg__scC`s|jstdnt|tr=tj||d|St|trhtj|t |d|St dt t |dS(sx.__imul__(y) <=> x*=y s(trying to multiply to a readonly NDArrayRpstype %s not supportedN( RqRrRsRRt broadcast_mulRRRRvRwRbRO(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__imul__s cC`s |j|S(N(R(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__rmul__scC`s t||S(s,x.__div__(y) <=> x/y <=> mx.nd.divide(x, y) (R (R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__div__scC`s t||S(s-x.__rdiv__(y) <=> y/x <=> mx.nd.divide(y, x) (R (R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__rdiv__ scC`s|jstdnt|tr=tj||d|St|trhtj|t |d|St dt t |dS(sx.__rdiv__(y) <=> x/=y s(trying to divide from a readonly NDArrayRpstype %s not supportedN( RqRrRsRRt broadcast_divRRt _div_scalarRvRwRbRO(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__idiv__s cC`s t||S(N(R (R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt __truediv__scC`s t||S(N(R (R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt __rtruediv__scC`s |j|S(N(R(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt __itruediv__scC`s t||S(s,x.__mod__(y) <=> x%y <=> mx.nd.modulo(x, y) (R.(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__mod__"scC`s t||S(s-x.__rmod__(y) <=> y%x <=> mx.nd.modulo(y, x) (R.(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__rmod__&scC`s|jstdnt|tr=tj||d|St|trhtj|t |d|St dt t |dS(sx.__rmod__(y) <=> x%=y s-trying to take modulo from a readonly NDArrayRpstype %s not supportedN( RqRrRsRRt broadcast_modRRt _mod_scalarRvRwRbRO(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__imod__*s cC`s t||S(s+x.__pow__(y) <=> x**y <=> mx.nd.power(x,y) (R2(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__pow__5scC`s t||S(s+x.__pow__(y) <=> y**x <=> mx.nd.power(y,x) (R2(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__rpow__9scC`s t||S(s+x.__eq__(y) <=> x==y <=> mx.nd.equal(x, y) (R!(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__eq__=scC`st|dS(sDefault hash function.i(tid(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__hash__AscC`s t||S(s/x.__ne__(y) <=> x!=y <=> mx.nd.not_equal(x, y) (R0(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__ne__EscC`s t||S(s,x.__gt__(y) <=> x>y <=> mx.nd.greater(x, y) (R#(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__gt__IscC`s t||S(s3x.__ge__(y) <=> x>=y <=> mx.nd.greater_equal(x, y) (R$(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__ge__MscC`s t||S(s+x.__lt__(y) <=> x mx.nd.lesser(x, y) (R&(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__lt__QscC`s t||S(s0x.__le__(y) <=> x<=y <=> mx.nd.less_equal(x, y) (R'(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__le__UscC`sTttj|jd}|dkr(tS|dkrDt|jStddS(NiisBThe truth value of an NDArray with multiple elements is ambiguous.(RtoperatortmulRPtFalsetbooltasscalarRr(R^t num_elements((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__bool__Ys   cC`s |jdS(s'Number of element along the first axis.i(RP(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt__len__escC`s|j}idd6}|dk rtj}tjtj}ttj|jtj |tj |t ||j |d x[i]=y Sets value to self[key]. This functions supports advanced indexing defined in the following reference with some restrictions. https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html#combining-advanced-and-basic-indexing - If key is a list type, only a list of integers is supported, e.g. key=[1, 2] is supported, while not for key=[[1, 2]]. - Ellipsis (...) and np.newaxis are not supported. - Boolean array indexing is not supported. Parameters ---------- key : int, slice, list, np.ndarray, NDArray, or tuple of all previous types The indexing key. value : scalar or array-like object that can be broadcast to the shape of self[key] The value to set. Examples -------- >>> x = mx.nd.zeros((2,3)) >>> x[:] = 1 >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> x[:,1:2] = 2 >>> x.asnumpy() array([[ 1., 2., 1.], [ 1., 2., 1.]], dtype=float32) >>> x[1:2,1:] = 3 >>> x.asnumpy() array([[ 1., 2., 1.], [ 1., 3., 3.]], dtype=float32) >>> x[1:,0:2] = mx.nd.zeros((1,2)) >>> x.asnumpy() array([[ 1., 2., 1.], [ 0., 0., 3.]], dtype=float32) >>> x[1,2] = 4 >>> x.asnumpy() array([[ 1., 2., 1.], [ 0., 0., 4.]], dtype=float32) >>> x[[0], [1, 2]] = 5 >>> x.asnumpy() array([[ 1., 5., 5.], [ 0., 0., 4.]], dtype=float32) >>> x[::-1, 0:2:2] = [6] >>> x.asnumpy() array([[ 6., 5., 5.], [ 6., 0., 4.]], dtype=float32) s;Indexing NDArray with index=%s and type=%s is not supportedN(t_get_indexing_dispatch_codet_NDARRAY_BASIC_INDEXINGt_set_nd_basic_indexingt_NDARRAY_ADVANCED_INDEXINGt_set_nd_advanced_indexingRrRbRO(R^tkeyRZtindexing_dispatch_code((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt __setitem__s7   cC`sjt|}|tkr%|j|S|tkr>|j|Stdt|tt|fdS(ssx.__getitem__(i) <=> x[i] Returns a sliced view of this array if the elements fetched are contiguous in memory; otherwise, returns a newly created NDArray. This functions supports advanced indexing defined in the following reference with some restrictions. https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html#combining-advanced-and-basic-indexing - If key is a list type, only a list of integers is supported, e.g. key=[1, 2] is supported, while not for key=[[1, 2]]. - Ellipsis (...) and np.newaxis are not supported. - Boolean array indexing is not supported. Parameters ---------- key : int, slice, list, np.ndarray, NDArray, or tuple of all previous types Indexing key. Examples -------- >>> x = mx.nd.arange(0,6).reshape((2,3)) >>> x.asnumpy() array([[ 0., 1., 2.], [ 3., 4., 5.]], dtype=float32) >>> x[1].asnumpy() array([ 3., 4., 5.], dtype=float32) >>> y = x[0:1] >>> y[:] = 2 >>> x.asnumpy() array([[ 2., 2., 2.], [ 3., 4., 5.]], dtype=float32) >>> x = mx.nd.arange(0, 8, dtype='int32').reshape((2, 2, 2)) >>> x[[0, 1]] [[[0 1] [2 3]] [[4 5] [6 7]]] >>> x[1:, [0, 1]] [[[4 5] [6 7]]] >>> y = np.array([0, 1], dtype='int32') >>> x[1:, y] [[[4 5] [6 7]]] >>> y = mx.nd.array([0, 1], dtype='int32') >>> x[1:, y] [[[4 5] [6 7]]] s;Indexing NDArray with index=%s and type=%s is not supportedN(RRt_get_nd_basic_indexingRt_get_nd_advanced_indexingRrRbRO(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt __getitem__s3     c C`sd}t|ttjtttfr6|f}nt|tsmtdt |t t |ft |dkstd|j }t |t |kstdt |t |fg}d}t |dk}g}g}d } xt|D]\} } t} t| tjttfrct| d|jd |} |j| n?t| trt| j| j|| | j\} }}t| ||d|jd |} |j| t} nt| tr:t| | d|| d\} }}t| ||d|jd |} |j| nht| trz|| jkrj| j|} n|j| n(td t |t t |f| r| d kr| j } q| | j krt}t| | j } qn|j| q Wt |dkr#td |nt}xGtdt |dD],} || d|| dkrCt}PqCqCWg}|rCxRtd|dD]=} |j|| j | r|| j | krt}qqW|j| xt|d dt |D]=} | r(|| j | kr(t}n|j|| j qWnU|j| xE|D]=} |j|| j | rW|| j | krWt}qWqWWt|}|rg}dgt |}|r|d}|t | }x"t|D]%\} }||rJ|}x|| j d d d D]}|d8}|||>> a = mx.nd.array([1, 2]) >>> a.asnumpy() array([ 1., 2.], dtype=float32) >>> a[:] = np.array([3, 4]) >> a.asnumpy() array([ 3., 4.], dtype=float32) RNs&array must consist of array-like data,stype %s is not supportedtordertCs)Shape inconsistent: expected %s vs got %sN(RsRMRRRNRwRbROtasarrayRPRrRRtMXNDArraySyncCopyFromCPUR[RBtdata_astc_void_pRtsize(R^t source_array((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRIs!% cC`sut}t|||jd\}}}ttj|jt|t|tj |t d|d|j S(sReturns a sliced NDArray that shares memory with the current one. This is called through ``x[start:stop]``. Parameters ---------- start : int Starting inclusive index of slice in the first dim. stop : int Finishing exclusive index of slice in the first dim. Returns ------- `NDArray` sharing the memory with the current one sliced from start to stop in the first dim. Examples: >>> a = mx.nd.array([[1,2], [3, 4], [5, 6], [7, 8]]) >>> a[1:2].asnumpy() array([[ 3., 4.]], dtype=float32) >>> a[1:1].asnumpy() array([], shape=(0, 2), dtype=float32) iR[Rq( RRRPRRtMXNDArraySliceR[R RBRCRRq(R^RRR[R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRns  " +cC`st}|dkrX|jd}||7}|dkrXtd|||fqXnttj|jt|tj |t d|d|j S(svReturns a view of the array sliced at `idx` in the first dim. This is called through ``x[idx]``. Parameters ---------- idx : int index for slicing the `NDArray` in the first dim. Returns ------- NDArray `NDArray` sharing the memory with the current one sliced at `idx` in the first dim. Examples -------- >>> a = mx.nd.array([[1,2], [3, 4]]) >>> a[1].asnumpy() array([ 3., 4.], dtype=float32) >>> b = mx.nd.array([1, 2, 3, 4]) >>> b[0].asnumpy() array([ 1.], dtype=float32) is1index %d is out of bounds for axis 0 with size %dR[Rq( RRPRRRt MXNDArrayAtR[R RBRCRRq(R^RR[R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs      "cO`s&t|dkr8t|dttfr8|d}n*|sb|jd}|sbtdntd|Dstdjdj g|D]}|d kr|^qn|jdt }t }t t j|jt|ttj||tj|td |d |jS( s1Returns a **view** of this array with a new shape without altering any data. Parameters ---------- shape : tuple of int, or n ints The new shape should not change the array size, namely ``np.prod(new_shape)`` should be equal to ``np.prod(self.shape)``. Some dimensions of the shape can take special values from the set {0, -1, -2, -3, -4}. The significance of each is explained below: - ``0`` copy this dimension from the input to the output shape. Example:: - input shape = (2,3,4), shape = (4,0,2), output shape = (4,3,2) - input shape = (2,3,4), shape = (2,0,0), output shape = (2,3,4) - ``-1`` infers the dimension of the output shape by using the remainder of the input dimensions keeping the size of the new array same as that of the input array. At most one dimension of shape can be -1. Example:: - input shape = (2,3,4), shape = (6,1,-1), output shape = (6,1,4) - input shape = (2,3,4), shape = (3,-1,8), output shape = (3,1,8) - input shape = (2,3,4), shape=(-1,), output shape = (24,) - ``-2`` copy all/remainder of the input dimensions to the output shape. Example:: - input shape = (2,3,4), shape = (-2,), output shape = (2,3,4) - input shape = (2,3,4), shape = (2,-2), output shape = (2,3,4) - input shape = (2,3,4), shape = (-2,1,1), output shape = (2,3,4,1,1) - ``-3`` use the product of two consecutive dimensions of the input shape as the output dimension. Example:: - input shape = (2,3,4), shape = (-3,4), output shape = (6,4) - input shape = (2,3,4,5), shape = (-3,-3), output shape = (6,20) - input shape = (2,3,4), shape = (0,-3), output shape = (2,12) - input shape = (2,3,4), shape = (-3,-2), output shape = (6,4) - ``-4`` split one dimension of the input into two dimensions passed subsequent to -4 in shape (can contain -1). Example:: - input shape = (2,3,4), shape = (-4,1,2,-2), output shape =(1,2,3,4) - input shape = (2,3,4), shape = (2,-4,-1,3,-2), output shape = (2,1,3,4) - If the argument `reverse` is set to 1, then the special values are inferred from right to left. Example:: - without reverse=1, for input shape = (10,5,4), shape = (-1,0), output shape would be (40,5). - with reverse=1, output shape will be (50,4). reverse : bool, default False If true then the special values are inferred from right to left. Only supported as keyword argument. Returns ------- NDArray An array with desired shape that shares data with this array. Examples -------- >>> x = mx.nd.arange(0,6).reshape(2,3) >>> x.asnumpy() array([[ 0., 1., 2.], [ 3., 4., 5.]], dtype=float32) >>> y = x.reshape(3,2) >>> y.asnumpy() array([[ 0., 1.], [ 2., 3.], [ 4., 5.]], dtype=float32) >>> y = x.reshape(3,-1) >>> y.asnumpy() array([[ 0., 1.], [ 2., 3.], [ 4., 5.]], dtype=float32) >>> y = x.reshape(3,2) >>> y.asnumpy() array([[ 0., 1.], [ 2., 3.], [ 4., 5.]], dtype=float32) >>> y = x.reshape(-3) >>> y.asnumpy() array([ 0. 1. 2. 3. 4. 5.], dtype=float32) >>> y[:] = -1 >>> x.asnumpy() array([[-1., -1., -1.], [-1., -1., -1.]], dtype=float32) iiRPsShape must be provided.cs`s|]}|dkVqdS(RPtreverseN(sshapesreverse((t.0R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pys ssZGot unknown keywords in reshape: {}. Accepted keyword arguments are 'shape' and 'reverse'.s, RR[Rq(sshapesreverse(RHRsRRtgetRtallRwRRaRRRRtMXNDArrayReshape64R[R RBtc_int64RCRRq(R^RPtkwargsRRR[((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs"f+ 7  cO`stj|||S(sConvenience fluent method for :py:func:`reshape_like`. The arguments are the same as for :py:func:`reshape_like`, with this array as data. (Rt reshape_like(R^targsR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR)scO`stj|||S(sConvenience fluent method for :py:func:`zeros_like`. The arguments are the same as for :py:func:`zeros_like`, with this array as data. (Rt zeros_like(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR1scO`stj|||S(sConvenience fluent method for :py:func:`ones_like`. The arguments are the same as for :py:func:`ones_like`, with this array as data. (Rt ones_like(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR9scO`stj|||S(sConvenience fluent method for :py:func:`broadcast_axes`. The arguments are the same as for :py:func:`broadcast_axes`, with this array as data. (Rtbroadcast_axes(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRAscO`stj|||S(sConvenience fluent method for :py:func:`repeat`. The arguments are the same as for :py:func:`repeat`, with this array as data. (Rtrepeat(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRIscO`stj|||S(sConvenience fluent method for :py:func:`pad`. The arguments are the same as for :py:func:`pad`, with this array as data. (Rtpad(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR QscO`stj|||S(sConvenience fluent method for :py:func:`swapaxes`. The arguments are the same as for :py:func:`swapaxes`, with this array as data. (Rtswapaxes(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR!YscO`stj|||S(sConvenience fluent method for :py:func:`split`. The arguments are the same as for :py:func:`split`, with this array as data. (Rtsplit(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR"ascO`stj|||S(sConvenience fluent method for :py:func:`slice`. The arguments are the same as for :py:func:`slice`, with this array as data. (RR(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRiscO`stj|||S(sConvenience fluent method for :py:func:`slice_axis`. The arguments are the same as for :py:func:`slice_axis`, with this array as data. (Rt slice_axis(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR#qscO`stj|||S(sConvenience fluent method for :py:func:`slice_like`. The arguments are the same as for :py:func:`slice_like`, with this array as data. (Rt slice_like(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR$yscO`stj|||S(sConvenience fluent method for :py:func:`take`. The arguments are the same as for :py:func:`take`, with this array as data. (Rttake(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR%scO`stj|||S(sConvenience fluent method for :py:func:`one_hot`. The arguments are the same as for :py:func:`one_hot`, with this array as data. (Rtone_hot(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR&scO`stj|||S(sConvenience fluent method for :py:func:`pick`. The arguments are the same as for :py:func:`pick`, with this array as data. (Rtpick(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR'scO`stj|||S(sConvenience fluent method for :py:func:`sort`. The arguments are the same as for :py:func:`sort`, with this array as data. (Rtsort(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR(scO`stj|||S(sConvenience fluent method for :py:func:`topk`. The arguments are the same as for :py:func:`topk`, with this array as data. (Rttopk(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR)scO`stj|||S(sConvenience fluent method for :py:func:`argsort`. The arguments are the same as for :py:func:`argsort`, with this array as data. (Rtargsort(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR*scO`stj|||S(sConvenience fluent method for :py:func:`argmax`. The arguments are the same as for :py:func:`argmax`, with this array as data. (Rtargmax(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR+scO`stj|||S(sConvenience fluent method for :py:func:`argmax_channel`. The arguments are the same as for :py:func:`argmax_channel`, with this array as data. (Rtargmax_channel(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR,scO`stj|||S(sConvenience fluent method for :py:func:`argmin`. The arguments are the same as for :py:func:`argmin`, with this array as data. (Rtargmin(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR-scO`stj|||S(sConvenience fluent method for :py:func:`clip`. The arguments are the same as for :py:func:`clip`, with this array as data. (Rtclip(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR.scO`stj|||S(sConvenience fluent method for :py:func:`abs`. The arguments are the same as for :py:func:`abs`, with this array as data. (Rtabs(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR/scO`stj|||S(sConvenience fluent method for :py:func:`sign`. The arguments are the same as for :py:func:`sign`, with this array as data. (Rtsign(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR0scO`stj|||S(sConvenience fluent method for :py:func:`flatten`. The arguments are the same as for :py:func:`flatten`, with this array as data. (Rtflatten(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR1scO`stj|||S(sConvenience fluent method for :py:func:`shape_array`. The arguments are the same as for :py:func:`shape_array`, with this array as data. (Rt shape_array(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR2scO`stj|||S(sConvenience fluent method for :py:func:`size_array`. The arguments are the same as for :py:func:`size_array`, with this array as data. (Rt size_array(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR3scO`stj|||S(sConvenience fluent method for :py:func:`expand_dims`. The arguments are the same as for :py:func:`expand_dims`, with this array as data. (Rt expand_dims(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR4scO`stj|||S(sConvenience fluent method for :py:func:`tile`. The arguments are the same as for :py:func:`tile`, with this array as data. (Rttile(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR5scO`stj|||S(sConvenience fluent method for :py:func:`transpose`. The arguments are the same as for :py:func:`transpose`, with this array as data. (Rt transpose(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR6 scO`stj|||S(sConvenience fluent method for :py:func:`flip`. The arguments are the same as for :py:func:`flip`, with this array as data. (Rtflip(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR7scO`stj|||S(sConvenience fluent method for :py:func:`depth_to_space`. The arguments are the same as for :py:func:`depth_to_space`, with this array as data. (Rtdepth_to_space(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR8scO`stj|||S(sConvenience fluent method for :py:func:`space_to_depth`. The arguments are the same as for :py:func:`space_to_depth`, with this array as data. (Rtspace_to_depth(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR9!sicK`stj|||S(sConvenience fluent method for :py:func:`diag`. The arguments are the same as for :py:func:`diag`, with this array as data. (Rtdiag(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR:)scO`stj|||S(sConvenience fluent method for :py:func:`sum`. The arguments are the same as for :py:func:`sum`, with this array as data. (Rtsum(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR;1scO`stj|||S(sConvenience fluent method for :py:func:`nansum`. The arguments are the same as for :py:func:`nansum`, with this array as data. (Rtnansum(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR<9scO`stj|||S(sConvenience fluent method for :py:func:`prod`. The arguments are the same as for :py:func:`prod`, with this array as data. (RR(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRAscO`stj|||S(sConvenience fluent method for :py:func:`nanprod`. The arguments are the same as for :py:func:`nanprod`, with this array as data. (Rtnanprod(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR=IscO`stj|||S(sConvenience fluent method for :py:func:`mean`. The arguments are the same as for :py:func:`mean`, with this array as data. (Rtmean(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR>QscO`stj|||S(sConvenience fluent method for :py:func:`max`. The arguments are the same as for :py:func:`max`, with this array as data. (Rtmax(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR?YscO`stj|||S(sConvenience fluent method for :py:func:`min`. The arguments are the same as for :py:func:`min`, with this array as data. (Rtmin(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR@ascO`stj|||S(sConvenience fluent method for :py:func:`norm`. The arguments are the same as for :py:func:`norm`, with this array as data. (Rtnorm(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRAiscO`stj|||S(sConvenience fluent method for :py:func:`round`. The arguments are the same as for :py:func:`round`, with this array as data. (Rtround(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRBqscO`stj|||S(sConvenience fluent method for :py:func:`rint`. The arguments are the same as for :py:func:`rint`, with this array as data. (Rtrint(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRCyscO`stj|||S(sConvenience fluent method for :py:func:`fix`. The arguments are the same as for :py:func:`fix`, with this array as data. (Rtfix(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRDscO`stj|||S(sConvenience fluent method for :py:func:`floor`. The arguments are the same as for :py:func:`floor`, with this array as data. (Rtfloor(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyREscO`stj|||S(sConvenience fluent method for :py:func:`ceil`. The arguments are the same as for :py:func:`ceil`, with this array as data. (Rtceil(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRFscO`stj|||S(sConvenience fluent method for :py:func:`trunc`. The arguments are the same as for :py:func:`trunc`, with this array as data. (Rttrunc(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRGscO`stj|||S(sConvenience fluent method for :py:func:`sin`. The arguments are the same as for :py:func:`sin`, with this array as data. (Rtsin(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRHscO`stj|||S(sConvenience fluent method for :py:func:`cos`. The arguments are the same as for :py:func:`cos`, with this array as data. (Rtcos(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRIscO`stj|||S(sConvenience fluent method for :py:func:`tan`. The arguments are the same as for :py:func:`tan`, with this array as data. (Rttan(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRJscO`stj|||S(sConvenience fluent method for :py:func:`arcsin`. The arguments are the same as for :py:func:`arcsin`, with this array as data. (Rtarcsin(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRKscO`stj|||S(sConvenience fluent method for :py:func:`arccos`. The arguments are the same as for :py:func:`arccos`, with this array as data. (Rtarccos(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRLscO`stj|||S(sConvenience fluent method for :py:func:`arctan`. The arguments are the same as for :py:func:`arctan`, with this array as data. (Rtarctan(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRMscO`stj|||S(sConvenience fluent method for :py:func:`degrees`. The arguments are the same as for :py:func:`degrees`, with this array as data. (Rtdegrees(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRNscO`stj|||S(sConvenience fluent method for :py:func:`radians`. The arguments are the same as for :py:func:`radians`, with this array as data. (Rtradians(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyROscO`stj|||S(sConvenience fluent method for :py:func:`sinh`. The arguments are the same as for :py:func:`sinh`, with this array as data. (Rtsinh(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRPscO`stj|||S(sConvenience fluent method for :py:func:`cosh`. The arguments are the same as for :py:func:`cosh`, with this array as data. (Rtcosh(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRQscO`stj|||S(sConvenience fluent method for :py:func:`tanh`. The arguments are the same as for :py:func:`tanh`, with this array as data. (Rttanh(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRRscO`stj|||S(sConvenience fluent method for :py:func:`arcsinh`. The arguments are the same as for :py:func:`arcsinh`, with this array as data. (Rtarcsinh(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRSscO`stj|||S(sConvenience fluent method for :py:func:`arccosh`. The arguments are the same as for :py:func:`arccosh`, with this array as data. (Rtarccosh(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRTscO`stj|||S(sConvenience fluent method for :py:func:`arctanh`. The arguments are the same as for :py:func:`arctanh`, with this array as data. (Rtarctanh(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRU scO`stj|||S(sConvenience fluent method for :py:func:`exp`. The arguments are the same as for :py:func:`exp`, with this array as data. (Rtexp(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRVscO`stj|||S(sConvenience fluent method for :py:func:`expm1`. The arguments are the same as for :py:func:`expm1`, with this array as data. (Rtexpm1(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRWscO`stj|||S(sConvenience fluent method for :py:func:`log`. The arguments are the same as for :py:func:`log`, with this array as data. (Rtlog(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRX!scO`stj|||S(sConvenience fluent method for :py:func:`log10`. The arguments are the same as for :py:func:`log10`, with this array as data. (Rtlog10(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRY)scO`stj|||S(sConvenience fluent method for :py:func:`log2`. The arguments are the same as for :py:func:`log2`, with this array as data. (Rtlog2(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRZ1scO`stj|||S(sConvenience fluent method for :py:func:`log1p`. The arguments are the same as for :py:func:`log1p`, with this array as data. (Rtlog1p(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR[9scO`stj|||S(sConvenience fluent method for :py:func:`sqrt`. The arguments are the same as for :py:func:`sqrt`, with this array as data. (Rtsqrt(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR\AscO`stj|||S(sConvenience fluent method for :py:func:`rsqrt`. The arguments are the same as for :py:func:`rsqrt`, with this array as data. (Rtrsqrt(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR]IscO`stj|||S(sConvenience fluent method for :py:func:`cbrt`. The arguments are the same as for :py:func:`cbrt`, with this array as data. (Rtcbrt(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR^QscO`stj|||S(sConvenience fluent method for :py:func:`rcbrt`. The arguments are the same as for :py:func:`rcbrt`, with this array as data. (Rtrcbrt(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR_YscO`stj|||S(sConvenience fluent method for :py:func:`square`. The arguments are the same as for :py:func:`square`, with this array as data. (Rtsquare(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR`ascO`stj|||S(sConvenience fluent method for :py:func:`reciprocal`. The arguments are the same as for :py:func:`reciprocal`, with this array as data. (Rt reciprocal(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRaiscO`stj|||S(sConvenience fluent method for :py:func:`relu`. The arguments are the same as for :py:func:`relu`, with this array as data. (Rtrelu(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRbqscO`stj|||S(sConvenience fluent method for :py:func:`sigmoid`. The arguments are the same as for :py:func:`sigmoid`, with this array as data. (Rtsigmoid(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRcyscO`stj|||S(sConvenience fluent method for :py:func:`softmax`. The arguments are the same as for :py:func:`softmax`, with this array as data. (Rtsoftmax(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRdscO`stj|||S(sConvenience fluent method for :py:func:`log_softmax`. The arguments are the same as for :py:func:`log_softmax`, with this array as data. (Rt log_softmax(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRescO`stj|||S(sConvenience fluent method for :py:func:`softmin`. The arguments are the same as for :py:func:`softmin`, with this array as data. (Rtsoftmin(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRfscO`stj|||S(sConvenience fluent method for :py:func:`squeeze`. The arguments are the same as for :py:func:`squeeze`, with this array as data. (Rtsqueeze(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRgscC`s|j}dj||}t|t|krBt|ndt|t||}tj|}tj|tj|k}||dkjrt|n||jkrtj |j |d|Stj |dt |SdS(sKBroadcasts the input array to a new shape. Broadcasting is only allowed on axes with size 1. The new shape cannot change the number of dimensions. For example, you could broadcast from shape (2, 1) to (2, 3), but not from shape (2, 3) to (2, 3, 3). Parameters ---------- shape : tuple of int The shape of the desired array. Returns ------- NDArray A NDArray with the desired shape that is not sharing data with this array, even if the new shape is the same as ``self.shape``. Examples -------- >>> x = mx.nd.arange(0,3).reshape((1,3,1)) >>> x.asnumpy() array([[[ 0.], [ 1.], [ 2.]]], dtype=float32) >>> y = x.broadcast_to((2,3,3)) >>> y.asnumpy() array([[[ 0., 0., 0.], [ 1., 1., 1.], [ 2., 2., 2.]], [[ 0., 0., 0.], [ 1., 1., 1.], [ 2., 2., 2.]]], dtype=float32) sloperands could not be broadcast together with remapped shapes[original->remapped]: {} and requested shape {}iRPN(i( RPRRHRrRMRtnonzerotanyRRRR(R^RPt cur_shapeterr_strt cur_shape_arrtbroadcasting_axes((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs$  cC`s|j|jS(sbBroadcasts the input array to the shape of other. Broadcasting is only allowed on axes with size 1. The new shape cannot change the number of dimensions. For example, you could broadcast from shape (2, 1) to (2, 3), but not from shape (2, 3) to (2, 3, 3). Parameters ---------- other : NDArray Array with shape of the desired array. Returns ------- NDArray A NDArray with the desired shape that is not sharing data with this array, even if the new shape is the same as ``self.shape``. Examples -------- >>> x = mx.nd.arange(0,3).reshape((1,3,1)) >>> x.asnumpy() array([[[ 0.], [ 1.], [ 2.]]], dtype=float32) >>> y = x.broadcast_like(mx.nd.ones((2,3,3))) >>> y.asnumpy() array([[[ 0., 0., 0.], [ 1., 1., 1.], [ 2., 2., 2.]], [[ 0., 0., 0.], [ 1., 1., 1.], [ 2., 2., 2.]]], dtype=float32) (RRP(R^Rn((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pytbroadcast_likes$cC`sttj|jdS(sKWaits until all previous write operations on the current array are finished. This method guarantees that all previous write operations that pushed into the backend engine for execution are actually finished. Examples -------- >>> import time >>> tic = time.time() >>> a = mx.nd.ones((1000,1000)) >>> b = mx.nd.dot(a, a) >>> print(time.time() - tic) # doctest: +SKIP 0.003854036331176758 >>> b.wait_to_read() >>> print(time.time() - tic) # doctest: +SKIP 0.0893700122833252 N(RRtMXNDArrayWaitToReadR[(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt wait_to_readscC`s t|jS(sReturns the number of dimensions of this array Examples -------- >>> x = mx.nd.array([1, 2, 3, 4]) >>> x.ndim 1 >>> x = mx.nd.array([[1, 2], [3, 4]]) >>> x.ndim 2 (RHRP(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pytndims cC`sZt}tjt}ttj|jtj|tj|t||j S(sTuple of array dimensions. Examples -------- >>> x = mx.nd.array([1, 2, 3, 4]) >>> x.shape (4L,) >>> y = mx.nd.zeros((2, 3, 4)) >>> y.shape (2L, 3L, 4L) ( R RBRRRtMXNDArrayGetShapeR[RCRRZ(R^Rqtpdata((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRPs  %cC`s(d}x|jD]}||9}qW|S(sNumber of elements in the array. Equivalent to the product of the array's dimensions. Examples -------- >>> import numpy as np >>> x = mx.nd.zeros((3, 5, 2)) >>> x.size 30 >>> np.prod(x.shape) 30 i(RP(R^RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR3scC`s`tj}tj}ttj|jtj|tj|ttj|j |j S(s.Device context of the array. Examples -------- >>> x = mx.nd.array([1, 2, 3, 4]) >>> x.context cpu(0) >>> type(x.context) >>> y = mx.nd.zeros((2,3), mx.gpu(0)) >>> y.context gpu(0) ( RBRIRRtMXNDArrayGetContextR[RCRt devtype2strRZ(R^t dev_typeidtdev_id((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRfGs    %cC`s9tj}ttj|jtj|t|jS(sbData-type of the array's elements. Returns ------- numpy.dtype This NDArray's data type. Examples -------- >>> x = mx.nd.zeros((2,3)) >>> x.dtype >>> y = mx.nd.zeros((2,3), dtype='int32') >>> y.dtype ( RBRIRRtMXNDArrayGetDTypeR[RCRRZ(R^tmx_dtype((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRN\s  cC`stt|jS(s#Storage-type of the array. (t_STORAGE_TYPE_ID_TO_STRR]R[(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pytstypesscC`s&t|jdkr|Stj|S(sbReturns a copy of the array with axes transposed. Equivalent to ``mx.nd.transpose(self)`` except that self is returned if ``self.ndim < 2``. Unlike ``numpy.ndarray.T``, this function returns a copy rather than a view of the array unless ``self.ndim < 2``. Examples -------- >>> x = mx.nd.arange(0,6).reshape((2,3)) >>> x.asnumpy() array([[ 0., 1., 2.], [ 3., 4., 5.]], dtype=float32) >>> x.T.asnumpy() array([[ 0., 3.], [ 1., 4.], [ 2., 5.]], dtype=float32) i(RHRPRR6(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pytTyscC`s5tj}ttj|jtj||jS(s5Whether this array's corresponding gradient array (registered via `autograd.mark_variables`) has been updated by `autograd.backward` since last reset. `_fresh_grad` need to be manually set to False after consuming gradient (usually after updating this array). (RBRIRRtMXNDArrayGetGradStateR[RCRZ(R^Rp((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt _fresh_grads "cC`s&ttj|jtj|dS(N(RRtMXNDArraySetGradStateR[RBRI(R^R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR~scC`sVtj|jd|j}ttj|j|jj tj tj |j |S(sReturns a ``numpy.ndarray`` object with value copied from this array. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = x.asnumpy() >>> type(y) >>> y array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> z = mx.nd.ones((2,3), dtype='int32') >>> z.asnumpy() array([[1, 1, 1], [1, 1, 1]], dtype=int32) RN( RMtemptyRPRNRRtMXNDArraySyncCopyToCPUR[RBR RRR(R^tdata((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRcs  cC`s,|jdkrtdn|jdS(sTReturns a scalar whose value is copied from this array. This function is equivalent to ``self.asnumpy()[0]``. This NDArray must have shape (1,). Examples -------- >>> x = mx.nd.ones((1,), dtype='int32') >>> x.asscalar() 1 >>> type(x.asscalar()) is!The current array is not a scalari(i(RPRrRc(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs cC`sR| r#tj||jkr#|St|jd|jd|}|j||S(sReturns a copy of the array after casting to a specified type. Parameters ---------- dtype : numpy.dtype or str The type of the returned array. copy : bool Default `True`. By default, astype always returns a newly allocated ndarray on the same context. If this is set to `False`, and the dtype requested is the same as the ndarray's dtype, the ndarray is returned instead of a copy. Returns ------- NDArray, CSRNDArray or RowSparseNDArray The copied array after casting to the specified type, or the same array if copy=False and dtype is the same as the input array. Examples -------- >>> x = mx.nd.zeros((2,3), dtype='float32') >>> y = x.astype('int32') >>> y.dtype RQRN(RMRNRRPRfR(R^RNtcopytres((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs  cC`st|trH|j|jkr5tjdttStj|d|St|t rtt |j |t |j }tj|d|Stdtt|dS(s0Copies the value of this array to another array. If ``other`` is a ``NDArray`` object, then ``other.shape`` and ``self.shape`` should be the same. This function copies the value from ``self`` to ``other``. If ``other`` is a context, a new ``NDArray`` will be first created on the target context, and the value of ``self`` is copied. Parameters ---------- other : NDArray or Context The destination array or context. Returns ------- NDArray, CSRNDArray or RowSparseNDArray The copied array. If ``other`` is an ``NDArray``, then the return value and ``other`` will point to the same ``NDArray``. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.zeros((2,3), mx.gpu(0)) >>> z = x.copyto(y) >>> z is y True >>> y.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.copyto(mx.gpu(0)) s-You are attempting to copy an array to itselfRpscopyto does not support type N(RsRR[twarningstwarntRuntimeWarningRRt_copytoRRSRPRRNRwRbRO(R^Rnthret((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs#!cC`s|j|jS(sxMakes a copy of this ``NDArray``, keeping the same context. Returns ------- NDArray, CSRNDArray or RowSparseNDArray The copied array Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = x.copy() >>> y.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) (RRf(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR!scC`s |j|kr|S|j|S(s|Returns an array on the target device with the same value as this array. If the target context is the same as ``self.context``, then ``self`` is returned. Otherwise, a copy is made. Parameters ---------- context : Context The target context. Returns ------- NDArray, CSRNDArray or RowSparseNDArray The target array. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = x.as_in_context(mx.cpu()) >>> y is x True >>> z = x.as_in_context(mx.gpu(0)) >>> z is x False (RfR(R^Rf((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR3sR@cC`sddlm}|dk r4||jd|}ntj|}t|}ttj dt j |j t j t |t j |j dS(sMAttach a gradient buffer to this NDArray, so that `backward` can compute gradient with respect to it. Parameters ---------- grad_req : {'write', 'add', 'null'} How gradient will be accumulated. - 'write': gradient will be overwritten on every backward. - 'add': gradient will be added to existing value on every backward. - 'null': do not compute gradient for this NDArray. stype : str, optional The storage type of the gradient array. Defaults to the same stype of this NDArray. i(tzerosR{N(tRRiRPRRRRRtMXAutogradMarkVariablesRBtpointerR[R (R^tgrad_reqR{t_zerostgrad((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt attach_gradRs   cC`sXddlm}t}ttj|jtj||j dkrNdS||S(s1Returns gradient buffer attached to this NDArray.i(t _ndarray_clsN( RRRRRtMXNDArrayGetGradR[RBRCRZRi(R^RRD((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRks  "cC`sEddlm}t}ttj|jtj|||S(s7Returns a new NDArray, detached from the current graph.i(R( RRRRRtMXNDArrayDetachR[RBRC(R^RRD((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pytdetachus "c C`s|dkrtdg}n |jg}ttjdt|gtt|dtj dtj |tj dtj |tj dtj d dS(sCompute the gradients of this NDArray w.r.t variables. Parameters ---------- out_grad : NDArray, optional Gradient with respect to head. retain_graph : bool, optional Whether to retain the computaion graph for another backward pass on the same graph. By default the computaion history is cleared. train_mode : bool, optional Whether to compute gradient for training or inference. iiN( RiRR[RRtMXAutogradBackwardExR R RBRRI(R^tout_gradt retain_grapht train_modet ograd_handles((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pytbackward|s         cC`stj|d|S(sReturn a copy of the array with chosen storage type. See Also ---------- :meth:`mxnet.ndarray.cast_storage`. Returns ------- NDArray, CSRNDArray or RowSparseNDArray A copy of the array with the chosen storage stype R{(Rt cast_storage(R^R{((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyttostypes cC`s t|S(sYReturns a reference view of NDArray that represents as DLManagedTensor until all previous write operations on the current array are finished. Returns ------- PyCapsule (the pointer of DLManagedTensor) a reference view of NDArray that represents as DLManagedTensor. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.to_dlpack_for_read(x) >>> type(y) >>> z = mx.nd.from_dlpack(y) >>> z [[1. 1. 1.] [1. 1. 1.]] (R8(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR8scC`s t|S(srReturns a reference view of NDArray that represents as DLManagedTensor until all previous read/write operations on the current array are finished. Returns ------- PyCapsule (the pointer of DLManagedTensor) a reference view of NDArray that represents as DLManagedTensor. Examples -------- >>> x = mx.nd.ones((2,3)) >>> w = mx.nd.to_dlpack_for_write(x) >>> type(w) >>> u = mx.nd.from_dlpack(w) >>> u += 1 >>> x [[2. 2. 2.] [2. 2. 2.]] (R9(R^((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR9sN(Ret __module__t__doc__t __slots__t__array_priority__t _tvm_tcodetpropertyR_RhRkRmRoRxRyRzR}R~RRRRRRRRRRRRRRRRRRRRRRRt __nonzero__RRjRRRRRRRRRRRRRRRRRRR R!R"RR#R$R%R&R'R(R)R*R+R,R-R.R/R0R1R2R3R4R5R6R7R8R9R:R;R<RR=R>R?R@RARBRCRDRERFRGRHRIRJRKRLRMRNRORPRQRRRSRTRURVRWRXRYRZR[R\R]R^R_R`RaRbRcRdReRfRgRRnRpRqRPRRfRNR{R|R~tsetterRcRRRRRRRiRRRRRRR8R9(((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs:                              B =  T  A  %  " {                                                                               4 &    # .     cC`s!t|ttjfrtSt|trzxH|D]@}t|ts2tdt|tt |fq2q2WtSt|tt frt St|t rxp|D]h}t|ttjtt frtSt|t tfst dt|tt |fqqWt StSdS(sIReturns a dispatch code for calling basic or advanced indexing functions.ssIndexing NDArray only supports a list of integers as index when key is of list type, received element=%s of type=%ss8NDArray does not support slicing with key %s of type %s.N(RsRRMRRRRRwRbRORRRRrt_NDARRAY_UNSUPPORTED_INDEXING(RRR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs& ) )cC`s~|dkrtdn|dkr6tdn|dkrKd}n|dkry|dkrld}q|d}ng|dkr||7}|dkrtd|||fqn%||krtd||fn|dkr |dkr|}qqd}ng|dkrL||7}|dkrqtd|||fqqn%||krqtd||fn|||fS( sGiven start, stop, step and array length, return absolute values of start, stop, and step for generating index range. The returned values have been compensated by adding length if they are less than zero for all the cases but slice(None, None, -1). Note that the returned value of stop is not necessarily >= 0, since absolute stop is -1 in the case of slice(None, None, -1).isstep size cannot be zeros%array length cannot be less than zerois$Slicing start %d exceeds limit of %dis#Slicing stop %d exceeds limit of %dN(RrRiR(RRRR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs6                      cC`srt|dkr$t|dks*tt|d}|dt|krh|j||dnt|S(sGiven data and index shapes, get the output `NDArray` shape. This basically implements the infer shape logic of op gather_nd.ii(RHRRRR(tdshapetishapeR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR s *cC`sv|dkst|dkrI||ks0t||d|d}n)||ks[t||d| d}|S(sPGiven start, stop, and stop, calculate the number of elements of this slice.ii(R(RRRR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR& s cC`s||kr|St|}t|}||krCt|}n t|}t||d}xt|ddd|dddD]f\}}|dkr|dkr||krtd||fnt||||<|d8}qWt|S(sdGiven two shapes that are not identical, find the shape that both input shapes can broadcast to.iNis+shape1=%s is not broadcastable to shape2=%s(RHRR?tzipRrR(tshape1tshape2tlength1tlength2RPRtatb((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR3 s     6$cC`stj||d|S(stOne-hot encoding indices into matrix out. .. note:: `onehot_encode` is deprecated. Use `one_hot` instead. Rp(Rt_onehot_encode(RRp((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR1H scK`sO|dkrt}n|dkr*tn|}tjd|d|d||S(s`Returns a new array filled with all ones, with the given shape and type. Parameters ---------- shape : int or tuple of int or list of int The shape of the empty array. ctx : Context, optional An optional device context. Defaults to the current default context (``mxnet.context.current_context()``). dtype : str or numpy.dtype, optional An optional value type (default is `float32`). out : NDArray, optional The output NDArray (default is `None`). Returns ------- NDArray A new array of the specified shape filled with all ones. Examples -------- >>> mx.nd.ones(1).asnumpy() array([ 1.], dtype=float32) >>> mx.nd.ones((1,2), mx.gpu(0)) >>> mx.nd.ones((1,2), dtype='float16').asnumpy() array([[ 1., 1.]], dtype=float16) RPRQRNN(RiRR Rt_ones(RPRQRNR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRS s  cC`s/|dkrt|||n|}||(|S(s{Returns a new array of given shape and type, filled with the given value `val`. Parameters -------- shape : int or tuple of int The shape of the new array. val : scalar Fill value. ctx : Context, optional Device context (default is the current default context). dtype : `str` or `numpy.dtype`, optional The data type of the returned `NDArray`. The default datatype is `float32`. out : NDArray, optional The output NDArray (default is `None`). Returns ------- NDArray `NDArray` filled with `val`, with the given shape, ctx, and dtype. Examples -------- >>> mx.nd.full(1, 2.0).asnumpy() array([ 2.], dtype=float32) >>> mx.nd.full((1, 2), 2.0, mx.gpu(0)) >>> mx.nd.full((1, 2), 2.0, dtype='float16').asnumpy() array([[ 2., 2.]], dtype=float16) N(RiR(RPRRQRNRp((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR"y s$cC`st|tr-|dkr$|jn|}n\|dkr?tn|}t|tjsytj|d|}WqtdqXnt |j ||}||(|S(sCreates an array from any object exposing the array interface. Parameters ---------- source_array : array_like An object exposing the array interface, an object whose `__array__` method returns an array, or any (nested) sequence. ctx : Context, optional Device context (default is the current default context). dtype : str or numpy.dtype, optional The data type of the output array. The default dtype is ``source_array.dtype`` if `source_array` is an `NDArray`, `float32` otherwise. Returns ------- NDArray An `NDArray` with the same contents as the `source_array`. RNs&source_array must be array like objectN( RsRRiRNR RMRRRwRRP(RRQRNtarr((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR scC`stt|j}y|j|Wn!tk rItd|nXy|j||Wn!tk rtd|nXtj||S(s?Moves the `source` axis into the `destination` position while leaving the other axes in their original order Parameters ---------- tensor : mx.nd.array The array which axes should be reordered source : int Original position of the axes to move. destination : int Destination position for each of the original axes. Returns ------- result : mx.nd.array Array with moved axes. Examples -------- >>> X = mx.nd.array([[1, 2, 3], [4, 5, 6]]) >>> mx.nd.moveaxis(X, 0, 1).shape (3L, 2L) s4Source should verify 0 <= source < tensor.ndimGot %ds>Destination should verify 0 <= destination < tensor.ndimGot %d( RRRqtpopRRrtinsertRR6(ttensortsourcet destinationtaxes((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR- s  g?cC`sR|dkrt}ntjd|d|d|d|d|d|dt|S( sReturns evenly spaced values within a given interval. Values are generated within the half-open interval [`start`, `stop`). In other words, the interval includes `start` but excludes `stop`. The function is similar to the built-in Python function `range` and to `numpy.arange`, but returns an `NDArray`. Parameters ---------- start : number, optional Start of interval. The default start value is 0. stop : number End of interval. step : number, optional Spacing between values. The default step size is 1. repeat : int, optional Number of times to repeat each element. The default repeat count is 1. ctx : Context, optional Device context. Default context is the current default context. dtype : str or numpy.dtype, optional The data type of the `NDArray`. The default datatype is `np.float32`. Returns ------- NDArray `NDArray` of evenly spaced values in the specified range. Examples -------- >>> mx.nd.arange(3).asnumpy() array([ 0., 1., 2.], dtype=float32) >>> mx.nd.arange(2, 6).asnumpy() array([ 2., 3., 4., 5.], dtype=float32) >>> mx.nd.arange(2, 6, step=2).asnumpy() array([ 2., 4.], dtype=float32) >>> mx.nd.arange(2, 6, step=1.5, repeat=2).asnumpy() array([ 2. , 2. , 3.5, 3.5, 5. , 5. ], dtype=float32) >>> mx.nd.arange(2, 6, step=2, repeat=3, dtype='int32').asnumpy() array([2, 2, 2, 4, 4, 4], dtype=int32) RRRRt infer_rangeRNRQN(RiRRt_arangeRb(RRRRRRQRN((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR s)  !cC`st|tr`t|tr+|||S|dkrJ||t|S||t|SnZt|tr||t|St|tr|||Stdtt|dS(sg Helper function for element-wise operation. The function will perform numpy-like broadcasting if needed and call different functions. Parameters -------- lhs : NDArray or numeric value Left-hand side operand. rhs : NDArray or numeric value Right-hand operand, fn_array : function Function to be called if both lhs and rhs are of ``NDArray`` type. fn_scalar : function Function to be called if both lhs and rhs are numeric values. lfn_scalar : function Function to be called if lhs is ``NDArray`` while rhs is numeric value rfn_scalar : function Function to be called if lhs is numeric value while rhs is ``NDArray``; if none is provided, then the function is commutative, so rfn_scalar is equal to lfn_scalar Returns -------- NDArray result array stype %s not supportedN(RsRRiRvRRwRbRO(RRtfn_arrayt fn_scalart lfn_scalart rfn_scalar((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt _ufunc_helper s   cC`s"t||tjtjtjdS(sReturns element-wise sum of the input arrays with broadcasting. Equivalent to ``lhs + rhs``, ``mx.nd.broadcast_add(lhs, rhs)`` and ``mx.nd.broadcast_plus(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape Parameters ---------- lhs : scalar or array First array to be added. rhs : scalar or array Second array to be added. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The element-wise sum of the input arrays. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x+2).asnumpy() array([[ 3., 3., 3.], [ 3., 3., 3.]], dtype=float32) >>> (x+y).asnumpy() array([[ 1., 1., 1.], [ 2., 2., 2.]], dtype=float32) >>> mx.nd.add(x,y).asnumpy() array([[ 1., 1., 1.], [ 2., 2., 2.]], dtype=float32) >>> (z + y).asnumpy() array([[ 0., 1.], [ 1., 2.]], dtype=float32) N(RRRtRRRRuRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRE s4cC`s%t||tjtjtjtjS(sReturns element-wise difference of the input arrays with broadcasting. Equivalent to ``lhs - rhs``, ``mx.nd.broadcast_sub(lhs, rhs)`` and ``mx.nd.broadcast_minus(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be subtracted. rhs : scalar or array Second array to be subtracted. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The element-wise difference of the input arrays. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x-2).asnumpy() array([[-1., -1., -1.], [-1., -1., -1.]], dtype=float32) >>> (x-y).asnumpy() array([[ 1., 1., 1.], [ 0., 0., 0.]], dtype=float32) >>> mx.nd.subtract(x,y).asnumpy() array([[ 1., 1., 1.], [ 0., 0., 0.]], dtype=float32) >>> (z-y).asnumpy() array([[ 0., 1.], [-1., 0.]], dtype=float32) (RRR{RtsubRR|t_rminus_scalar(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR3 s4cC`s"t||tjtjtjdS(sReturns element-wise product of the input arrays with broadcasting. Equivalent to ``lhs * rhs`` and ``mx.nd.broadcast_mul(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be multiplied. rhs : scalar or array Second array to be multiplied. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The element-wise multiplication of the input arrays. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x*2).asnumpy() array([[ 2., 2., 2.], [ 2., 2., 2.]], dtype=float32) >>> (x*y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.multiply(x, y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> (z*y).asnumpy() array([[ 0., 0.], [ 0., 1.]], dtype=float32) N(RRRRRRRRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR/ s3cC`s%t||tjtjtjtjS(sReturns element-wise division of the input arrays with broadcasting. Equivalent to ``lhs / rhs`` and ``mx.nd.broadcast_div(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array in division. rhs : scalar or array Second array in division. The arrays to be divided. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The element-wise division of the input arrays. Examples -------- >>> x = mx.nd.ones((2,3))*6 >>> y = mx.nd.ones((2,1))*2 >>> x.asnumpy() array([[ 6., 6., 6.], [ 6., 6., 6.]], dtype=float32) >>> y.asnumpy() array([[ 2.], [ 2.]], dtype=float32) >>> x/2 >>> (x/3).asnumpy() array([[ 2., 2., 2.], [ 2., 2., 2.]], dtype=float32) >>> (x/y).asnumpy() array([[ 3., 3., 3.], [ 3., 3., 3.]], dtype=float32) >>> mx.nd.divide(x,y).asnumpy() array([[ 3., 3., 3.], [ 3., 3., 3.]], dtype=float32) (RRRRttruedivRRt _rdiv_scalar(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR s/cC`s%t||tjtjtjtjS(sReturns element-wise modulo of the input arrays with broadcasting. Equivalent to ``lhs % rhs`` and ``mx.nd.broadcast_mod(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array in modulo. rhs : scalar or array Second array in modulo. The arrays to be taken modulo. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The element-wise modulo of the input arrays. Examples -------- >>> x = mx.nd.ones((2,3))*6 >>> y = mx.nd.ones((2,1))*4 >>> x.asnumpy() array([[ 6., 6., 6.], [ 6., 6., 6.]], dtype=float32) >>> y.asnumpy() array([[ 4.], [ 4.]], dtype=float32) >>> x%5 >>> (x%5).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> (x%y).asnumpy() array([[ 2., 2., 2.], [ 2., 2., 2.]], dtype=float32) >>> mx.nd.modulo(x,y).asnumpy() array([[ 2., 2., 2.], [ 2., 2., 2.]], dtype=float32) (RRRRtmodRRt _rmod_scalar(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR.7 s/cC`s%t||tjtjtjtjS(sReturns result of first array elements raised to powers from second array, element-wise with broadcasting. Equivalent to ``base ** exp`` and ``mx.nd.broadcast_power(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- base : scalar or NDArray The base array exp : scalar or NDArray The exponent array. If ``base.shape != exp.shape``, they must be broadcastable to a common shape. Returns -------- NDArray The bases in x raised to the exponents in y. Examples -------- >>> x = mx.nd.ones((2,3))*2 >>> y = mx.nd.arange(1,3).reshape((2,1)) >>> z = mx.nd.arange(1,3).reshape((2,1)) >>> x.asnumpy() array([[ 2., 2., 2.], [ 2., 2., 2.]], dtype=float32) >>> y.asnumpy() array([[ 1.], [ 2.]], dtype=float32) >>> z.asnumpy() array([[ 1.], [ 2.]], dtype=float32) >>> (x**2).asnumpy() array([[ 4., 4., 4.], [ 4., 4., 4.]], dtype=float32) >>> (x**y).asnumpy() array([[ 2., 2., 2.], [ 4., 4., 4.]], dtype=float32) >>> mx.nd.power(x,y).asnumpy() array([[ 2., 2., 2.], [ 4., 4., 4.]], dtype=float32) >>> (z**y).asnumpy() array([[ 1.], [ 4.]], dtype=float32) (RRtbroadcast_powerRtpowRt _power_scalart_rpower_scalar(tbaseRV((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR2p s4cC`s"t||tjdtjdS(s,Returns element-wise maximum of the input arrays with broadcasting. Equivalent to ``mx.nd.broadcast_maximum(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The element-wise maximum of the input arrays. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> mx.nd.maximum(x, 2).asnumpy() array([[ 2., 2., 2.], [ 2., 2., 2.]], dtype=float32) >>> mx.nd.maximum(x, y).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.maximum(y, z).asnumpy() array([[ 0., 1.], [ 1., 1.]], dtype=float32) cS`s||kr|S|S(N((R`ty((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt sN(RRtbroadcast_maximumRt_maximum_scalarRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR+ s/cC`s"t||tjdtjdS(s,Returns element-wise minimum of the input arrays with broadcasting. Equivalent to ``mx.nd.broadcast_minimum(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray The element-wise minimum of the input arrays. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> mx.nd.minimum(x, 2).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.minimum(x, y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.minimum(z, y).asnumpy() array([[ 0., 0.], [ 0., 1.]], dtype=float32) cS`s||kr|S|S(N((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR sN(RRtbroadcast_minimumRt_minimum_scalarRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR, s/cC`s"t||tjdtjdS(sReturns the result of element-wise **equal to** (==) comparison operation with broadcasting. For each element in input arrays, return 1(true) if corresponding elements are same, otherwise return 0(false). Equivalent to ``lhs == rhs`` and ``mx.nd.broadcast_equal(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x == 1).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> (x == y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.equal(x,y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> (z == y).asnumpy() array([[ 1., 0.], [ 0., 1.]], dtype=float32) cS`s||krdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRZ sN(RRtbroadcast_equalRt _equal_scalarRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR! s6cC`s"t||tjdtjdS(szReturns the result of element-wise **not equal to** (!=) comparison operation with broadcasting. For each element in input arrays, return 1(true) if corresponding elements are different, otherwise return 0(false). Equivalent to ``lhs != rhs`` and ``mx.nd.broadcast_not_equal(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (z == y).asnumpy() array([[ 1., 0.], [ 0., 1.]], dtype=float32) >>> (x != 1).asnumpy() array([[ 0., 0., 0.], [ 0., 0., 0.]], dtype=float32) >>> (x != y).asnumpy() array([[ 1., 1., 1.], [ 0., 0., 0.]], dtype=float32) >>> mx.nd.not_equal(x, y).asnumpy() array([[ 1., 1., 1.], [ 0., 0., 0.]], dtype=float32) >>> (z != y).asnumpy() array([[ 0., 1.], [ 1., 0.]], dtype=float32) cS`s||krdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR sN(RRtbroadcast_not_equalRt_not_equal_scalarRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR0` s9cC`s%t||tjdtjtjS(sReturns the result of element-wise **greater than** (>) comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements are greater than rhs, otherwise return 0(false). Equivalent to ``lhs > rhs`` and ``mx.nd.broadcast_greater(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x > 1).asnumpy() array([[ 0., 0., 0.], [ 0., 0., 0.]], dtype=float32) >>> (x > y).asnumpy() array([[ 1., 1., 1.], [ 0., 0., 0.]], dtype=float32) >>> mx.nd.greater(x, y).asnumpy() array([[ 1., 1., 1.], [ 0., 0., 0.]], dtype=float32) >>> (z > y).asnumpy() array([[ 0., 1.], [ 0., 0.]], dtype=float32) cS`s||krdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR s(RRtbroadcast_greaterRt_greater_scalart_lesser_scalar(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR# s6cC`s%t||tjdtjtjS(s;Returns the result of element-wise **greater than or equal to** (>=) comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements are greater than equal to rhs, otherwise return 0(false). Equivalent to ``lhs >= rhs`` and ``mx.nd.broadcast_greater_equal(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x >= 1).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> (x >= y).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.greater_equal(x, y).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> (z >= y).asnumpy() array([[ 1., 1.], [ 0., 1.]], dtype=float32) cS`s||krdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR s(RRtbroadcast_greater_equalRt_greater_equal_scalart_lesser_equal_scalar(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR$ s6cC`s%t||tjdtjtjS(sReturns the result of element-wise **lesser than** (<) comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements are less than rhs, otherwise return 0(false). Equivalent to ``lhs < rhs`` and ``mx.nd.broadcast_lesser(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x < 1).asnumpy() array([[ 0., 0., 0.], [ 0., 0., 0.]], dtype=float32) >>> (x < y).asnumpy() array([[ 0., 0., 0.], [ 0., 0., 0.]], dtype=float32) >>> mx.nd.lesser(x, y).asnumpy() array([[ 0., 0., 0.], [ 0., 0., 0.]], dtype=float32) >>> (z < y).asnumpy() array([[ 0., 0.], [ 1., 0.]], dtype=float32) cS`s||krdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR] s(RRtbroadcast_lesserRRR(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR&# s6cC`s%t||tjdtjtjS(s7Returns the result of element-wise **lesser than or equal to** (<=) comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements are lesser than equal to rhs, otherwise return 0(false). Equivalent to ``lhs <= rhs`` and ``mx.nd.broadcast_lesser_equal(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First array to be compared. rhs : scalar or array Second array to be compared. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> (x <= 1).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> (x <= y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.lesser_equal(x, y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> (z <= y).asnumpy() array([[ 1., 0.], [ 1., 1.]], dtype=float32) cS`s||krdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR s(RRtbroadcast_lesser_equalRRR(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR'c s6cC`s"t||tjdtjdS(sReturns the result of element-wise **logical and** comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements and rhs elements are true, otherwise return 0(false). Equivalent to ``lhs and rhs`` and ``mx.nd.broadcast_logical_and(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First input of the function. rhs : scalar or array Second input of the function. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> mx.nd.logical_and(x, 1).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.logical_and(x, y).asnumpy() array([[ 0., 0., 0.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.logical_and(z, y).asnumpy() array([[ 0., 0.], [ 0., 1.]], dtype=float32) cS`s|r|rdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR sN(RRtbroadcast_logical_andRt_logical_and_scalarRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR( s3cC`s"t||tjdtjdS(sReturns the result of element-wise **logical or** comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements or rhs elements are true, otherwise return 0(false). Equivalent to ``lhs or rhs`` and ``mx.nd.broadcast_logical_or(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First input of the function. rhs : scalar or array Second input of the function. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> mx.nd.logical_or(x, 1).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.logical_or(x, y).asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> mx.nd.logical_or(z, y).asnumpy() array([[ 0., 1.], [ 1., 1.]], dtype=float32) cS`s|s |rdSdS(Nii((R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRsN(RRtbroadcast_logical_orRt_logical_or_scalarRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR) s3cC`s"t||tjdtjdS(sReturns the result of element-wise **logical xor** comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements or rhs elements are true, otherwise return 0(false). Equivalent to ``bool(lhs) ^ bool(rhs)`` and ``mx.nd.broadcast_logical_xor(lhs, rhs)``. .. note:: If the corresponding dimensions of two arrays have the same size or one of them has size 1, then the arrays are broadcastable to a common shape. Parameters ---------- lhs : scalar or array First input of the function. rhs : scalar or array Second input of the function. If ``lhs.shape != rhs.shape``, they must be broadcastable to a common shape. Returns ------- NDArray Output array of boolean values. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.arange(2).reshape((2,1)) >>> z = mx.nd.arange(2).reshape((1,2)) >>> x.asnumpy() array([[ 1., 1., 1.], [ 1., 1., 1.]], dtype=float32) >>> y.asnumpy() array([[ 0.], [ 1.]], dtype=float32) >>> z.asnumpy() array([[ 0., 1.]], dtype=float32) >>> mx.nd.logical_xor(x, y).asnumpy() array([[ 1., 1., 1.], [ 0., 0., 0.]], dtype=float32) cS`st|t|ArdSdS(Nii(R(R`R((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRKsN(RRtbroadcast_logical_xorRt_logical_xor_scalarRi(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR*s-cC`s t||S(s0This function is similar to :meth:`divide`. (R (RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR4Psc C`st|tstt|dks-tt|dtsFt| rgt|dkrg|dS|dj|}|djd|!}|dj|d}|dj}xq|dD]e}||j|7}||jd|!kst||j|dks t||jkstqW||f|}t|d|djd|} d} g|D] } d^q_} t|} x|D]}|dkr|| | | |jd+nM| | |<| |j|| |((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR%s(      cK`sO|dkrt}n|dkr*tn|}tjd|d|d||S(sReturns a new array filled with all zeros, with the given shape and type. Parameters ---------- shape : int or tuple of int The shape of the empty array. ctx : Context, optional An optional device context (default is the current default context). dtype : str or numpy.dtype, optional An optional value type (default is `float32`). out : NDArray, optional The output NDArray (default is `None`). Returns ------- NDArray A created array Examples -------- >>> mx.nd.zeros(1).asnumpy() array([ 0.], dtype=float32) >>> mx.nd.zeros((1,2), mx.gpu(0)) >>> mx.nd.zeros((1,2), mx.gpu(0), 'float16').asnumpy() array([[ 0., 0.]], dtype=float16) RPRQRNN(RiRR RR(RPRQRNR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs  c K`s[|dkrt}n|dkr*tn|}tjd|d|d|d|d||S(syReturn a 2-D array with ones on the diagonal and zeros elsewhere. Parameters ---------- N: int Number of rows in the output. M: int, optional Number of columns in the output. If 0, defaults to N. k: int, optional Index of the diagonal: 0 (the default) refers to the main diagonal, a positive value refers to an upper diagonal, and a negative value to a lower diagonal. ctx: Context, optional An optional device context (default is the current default context) dtype: str or numpy.dtype, optional An optional value type (default is `float32`) Returns ------- NDArray A created array Examples -------- >>> mx.nd.eye(2) [[ 1. 0.] [ 0. 1.]] >>> mx.nd.eye(2, 3, 1) [[ 0. 1. 0.] [ 0. 0. 1.]] tNtMRRQRNN(RiRR Rt_eye(RRRRQRNR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyRs#  cC`sdt|tr|f}n|dkr3t}n|dkrHt}ntdt||t|S(sReturns a new array of given shape and type, without initializing entries. Parameters ---------- shape : int or tuple of int The shape of the empty array. ctx : Context, optional An optional device context (default is the current default context). dtype : str or numpy.dtype, optional An optional value type (default is `float32`). Returns ------- NDArray A created array. R[N(RsRLRiRR RRSR(RPRQRN((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR s     i cC`st|tr%tjd|d|St|tr|dkrtjdtj |j d|\}}t |t |fStjd|d|d|St ddS(s6Compute the histogram of the input data. Parameters ---------- a : NDArray Input data. The histogram is computed over the flattened array. bins : int or sequence of scalars If bins is an int, it defines the number of equal-width bins in the given range (10, by default). If bins is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths. range : (float, float), optional The lower and upper range of the bins. If not provided, range is simply (a.min(), a.max()). Values outside the range are ignored. The first element of the range must be less than or equal to the second. range affects the automatic bin computation as well, the range will be equally divided by the number of bins. RtbinssMrange is not specified, using numpy's result to ensure consistency with numpytbin_cntRs7bins argument should be either an integer or an NDArrayN( RsRRt _histogramRRiRRRMR7RcRRr(RRRRt bin_bounds((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR7&s  !tdltensort used_dltensorcC`s\tj|}tjj|trXtjtjj|t}ttj|ndS(N( RBRt pythonapitPyCapsule_IsValidt_c_str_dltensortPyCapsule_GetPointerRRtMXNDArrayCallDLPackDeleter(t pycapsuleR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyt_dlpack_deleterIs cC`sK|jt}ttj|jtj|tjj |t t S(s]Returns a reference view of NDArray that represents as DLManagedTensor until all previous write operations on the current array are finished. Parameters ---------- data: NDArray input data. Returns ------- PyCapsule (the pointer of DLManagedTensor) a reference view of NDArray that represents as DLManagedTensor. Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.to_dlpack_for_read(x) >>> type(y) >>> z = mx.nd.from_dlpack(y) >>> z [[1. 1. 1.] [1. 1. 1.]] ( RpRRRtMXNDArrayToDLPackR[RBRCRt PyCapsule_NewRt_c_dlpack_deleter(Rtdlpack((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR8Rs  "cC`sWttj|jt}ttj|jtj|tjj |t t S(srReturns a reference view of NDArray that represents as DLManagedTensor until all previous read/write operations on the current array are finished. Parameters ---------- data: NDArray input data. Returns ------- PyCapsule (the pointer of DLManagedTensor) a reference view of NDArray that represents as DLManagedTensor. Examples -------- >>> x = mx.nd.ones((2,3)) >>> w = mx.nd.to_dlpack_for_write(x) >>> type(w) >>> u = mx.nd.from_dlpack(w) >>> u += 1 >>> x [[2. 2. 2.] [2. 2. 2.]] ( RRtMXNDArrayWaitToWriteR[RRRBRCRRRR(RR((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR9qs "cC`st}tj|}tjj|ts?ttdtjtjj |t}t t j |tj |tjj|ttjj|dtd|S(sReturns a NDArray backed by a dlpack tensor. Parameters ---------- dlpack: PyCapsule (the pointer of DLManagedTensor) input data Returns ------- NDArray a NDArray backed by a dlpack tensor Examples -------- >>> x = mx.nd.ones((2,3)) >>> y = mx.nd.to_dlpack_for_read(x) >>> type(y) >>> z = mx.nd.from_dlpack(y) >>> type(z) >>> z [[ 1. 1. 1.] [ 1. 1. 1.]] >>> w = mx.nd.to_dlpack_for_write(x) >>> type(w) >>> u = mx.nd.from_dlpack(w) >>> u += 1 >>> x [[2. 2. 2.] [2. 2. 2.]] sCInvalid DLPack Tensor. DLTensor capsules can be consumed only once.R[N(RRBt py_objectRRRRRrRRRRtMXNDArrayFromDLPackRCtPyCapsule_SetNamet_c_str_used_dltensortPyCapsule_SetDestructorRiR(RR[t dlpack_handle((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyR:s%  (qRt __future__RRt __builtin__RRt ImportErrortbuiltinsRRGRBRRt functoolsRtnumpyRMRRRRRR R R R R RRRRRfRRRRRRt__all__t_STORAGE_TYPE_UNDEFINEDt_STORAGE_TYPE_DEFAULTt_STORAGE_TYPE_ROW_SPARSEt_STORAGE_TYPE_CSRRitfloat32tfloat64tfloat16tuint8Rtint8tint64RRt_STORAGE_TYPE_STR_TO_IDRzRRRRR6RSRWR5R]RRRRRRR1RR"R-RRRRR3R/R R.R2R+R,R!R0R#R$R&R'R(R)R*R4RRR%RRRR7t CFUNCTYPERtPyCapsuleDestructorRRRRR8R9R:(((sU/usr/local/lib/python2.7/site-packages/mxnet-1.3.1-py2.7.egg/mxnet/ndarray/ndarray.pyts     ("                     5  +  &#! '1 0 > > = 9 9 > 9 9 @ C @ @ @ ? < < 6 :$*$+