mxnet.context.current_context¶
-
mxnet.context.
current_context
()[source]¶ Returns the current context.
By default, mx.cpu() is used for all the computations and it can be overridden by using with mx.Context(x) statement where x can be cpu(device_id) or gpu(device_id).
Examples
>>> mx.current_context() cpu(0) >>> with mx.Context('gpu', 1): # Context changed in `with` block. ... mx.current_context() # Computation done here will be on gpu(1). ... gpu(1) >>> mx.current_context() # Back to default context. cpu(0)
- Returns
default_ctx
- Return type