MCPcopy Create free account
hub / github.com/ml-explore/mlx-data / copy

Function copy

mlx/data/Array.cpp:324–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324void copy(
325 const std::shared_ptr<Array>& dst,
326 const std::shared_ptr<const Array>& src) {
327 if (dst->shape().size() != src->shape().size()) {
328 throw std::runtime_error("Array::copy: src and dst sizes must match");
329 }
330 if (dst->itemsize() != src->itemsize()) {
331 throw std::runtime_error("Array::copy: src and dst itemsize must match");
332 }
333
334 size_t size = src->size() * src->itemsize();
335 memcpy(dst->data(), src->data(), size);
336}
337
338template <class T>
339void array_copy_linear_to_strided(

Callers 3

addMethod · 0.85
replace_tFunction · 0.85
apply_videoMethod · 0.85

Calls 4

itemsizeMethod · 0.80
sizeMethod · 0.45
shapeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected