Skip to content

Commit cb0e399

Browse files
committed
Embedding Projector: fix switching projections
1 parent e5d1771 commit cb0e399

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tensorboard/plugins/projector/vz_projector/vz-projector-projections-panel.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
399399
this.searchByMetadataOptions[Math.max(0, searchByMetadataIndex)];
400400
}
401401
public showTab(id: ProjectionType) {
402-
this.currentProjection = id;
403402
const tab = this.$$('.ink-tab[data-tab="' + id + '"]') as HTMLElement;
404403
const allTabs = this.root?.querySelectorAll('.ink-tab');
405404
if (allTabs) {
@@ -434,19 +433,23 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
434433
if (this.polymerChangesTriggerReprojection === false) {
435434
return;
436435
}
437-
if (projection === 'pca') {
436+
if (this.currentProjection !== projection) {
437+
this.currentProjection = projection;
438438
if (this.dataSet != null) {
439-
this.dataSet.stopTSNE();
439+
if (projection === 'tsne') {
440+
this.dataSet.tSNEShouldPause = false;
441+
} else {
442+
this.dataSet.tSNEShouldPause = true;
443+
}
440444
}
445+
}
446+
if (projection === 'pca') {
441447
this.showPCA();
442448
} else if (projection === 'tsne') {
443449
this.showTSNE();
444450
} else if (projection === 'umap') {
445451
this.showUmap();
446452
} else if (projection === 'custom') {
447-
if (this.dataSet != null) {
448-
this.dataSet.stopTSNE();
449-
}
450453
this.computeAllCentroids();
451454
this.reprojectCustom();
452455
}
@@ -489,6 +492,7 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
489492
(iteration: number) => {
490493
if (iteration != null) {
491494
this.runTsneButton.disabled = false;
495+
this.pauseTsneButton.innerText = 'Pause';
492496
this.pauseTsneButton.disabled = false;
493497
this.iterationLabelTsne.innerText = '' + iteration;
494498
this.projector.notifyProjectionPositionsUpdated();

0 commit comments

Comments
 (0)