MCPcopy Index your code
hub / github.com/dmlc/dgl / zerocopy_from_numpy

Function zerocopy_from_numpy

python/dgl/ndarray.py:107–122  ·  view source on GitHub ↗

Create an array that shares the given numpy data. Parameters ---------- np_data : numpy.ndarray The numpy data Returns ------- NDArray The array

(np_data)

Source from the content-addressed store, hash-verified

105
106
107def zerocopy_from_numpy(np_data):
108 """Create an array that shares the given numpy data.
109
110 Parameters
111 ----------
112 np_data : numpy.ndarray
113 The numpy data
114
115 Returns
116 -------
117 NDArray
118 The array
119 """
120 arr, _ = numpyasarray(np_data)
121 handle = ctypes.pointer(arr)
122 return NDArray(handle, is_view=True)
123
124
125def cast_to_signed(arr):

Callers

nothing calls this directly

Calls 2

numpyasarrayFunction · 0.85
NDArrayClass · 0.85

Tested by

no test coverage detected