mirror of
https://github.com/marian-nmt/marian.git
synced 2024-11-05 09:40:15 +03:00
debug
This commit is contained in:
parent
2a9d3de35a
commit
bcba5e171c
@ -13,7 +13,17 @@ struct BinaryNodeOp : public Node {
|
||||
: Node(args...), a_(a), b_(b) {}
|
||||
|
||||
void backward_numeric() {
|
||||
using namespace std;
|
||||
cerr << "BinaryNodeOp::" << typeid(*this).name() << "::backward_numeric" << endl;
|
||||
cerr << "BEFORE:" << endl;
|
||||
cerr << "a_->grad()=" << a_->grad().Debug() << endl;
|
||||
cerr << "b_->grad()=" << b_->grad().Debug() << endl;
|
||||
cerr << "adj_=" << adj_.Debug() << endl;
|
||||
backward();
|
||||
cerr << "AFTER:" << endl;
|
||||
cerr << "a_->grad()=" << a_->grad().Debug() << endl;
|
||||
cerr << "b_->grad()=" << b_->grad().Debug() << endl;
|
||||
cerr << "adj_=" << adj_.Debug() << endl;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -12,7 +12,15 @@ struct UnaryNodeOp : public Node {
|
||||
args...), a_(a) {}
|
||||
|
||||
void backward_numeric() {
|
||||
using namespace std;
|
||||
cerr << "BinaryNodeOp::" << typeid(*this).name() << "::backward_numeric" << endl;
|
||||
cerr << "BEFORE:" << endl;
|
||||
cerr << "a_->grad()=" << a_->grad().Debug() << endl;
|
||||
cerr << "adj_=" << adj_.Debug() << endl;
|
||||
backward();
|
||||
cerr << "AFTER:" << endl;
|
||||
cerr << "a_->grad()=" << a_->grad().Debug() << endl;
|
||||
cerr << "adj_=" << adj_.Debug() << endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
13
src/tensor.h
13
src/tensor.h
@ -405,17 +405,12 @@ class Tensor {
|
||||
*/
|
||||
std::string Debug() const
|
||||
{
|
||||
if (!pimpl_) {
|
||||
return "Not yet set";
|
||||
}
|
||||
else {
|
||||
return pimpl_->Debug();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print Tensor data on CPU (?) (const).
|
||||
*/
|
||||
void Print() const {
|
||||
for (int i = 0; i < size(); ++i) {
|
||||
std::cerr << (*this)[i] << " ";
|
||||
}
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
//void Load(const std::string &path);
|
||||
|
Loading…
Reference in New Issue
Block a user