diff --git a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/MemoryView.tsx b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/MemoryView.tsx index 304a4ebadeefb7ecac4637e959c5822bfe3c76a0..8ab809412a6d2dc03db0baa947b12e9accaa8ada 100644 --- a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/MemoryView.tsx +++ b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/MemoryView.tsx @@ -314,6 +314,7 @@ export const MemoryView: React.FC = React.memo((props) => { memoryCurveDataAllRef.current = allCurveData setDevice(allCurveData.default_device) setDevices(allCurveData.devices) + setMemoryCurveData(allCurveData.total) setTag('Operator') } else { setMemoryCurveData(resp as MemoryCurveData) @@ -321,16 +322,6 @@ export const MemoryView: React.FC = React.memo((props) => { }) }, [run, worker, span]) - React.useEffect(() => { - if (tag === 'Operator') { - setMemoryCurveData(memoryCurveDataAllRef.current?.total) - setMemoryEventsData(memoryEventDataAllRef.current?.operator) - } else { - setMemoryCurveData(memoryCurveDataAllRef.current?.ptaGe) - setMemoryEventsData(memoryEventDataAllRef.current?.component) - } - }, [memoryCurveDataAllRef.current, tag]) - React.useEffect(() => { if (memoryCurveData !== undefined) { if (deviceTarget === 'Ascend') { @@ -355,8 +346,15 @@ export const MemoryView: React.FC = React.memo((props) => { } const onTagChanged: SelectProps['onChange'] = (event) => { - event.target.value === 'Operator' && setSelectedRange(undefined) setTag(event.target.value as string) + if (event.target.value === 'Operator') { + setMemoryCurveData(memoryCurveDataAllRef.current?.total) + setMemoryEventsData(memoryEventDataAllRef.current?.operator) + setSelectedRange(undefined) + } else { + setMemoryCurveData(memoryCurveDataAllRef.current?.ptaGe) + setMemoryEventsData(memoryEventDataAllRef.current?.component) + } } const onSelectedRangeChanged = (start: number, end: number) => {