@@ -37,87 +37,104 @@ export class ExecutionDataContainer {
3737 @Input ( )
3838 focusedExecutionIndex ! : number ;
3939
40- readonly focusedExecutionData$ = this . store . pipe (
41- select ( getFocusedExecutionData )
42- ) ;
40+ readonly focusedExecutionData$ ;
4341
44- readonly tensorDebugMode$ = this . store . pipe (
45- select (
46- createSelector ( getFocusedExecutionData , ( execution : Execution | null ) => {
47- if ( execution === null ) {
48- return TensorDebugMode . UNSPECIFIED ;
49- } else {
50- return execution . tensor_debug_mode ;
51- }
52- } )
53- )
54- ) ;
42+ readonly tensorDebugMode$ ;
5543
56- readonly hasDebugTensorValues$ = this . store . pipe (
57- select (
58- createSelector ( getFocusedExecutionData , ( execution : Execution | null ) => {
59- if ( execution === null || execution . debug_tensor_values === null ) {
60- return false ;
61- } else {
62- for ( const singleDebugTensorValues of execution . debug_tensor_values ) {
63- if (
64- singleDebugTensorValues !== null &&
65- singleDebugTensorValues . length > 0
66- ) {
67- return true ;
68- }
69- }
70- return false ;
71- }
72- } )
73- )
74- ) ;
44+ readonly hasDebugTensorValues$ ;
45+
46+ readonly debugTensorValues$ ;
7547
76- readonly debugTensorValues$ = this . store . pipe (
77- select (
78- createSelector ( getFocusedExecutionData , ( execution : Execution | null ) => {
79- if ( execution === null ) {
80- return null ;
81- } else {
82- return execution . debug_tensor_values ;
83- }
84- } )
85- )
86- ) ;
48+ readonly debugTensorDtypes$ ;
8749
88- readonly debugTensorDtypes$ = this . store . pipe (
89- select (
90- createSelector (
91- getFocusedExecutionData ,
92- ( execution : Execution | null ) : string [ ] | null => {
93- if ( execution === null || execution . debug_tensor_values === null ) {
94- return null ;
50+ constructor ( private readonly store : Store < State > ) {
51+ this . focusedExecutionData$ = this . store . pipe (
52+ select ( getFocusedExecutionData )
53+ ) ;
54+ this . tensorDebugMode$ = this . store . pipe (
55+ select (
56+ createSelector (
57+ getFocusedExecutionData ,
58+ ( execution : Execution | null ) => {
59+ if ( execution === null ) {
60+ return TensorDebugMode . UNSPECIFIED ;
61+ } else {
62+ return execution . tensor_debug_mode ;
63+ }
9564 }
96- if (
97- execution . tensor_debug_mode !== TensorDebugMode . FULL_HEALTH &&
98- execution . tensor_debug_mode !== TensorDebugMode . SHAPE
99- ) {
100- // TODO(cais): Add logic for other TensorDebugModes with dtype info.
101- return null ;
65+ )
66+ )
67+ ) ;
68+ this . hasDebugTensorValues$ = this . store . pipe (
69+ select (
70+ createSelector (
71+ getFocusedExecutionData ,
72+ ( execution : Execution | null ) => {
73+ if ( execution === null || execution . debug_tensor_values === null ) {
74+ return false ;
75+ } else {
76+ for ( const singleDebugTensorValues of execution . debug_tensor_values ) {
77+ if (
78+ singleDebugTensorValues !== null &&
79+ singleDebugTensorValues . length > 0
80+ ) {
81+ return true ;
82+ }
83+ }
84+ return false ;
85+ }
10286 }
103- const dtypes : string [ ] = [ ] ;
104- for ( const tensorValue of execution . debug_tensor_values ) {
105- if ( tensorValue === null ) {
106- dtypes . push ( UNKNOWN_DTYPE_NAME ) ;
87+ )
88+ )
89+ ) ;
90+ this . debugTensorValues$ = this . store . pipe (
91+ select (
92+ createSelector (
93+ getFocusedExecutionData ,
94+ ( execution : Execution | null ) => {
95+ if ( execution === null ) {
96+ return null ;
10797 } else {
108- const dtypeEnum = String (
109- execution . tensor_debug_mode === TensorDebugMode . FULL_HEALTH
110- ? tensorValue [ 2 ] // tensor_debug_mode: FULL_HEALTH
111- : tensorValue [ 1 ] // tensor_debug_mode: SHAPE
112- ) ;
113- dtypes . push ( DTYPE_ENUM_TO_NAME [ dtypeEnum ] || UNKNOWN_DTYPE_NAME ) ;
98+ return execution . debug_tensor_values ;
11499 }
115100 }
116- return dtypes ;
117- }
101+ )
118102 )
119- )
120- ) ;
121-
122- constructor ( private readonly store : Store < State > ) { }
103+ ) ;
104+ this . debugTensorDtypes$ = this . store . pipe (
105+ select (
106+ createSelector (
107+ getFocusedExecutionData ,
108+ ( execution : Execution | null ) : string [ ] | null => {
109+ if ( execution === null || execution . debug_tensor_values === null ) {
110+ return null ;
111+ }
112+ if (
113+ execution . tensor_debug_mode !== TensorDebugMode . FULL_HEALTH &&
114+ execution . tensor_debug_mode !== TensorDebugMode . SHAPE
115+ ) {
116+ // TODO(cais): Add logic for other TensorDebugModes with dtype info.
117+ return null ;
118+ }
119+ const dtypes : string [ ] = [ ] ;
120+ for ( const tensorValue of execution . debug_tensor_values ) {
121+ if ( tensorValue === null ) {
122+ dtypes . push ( UNKNOWN_DTYPE_NAME ) ;
123+ } else {
124+ const dtypeEnum = String (
125+ execution . tensor_debug_mode === TensorDebugMode . FULL_HEALTH
126+ ? tensorValue [ 2 ] // tensor_debug_mode: FULL_HEALTH
127+ : tensorValue [ 1 ] // tensor_debug_mode: SHAPE
128+ ) ;
129+ dtypes . push (
130+ DTYPE_ENUM_TO_NAME [ dtypeEnum ] || UNKNOWN_DTYPE_NAME
131+ ) ;
132+ }
133+ }
134+ return dtypes ;
135+ }
136+ )
137+ )
138+ ) ;
139+ }
123140}
0 commit comments