MLX
Loading...
Searching...
No Matches
copy.h
Go to the documentation of this file.
1// Copyright © 2023-2024 Apple Inc.
2
3#pragma once
4
5#include "mlx/array.h"
7
8namespace mlx::core {
9
10enum class CopyType {
11 // Copy a raw scalar input into the full contiguous output
12 Scalar,
13
14 // Copy the raw input buffer contiguously into a raw output buffer of the same
15 // size
16 Vector,
17
18 // Copy the full virtual input to the full contiguous output
19 General,
20
21 // Copy the full virtual input to the full virtual output. We assume the
22 // input and output have the same shape.
24};
25
26void copy(const array& src, array& dst, CopyType ctype);
27void copy_inplace(const array& src, array& dst, CopyType ctype);
28
29template <typename stride_t>
31 const array& src,
32 array& dst,
33 const std::vector<int>& data_shape,
34 const std::vector<stride_t>& i_strides,
35 const std::vector<stride_t>& o_strides,
36 int64_t i_offset,
37 int64_t o_offset,
38 CopyType ctype);
39
40} // namespace mlx::core
Definition array.h:20
Definition allocator.h:7
void copy(const array &src, array &dst, CopyType ctype)
void copy_inplace(const array &src, array &dst, CopyType ctype)
CopyType
Definition copy.h:10