/
vuron
/
adept
Обзор
Документация
Войти
/
vuron
/
adept
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
with_cpu
tests/print_tests.cpp
39 строк
737 B
kolkir
Change cpp namespace to adept
25 дек 2024, 23:44
25 дек 2024, 23:44
98bddc4
Код
Авторство
О чём код?
#include <adept/tensor.hpp> #include <adept/tensor_print.hpp> #include <sstream> #include <string> #include "catch.hpp" using namespace adept; const static std::string str444 = R""""(shape:[4, 4, 4], dtype:Int32, device:CPU [[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]] )""""; TEST_CASE("Check tensor print", "[tensor]") { auto a = Tensor::zero({.shape = {4, 4, 4}, .device = device_t::CPU, .dtype = dtype_t::Int32}); std::stringstream buf; buf << a; auto a_str = buf.str(); REQUIRE(str444 == a_str); }