MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / FormatNode

Method FormatNode

tensorflow/core/profiler/internal/tfprof_show.cc:148–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148string TFShow::FormatNode(ShowNode* node, const Options& opts) const {
149 std::vector<string> info;
150 if (opts.select.find(kShown[2]) != opts.select.end()) {
151 const string shape = FormatShapes(node->node->shape());
152 if (!shape.empty()) {
153 info.push_back(shape);
154 }
155 string params = FormatNumber(node->proto().total_parameters()) + " params";
156 if (node->account) {
157 params = FormatNumber(node->proto().parameters()) + "/" + params;
158 } else {
159 params = "--/" + params;
160 }
161 info.push_back(params);
162 }
163 if (opts.select.find(kShown[3]) != opts.select.end()) {
164 string fops = FormatNumber(node->proto().total_float_ops()) + " flops";
165 if (node->account) {
166 fops = FormatNumber(node->proto().float_ops()) + "/" + fops;
167 } else {
168 fops = "--/" + fops;
169 }
170 info.push_back(fops);
171 }
172 std::vector<string> attrs;
173 if (opts.select.find(kShown[0]) != opts.select.end()) {
174 info.push_back(FormatNodeMemory(node, node->proto().requested_bytes(),
175 node->proto().total_requested_bytes()));
176 }
177 if (opts.select.find(kShown[11]) != opts.select.end()) {
178 info.push_back(FormatNodeMemory(node, node->proto().peak_bytes(),
179 node->proto().total_peak_bytes()));
180 }
181 if (opts.select.find(kShown[12]) != opts.select.end()) {
182 info.push_back(FormatNodeMemory(node, node->proto().residual_bytes(),
183 node->proto().total_residual_bytes()));
184 }
185 if (opts.select.find(kShown[13]) != opts.select.end()) {
186 info.push_back(FormatNodeMemory(node, node->proto().output_bytes(),
187 node->proto().total_output_bytes()));
188 }
189 if (opts.select.find(kShown[1]) != opts.select.end()) {
190 info.push_back(FormatTotalExecTime(node, opts));
191 info.push_back(FormatAcceleratorExecTime(node, opts));
192 info.push_back(FormatCPUExecTime(node, opts));
193 }
194 if (opts.select.find(kShown[9]) != opts.select.end() &&
195 opts.select.find(kShown[1]) == opts.select.end()) {
196 info.push_back(FormatAcceleratorExecTime(node, opts));
197 }
198 if (opts.select.find(kShown[10]) != opts.select.end() &&
199 opts.select.find(kShown[1]) == opts.select.end()) {
200 info.push_back(FormatCPUExecTime(node, opts));
201 }
202 if (opts.select.find(kShown[5]) != opts.select.end()) {
203 if (node->proto().devices_size() > 0) {
204 info.push_back(absl::StrJoin(node->proto().devices(), "|"));
205 }

Callers

nothing calls this directly

Calls 15

FormatShapesFunction · 0.85
FormatNumberFunction · 0.85
FormatTotalExecTimeFunction · 0.85
PrintfFunction · 0.85
protoMethod · 0.80
input_shapesMethod · 0.80
c_strMethod · 0.80
FormatCPUExecTimeFunction · 0.70
nameMethod · 0.65
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected