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

Function __expect_same_layout

external/ggml/examples/python/ggml/utils.py:167–170  ·  view source on GitHub ↗
(name1: str, tensor1: TensorLike, name2: str, tensor2: TensorLike)

Source from the content-addressed store, hash-verified

165 raise NotImplementedError(f'Cannot write floats to {__describe(tensor)}')
166
167def __expect_same_layout(name1: str, tensor1: TensorLike, name2: str, tensor2: TensorLike):
168 shape1, shape2 = __get_shape(tensor1), __get_shape(tensor2)
169 assert shape1 == shape2, f"Shape mismatch: {name1} has {shape1} but {name2} has {shape2}"
170 assert __is_contiguous(tensor1) and __is_contiguous(tensor2), f"Only contiguous tensors are supported (got {name1} with strides {__get_strides(tensor1)} and {name2} with strides {__get_strides(tensor2)})"
171
172def __check_shape_consistent_with_type(tensor: TensorLike):
173 type = __get_type(tensor)

Callers 2

copyFunction · 0.85
numpyFunction · 0.85

Calls 3

__get_shapeFunction · 0.85
__is_contiguousFunction · 0.85
__get_stridesFunction · 0.85

Tested by

no test coverage detected