Skip to content
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/webapp/metrics/views/card_renderer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ tf_ng_module(
"//tensorboard/webapp/metrics/store",
"//tensorboard/webapp/metrics/views:types",
"//tensorboard/webapp/metrics/views:utils",
"//tensorboard/webapp/metrics/views/main_view:common_selectors",
"//tensorboard/webapp/runs/store:types",
"//tensorboard/webapp/types",
"//tensorboard/webapp/types:ui",
Expand Down Expand Up @@ -379,6 +380,7 @@ tf_ts_library(
"//tensorboard/webapp/metrics/actions",
"//tensorboard/webapp/metrics/data_source",
"//tensorboard/webapp/metrics/store",
"//tensorboard/webapp/metrics/views/main_view:common_selectors",
"//tensorboard/webapp/runs/store:testing",
"//tensorboard/webapp/runs/store:types",
"//tensorboard/webapp/testing:mat_icon",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
import {
getCardPinnedState,
getCardStateMap,
getCurrentRouteRunSelection,
getDarkModeEnabled,
getExperimentIdForRunId,
getExperimentIdToExperimentAliasMap,
Expand All @@ -57,6 +56,7 @@ import {
getMetricsCardRangeSelectionEnabled,
getRun,
getRunColorMap,
getCurrentRouteRunSelection,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this get moved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it and reimported it and expected prettier to put it in the same place 🤷
Something definitely seems off with prettier lately

} from '../../../selectors';
import {DataLoadState} from '../../../types/data';
import {
Expand Down Expand Up @@ -94,6 +94,7 @@ import {
RunToSeries,
} from '../../store';
import {CardId, CardMetadata, HeaderEditInfo, XAxisType} from '../../types';
import {getFilteredRenderableRunsIdsFromRoute} from '../main_view/common_selectors';
import {CardRenderer} from '../metrics_view_types';
import {getTagDisplayName} from '../utils';
import {DataDownloadDialogContainer} from './data_download_dialog_container';
Expand All @@ -115,8 +116,6 @@ import {
TimeSelectionView,
} from './utils';

const DEFAULT_MIN = -Infinity;
const DEFAULT_MAX = Infinity;
type ScalarCardMetadata = CardMetadata & {
plugin: PluginType.SCALARS;
};
Expand Down Expand Up @@ -502,6 +501,7 @@ export class ScalarCardContainer implements CardRenderer, OnInit, OnDestroy {
}),
combineLatestWith(
this.store.select(getCurrentRouteRunSelection),
this.store.select(getFilteredRenderableRunsIdsFromRoute),
this.store.select(getRunColorMap),
this.store.select(getMetricsScalarSmoothing)
),
Expand All @@ -510,55 +510,67 @@ export class ScalarCardContainer implements CardRenderer, OnInit, OnDestroy {
// debounce by a microtask to emit only single change for the runs
// store change.
debounceTime(0),
map(([namedPartitionedSeries, runSelectionMap, colorMap, smoothing]) => {
const metadataMap: ScalarCardSeriesMetadataMap = {};
const shouldSmooth = smoothing > 0;
map(
([
namedPartitionedSeries,
runSelectionMap,
renderableRuns,
colorMap,
smoothing,
]) => {
const metadataMap: ScalarCardSeriesMetadataMap = {};
const shouldSmooth = smoothing > 0;

for (const partitioned of namedPartitionedSeries) {
const {
seriesId,
runId,
displayName,
alias,
partitionIndex,
partitionSize,
} = partitioned;

metadataMap[seriesId] = {
type: SeriesType.ORIGINAL,
id: seriesId,
alias,
displayName:
partitionSize > 1
? `${displayName}: ${partitionIndex}`
: displayName,
visible: Boolean(
runSelectionMap &&
runSelectionMap.get(runId) &&
renderableRuns.has(runId)
),
color: colorMap[runId] ?? '#fff',
aux: false,
opacity: 1,
};
}

if (!shouldSmooth) {
return metadataMap;
}

for (const [id, metadata] of Object.entries(metadataMap)) {
const smoothedSeriesId = getSmoothedSeriesId(id);
metadataMap[smoothedSeriesId] = {
...metadata,
id: smoothedSeriesId,
type: SeriesType.DERIVED,
aux: false,
originalSeriesId: id,
};

for (const partitioned of namedPartitionedSeries) {
const {
seriesId,
runId,
displayName,
alias,
partitionIndex,
partitionSize,
} = partitioned;

metadataMap[seriesId] = {
type: SeriesType.ORIGINAL,
id: seriesId,
alias,
displayName:
partitionSize > 1
? `${displayName}: ${partitionIndex}`
: displayName,
visible: Boolean(runSelectionMap && runSelectionMap.get(runId)),
color: colorMap[runId] ?? '#fff',
aux: false,
opacity: 1,
};
}
metadata.aux = true;
metadata.opacity = 0.25;
}

if (!shouldSmooth) {
return metadataMap;
}

for (const [id, metadata] of Object.entries(metadataMap)) {
const smoothedSeriesId = getSmoothedSeriesId(id);
metadataMap[smoothedSeriesId] = {
...metadata,
id: smoothedSeriesId,
type: SeriesType.DERIVED,
aux: false,
originalSeriesId: id,
};

metadata.aux = true;
metadata.opacity = 0.25;
}

return metadataMap;
}),
),
startWith({} as ScalarCardSeriesMetadataMap)
);

Expand Down
Loading