-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Debugger Plugin]: Add clickable links to Session.runs table #800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
--> | ||
<dom-module id="tf-session-runs-view"> | ||
<template> | ||
<div id="tensor-data-div" class="tensor-data-div"> | ||
<div class="session-runs-div"> | ||
<div class="section-title">Session Runs</div> | ||
<table id="session-runs-table" align="left" class="session-runs-table"> | ||
<tr align="left"> | ||
|
@@ -43,15 +43,18 @@ | |
:host .indented-level-container .content-container { | ||
margin: 0 0 0 10px; | ||
} | ||
|
||
/* TODO(cais): This needs work: the table shouldn't get too wide when | ||
there are many feeds/fetches/targte names. */ | ||
.session-runs-table { | ||
align-content: left; | ||
align-items: left; | ||
text-align: left; | ||
font-size: 90%; | ||
border-style: solid 1px black; | ||
width: 400px; | ||
table-layout: fixed; | ||
min-width: 400px; | ||
max-width: 450px; | ||
word-break: break-all; | ||
padding-top: 3px; | ||
padding-left: 3px; | ||
|
@@ -66,6 +69,15 @@ | |
background-color: rgb(172, 232, 188); | ||
font-weight: bold; | ||
} | ||
|
||
.node-or-tensor-element { | ||
text-decoration: underline; | ||
cursor: pointer; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional: Add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good suggestion. I did this for all clickable elements currently present in the Debugger Plugin. |
||
} | ||
|
||
.node-or-tensor-element:hover { | ||
color: blue; | ||
} | ||
</style> | ||
</template> | ||
<script> | ||
|
@@ -87,6 +99,9 @@ | |
// breakpoint being active. | ||
soleActive: Boolean, | ||
|
||
// A function called when a node or tensor in the list is clicked. | ||
nodeOrTensorClicked: Function, | ||
|
||
// A map from session.run key to count of how many the session.run's | ||
// execution has started. | ||
_runKey2Count: { | ||
|
@@ -184,12 +199,9 @@ | |
// clickable links, which when clicked, will focus on the corresponding | ||
// node in the Graph View and/or highlight corresponding tensors in the | ||
// Tensor Summary View and the Tensor Value View. | ||
const feedsCell = document.createElement('td'); | ||
feedsCell.textContent = JSON.stringify(sessionRun.feeds); | ||
const fetchesCell = document.createElement('td'); | ||
fetchesCell.textContent = JSON.stringify(sessionRun.fetches); | ||
const targetsCell = document.createElement('td'); | ||
targetsCell.textContent = JSON.stringify(sessionRun.targets); | ||
const feedsCell = this._renderGraphElements(sessionRun.feeds); | ||
const fetchesCell = this._renderGraphElements(sessionRun.fetches); | ||
const targetsCell = this._renderGraphElements(sessionRun.targets); | ||
const numDevicesCell = document.createElement('td'); | ||
numDevicesCell.textContent = numDevices; | ||
const countCell = document.createElement('td'); | ||
|
@@ -211,6 +223,20 @@ | |
|
||
Polymer.dom(this.$$('#session-runs-table')).appendChild(sessionRunRow); | ||
}, | ||
|
||
_renderGraphElements(graphElements) { | ||
const container = document.createElement('td'); | ||
_.forEach(graphElements, element => { | ||
const elementDiv = document.createElement('div'); | ||
elementDiv.textContent = element; | ||
elementDiv.setAttribute('class', 'node-or-tensor-element'); | ||
elementDiv.addEventListener('click', () => { | ||
this.nodeOrTensorClicked(element); | ||
}); | ||
container.appendChild(elementDiv); | ||
}); | ||
return container; | ||
} | ||
}); | ||
</script> | ||
</dom-module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Maybe compute once and reuse value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This computation is pretty cheap. So I'd rather save the space.