/
vuron
/
adept
Обзор
Документация
Войти
/
vuron
/
adept
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
with_cpu
src/dispatch/tensor_creation.hpp
29 строк
1 KB
kolkir
Init functions and checks
31 янв 2025, 19:22
31 янв 2025, 19:22
dd55f61
Код
Авторство
О чём код?
#pragma once #include <adept/dispatch/dispatcher.hpp> #include <adept/tensor.hpp> namespace adept { inline Tensor make_empty_tensor(const TensorProperties& props) { static auto& func = Dispatcher::instance().find("make_empty_tensor"); return Dispatcher::instance().call<Tensor, const TensorProperties&>(func, props); } inline Tensor make_tensor_from_blob(const void* data, const TensorProperties& props) { static auto& func = Dispatcher::instance().find("make_tensor_from_blob"); return Dispatcher::instance().call<Tensor, const void*, const TensorProperties&>(func, data, props); } inline Tensor clone_tensor(const Tensor& tensor) { static auto& func = Dispatcher::instance().find("clone_tensor"); return Dispatcher::instance().call<Tensor, const Tensor&>(func, tensor); } inline Tensor stack_tensors(const std::vector<Tensor>& tensors) { static auto& func = Dispatcher::instance().find("stack_tensors"); return Dispatcher::instance().call<Tensor, const std::vector<Tensor>&>(func, tensors); } } // namespace adept