MCPcopy Create free account
hub / github.com/RLinf/LaWAM / unpack_array

Function unpack_array

deployment/model_server/tools/msgpack_numpy.py:43–50  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

41
42
43def unpack_array(obj):
44 if b"__ndarray__" in obj:
45 return np.ndarray(buffer=obj[b"data"], dtype=np.dtype(obj[b"dtype"]), shape=obj[b"shape"])
46
47 if b"__npgeneric__" in obj:
48 return np.dtype(obj[b"dtype"]).type(obj[b"data"])
49
50 return obj
51
52
53Packer = functools.partial(msgpack.Packer, default=pack_array)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected