/
vuron
/
adept
Обзор
Документация
Войти
/
vuron
/
adept
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
with_cpu
src/autograd/variable.cpp
32 строки
911 B
kolkir
Adam optimizer implementation
01 мар 2025, 17:03
01 мар 2025, 17:03
2fcc751
Код
Авторство
О чём код?
#include <adept/autograd/variable.hpp> namespace adept { std::ostream& operator<<(std::ostream& stream, const Variable& node) { if (node.impl_) { if (!node.impl_->op_name_.empty()) { stream << "op: " << node.impl_->op_name_ << "\n"; } stream << "requires grad: " << (node.requires_grad() ? "true" : "false") << "\n"; if (node.impl_->data_.defined()) stream << "data shape: " << node.impl_->data_.properties().shape << "\n"; if (node.impl_->grad_.defined()) stream << "grad shape: " << node.impl_->grad_.properties().shape << "\n"; if (node.impl_->data_.defined()) stream << "data: " << node.impl_->data_ << "\n"; if (node.impl_->grad_.defined()) stream << "grad: " << node.impl_->grad_ << "\n"; } return stream; } std::string Variable::to_string() const { std::stringstream out; out << *this; return out.str(); } } // namespace adept