lamppp
Loading...
Searching...
No Matches
memory_ops.hpp
1#pragma once
2
3#include "lamppp/tensor/data_ptr.hpp"
4#include "lamppp/tensor/device_type.hpp"
5#include "lamppp/tensor/dispatch_stub.hpp"
6#include "lamppp/tensor/scalar.hpp"
7
8namespace lmp::tensor {
9class Tensor;
10
11namespace ops {
12
14using copy_fn = void (*)(DeviceType, const void*, void*, size_t, DataType,
15 DataType);
16using empty_fn = detail::DataPtr (*)(size_t);
17using fill_fn = void (*)(void*, size_t, Scalar, DataType type);
18using resize_fn = void (*)(detail::DataPtr, size_t, size_t);
19
20LMP_DECLARE_DISPATCH(copy_fn, copy_stub);
21LMP_DECLARE_DISPATCH(empty_fn, empty_stub);
22LMP_DECLARE_DISPATCH(fill_fn, fill_stub);
23LMP_DECLARE_DISPATCH(resize_fn, resize_stub);
25
33Tensor to(const Tensor& a, DeviceType to_device);
34
35} // namespace lmp::tensor::ops
36}