Skip to content
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

Embedding Projector: fix bookmark projection state #6328

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tensorboard/plugins/projector/vz_projector/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ export class State {
filteredPoints: number[];
/** The indices of selected points. */
selectedPoints: number[] = [];
/** The shuffled indices of points. */
shuffledDataIndices: number[] = [];
/** Camera state (2d/3d, position, target, zoom, etc). */
cameraDef: CameraDef;
/** Color by option. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class BookmarkPanel extends LegacyElementMixin(PolymerElement) {
this.notifyPath(path, selected);
}
/**
* Return an event's to their bookmark index.
* Returns the bookmark index of the event.
*/
private getBookmarkIndex(evt: any) {
return evt.model.__data.index;
Expand Down
5 changes: 5 additions & 0 deletions tensorboard/plugins/projector/vz_projector/vz-projector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ class Projector
state.tSNEIteration = this.dataSet.tSNEIteration;
state.selectedPoints = this.selectedPointIndices;
state.filteredPoints = this.dataSetFilterIndices!;
state.shuffledDataIndices = this.dataSet.shuffledDataIndices;
this.projectorScatterPlotAdapter.populateBookmarkFromUI(state);
state.selectedColorOptionName = this.dataPanel.selectedColorOptionName;
state.forceCategoricalColoring = this.dataPanel.forceCategoricalColoring;
Expand All @@ -674,10 +675,14 @@ class Projector
const point = this.dataSet.points[i];
const projection = state.projections[i];
const keys = Object.keys(projection);
point.projections = {};
for (let j = 0; j < keys.length; ++j) {
point.projections[keys[j]] = projection[keys[j]];
}
}
if (state.shuffledDataIndices) {
this.dataSet.shuffledDataIndices = state.shuffledDataIndices;
}
this.dataSet.hasTSNERun = state.selectedProjection === 'tsne';
this.dataSet.tSNEIteration = state.tSNEIteration;
this.projectionsPanel.restoreUIFromBookmark(state);
Expand Down