|
|
|
@ -46,7 +46,7 @@ struct Formater {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void PrintMessage() { CLOG << std::time(nullptr) << "\t" << message; }
|
|
|
|
|
void PrintMessage() { CLOG << std::time(nullptr) << "\t" << message << "\t"; }
|
|
|
|
|
void PrintName() {
|
|
|
|
|
if (!name.empty()) {
|
|
|
|
|
CLOG << "Tensor[" << name << "]" << std::endl;
|
|
|
|
@ -85,15 +85,16 @@ struct Formater {
|
|
|
|
|
// print float
|
|
|
|
|
if (dtype.hash_code() == typeid(float).hash_code()) {
|
|
|
|
|
Display<float>(size);
|
|
|
|
|
}
|
|
|
|
|
if (dtype.hash_code() == typeid(double).hash_code()) {
|
|
|
|
|
} else if (dtype.hash_code() == typeid(double).hash_code()) {
|
|
|
|
|
Display<double>(size);
|
|
|
|
|
}
|
|
|
|
|
if (dtype.hash_code() == typeid(int).hash_code()) {
|
|
|
|
|
} else if (dtype.hash_code() == typeid(int).hash_code()) {
|
|
|
|
|
Display<int>(size);
|
|
|
|
|
}
|
|
|
|
|
if (dtype.hash_code() == typeid(int64_t).hash_code()) {
|
|
|
|
|
} else if (dtype.hash_code() == typeid(int64_t).hash_code()) {
|
|
|
|
|
Display<int64_t>(size);
|
|
|
|
|
} else if (dtype.hash_code() == typeid(bool).hash_code()) {
|
|
|
|
|
Display<bool>(size);
|
|
|
|
|
} else {
|
|
|
|
|
CLOG << "\tdata: unprintable type: " << dtype.name() << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -182,6 +183,7 @@ class TensorPrintOp : public framework::OperatorBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Formater formater;
|
|
|
|
|
formater.message = Attr<std::string>("message");
|
|
|
|
|
if (Attr<bool>("print_tensor_name")) {
|
|
|
|
|
formater.name = printed_var_name;
|
|
|
|
|
}
|
|
|
|
|