MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / __get_data

Function __get_data

external/ggml/examples/python/ggml/utils.py:130–130  ·  view source on GitHub ↗
(x: TensorLike)

Source from the content-addressed store, hash-verified

128def __get_shape(x: TensorLike): return x.shape if isinstance(x, np.ndarray) else tuple([x.ne[i] for i in range(x.n_dims)])
129def __get_strides(x: TensorLike): return x.strides if isinstance(x, np.ndarray) else tuple([x.nb[i] for i in range(x.n_dims)])
130def __get_data(x: TensorLike) -> ffi.CData: return ffi.from_buffer(x) if isinstance(x, np.ndarray) else lib.ggml_get_data(x)
131def __get_nbytes(tensor: TensorLike): return tensor.nbytes if isinstance(tensor, np.ndarray) else lib.ggml_nbytes(tensor)
132def __get_nelements(tensor: TensorLike): return tensor.size if isinstance(tensor, np.ndarray) else lib.ggml_nelements(tensor)
133def __is_contiguous(tensor: TensorLike): return tensor.flags['C_CONTIGUOUS'] if isinstance(tensor, np.ndarray) else lib.ggml_is_contiguous(tensor)

Callers 3

copyFunction · 0.85
__get_floatsFunction · 0.85
__set_floatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected