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

Function __get_nbytes

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

Source from the content-addressed store, hash-verified

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)
134

Callers 2

copyFunction · 0.85
__set_floatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected