# mxnet.ndarray.sparse.CSRNDArray.as_in_context¶

CSRNDArray.as_in_context(context)

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

The target array.

Return type

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