Skip to content

Instantly share code, notes, and snippets.

@zhreshold
Created June 5, 2018 18:05
Show Gist options
  • Save zhreshold/d564d6149dcfbeced61116a9f5fce8d9 to your computer and use it in GitHub Desktop.
Save zhreshold/d564d6149dcfbeced61116a9f5fce8d9 to your computer and use it in GitHub Desktop.
NDArray shared mem
import mxnet as mx
from mxnet import nd
data = mx.nd.array([1,2,3], ctx=mx.Context('cpu_shared', 0))
pid, fd, shape, dtype = data._to_shared_mem()
new_data = mx.nd.NDArray(nd.ndarray._new_from_shared_mem(pid, fd, shape, dtype))
print(new_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment