Convert to Trace proto into a short readable string.
| 37 | |
| 38 | // Convert to Trace proto into a short readable string. |
| 39 | string GetTraceString(const CallStack::Trace& trace) { |
| 40 | string ntrace(io::Basename(trace.file())); |
| 41 | ntrace += strings::StrCat(":", trace.lineno()); |
| 42 | if (trace.function().length() < 20) { |
| 43 | ntrace += ":" + trace.function(); |
| 44 | } else { |
| 45 | ntrace += ":" + trace.function().substr(0, 17) + "..."; |
| 46 | } |
| 47 | return ntrace; |
| 48 | } |
| 49 | |
| 50 | bool IsGradNode(const string& name, string* forward_name) { |
| 51 | // Given a forward operation with name op, its gradient op has the following |