Skip to content

Commit 9548f54

Browse files
qiuminxujart
authored andcommitted
Fix TPU utilization metrics for fusion expansion (#735)
1 parent cb525a7 commit 9548f54

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

tensorboard/plugins/profile/tf_op_profile/tf-op-profile.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
}
4444
</style>
4545
<div class="tf-op-profile">
46-
<h4>Overall TPU utilization is
46+
<h4>Overall TPU FLOPS utilization is
4747
<span style$="color:[[_textColor(_root)]]">[[_utilizationPercent(_root)]]</span>
4848
</h4>
4949
<p>Modifying your model's architecture, data dimensions, and improving the

tensorboard/plugins/profile/tf_op_profile/tf-op-table.html

+9-4
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
on-mouseleave="_handleHeaderMouseLeave"
199199
hidden="[[!level]]">
200200
<div id="bar" style$="width:{{_barWidth(node)}}"></div>
201-
<span id="time">{{_percent(node.metrics.time)}}</span>
201+
<span id="time">{{_percent(node)}}</span>
202202
<span id="name" style$="padding-left:[[level]]em;">
203203
<span id="disclosure">
204204
<span hidden="[[!node.children.length]]">
@@ -208,7 +208,8 @@
208208
</span>{{node.name}}
209209
</span>
210210
<span id="provenance">{{_provenance(node)}}&nbsp;</span>
211-
<span id="utilization" style$="background-color:{{_flameColor(node)}}">
211+
<span id="utilization" hidden="[[!node.metrics]]"
212+
style$="background-color:{{_flameColor(node)}}">
212213
{{_utilization(node)}}</span>
213214
</div>
214215
<template is="dom-if" if="[[expanded]]">
@@ -274,7 +275,10 @@
274275
},
275276
_handleHeaderMouseEnter: function(e) { this.headerHover(this); },
276277
_handleHeaderMouseLeave: function(e) { this.headerHover(null); },
277-
_percent: percent,
278+
_percent: function(node) {
279+
return (node.metrics && node.metrics.time)
280+
? percent(node.metrics.time) : "";
281+
},
278282
_provenance: function(node) {
279283
return (node.xla && node.xla.provenance)
280284
? node.xla.provenance.replace(/^.*\//, '') : "";
@@ -286,7 +290,8 @@
286290
return flameColor(utilization(node), 1, 0.2);
287291
},
288292
_barWidth: function(node) {
289-
return percent(node.metrics.time);
293+
return (node.metrics && node.metrics.time)
294+
? percent(node.metrics.time) : 0;
290295
},
291296
_selectedChanged: function(v) { this.classList.toggle('selected', v); }
292297
});

0 commit comments

Comments
 (0)