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

Function __describe

external/ggml/examples/python/ggml/utils.py:126–126  ·  view source on GitHub ↗
(tensor: ffi.CType)

Source from the content-addressed store, hash-verified

124 else: raise ValueError(f"Unsupported dtype: {dtype}")
125
126def __describe(tensor: ffi.CType): return f'Tensor[{__type_name(__get_type(tensor))}, {__get_shape(tensor)}]'
127def __get_type(tensor: TensorLike): return __dtype_to_type(tensor.dtype) if isinstance(tensor, np.ndarray) else tensor.type
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)])

Callers 4

numpyFunction · 0.85
__get_floatsFunction · 0.85
__set_floatsFunction · 0.85

Calls 3

__type_nameFunction · 0.85
__get_typeFunction · 0.85
__get_shapeFunction · 0.85

Tested by

no test coverage detected