@@ -5,7 +5,6 @@ function demo() {
55 tensorOrders : { } ,
66 error : "" ,
77 indices : [ ] ,
8- accesses : [ ]
98 } ,
109 schedule : [ ] ,
1110 output : {
@@ -31,7 +30,9 @@ function demo() {
3130 }
3231 } ,
3332 updateScheduleView : function ( ) {
33+ console . log ( model . schedule ) ;
3434 model . removeInvalidIndices ( ) ;
35+ model . removeInvalidAccesses ( ) ;
3536 model . scheduleView ( 0 ) ;
3637 } ,
3738 addOutputView : function ( newView ) {
@@ -65,7 +66,6 @@ function demo() {
6566 try {
6667 model . input . tensorOrders = parser . parse ( expression ) ;
6768 model . input . indices = [ ...new Set ( parser_indices . parse ( expression ) ) ] ;
68- model . input . accesses = [ ...new Set ( parser_accesses . parse ( expression ) ) ] ;
6969 model . input . error = "" ;
7070 for ( t in model . input . tensorOrders ) {
7171 if ( model . input . tensorOrders [ t ] < 0 ) {
@@ -126,7 +126,7 @@ function demo() {
126126 } ,
127127 resetSchedule : function ( ) {
128128 model . schedule = [ ] ;
129- model . updateScheduleView ( ) ;
129+ model . updateScheduleView ( ) ;
130130 } ,
131131 addScheduleRow : function ( ) {
132132 model . schedule . push ( { command : "" , parameters : [ ] } ) ;
@@ -209,7 +209,24 @@ function demo() {
209209 }
210210 }
211211 } ,
212+ removeInvalidAccesses : function ( ) {
213+ for ( var row = 0 ; row < model . schedule . length ; ++ row ) {
214+ for ( var index = 0 ; index < model . schedule [ row ] [ "parameters" ] . length ; ++ index ) {
215+ var command = model . schedule [ row ] [ "command" ] ;
216+ var value = model . schedule [ row ] [ "parameters" ] [ index ] ;
217+ if ( model . isParameterType ( command , index , "access dropdown" )
218+ && ! model . input . tensorOrders . hasOwnProperty ( value ) ) {
219+ model . schedule [ row ] [ "parameters" ] [ index ] = "" ;
220+ model . updateInferred ( row , command , index , "" ) ;
221+ }
222+ }
223+ }
224+ } ,
212225 isParameterType : function ( command , index , parameterType ) {
226+ if ( command === "reorder" ) {
227+ return parameterType === "index dropdown" ;
228+ }
229+
213230 return scheduleCommands [ command ] [ index ] && scheduleCommands [ command ] [ index ] [ 0 ] === parameterType ;
214231 } ,
215232 updateInferred : function ( row , command , index , value ) {
@@ -352,7 +369,7 @@ function demo() {
352369 var hideTables = function ( ) {
353370 $ ( "#tblFormats" ) . hide ( ) ;
354371 $ ( "#tblSchedule" ) . hide ( ) ;
355- tblScheduleView . clear ( ) ;
372+ model . resetSchedule ( )
356373 } ;
357374 tblFormatsView . timerEvent = setTimeout ( hideTables , timeout ) ;
358375 } else {
@@ -698,10 +715,13 @@ function demo() {
698715 // a dropdown where user can choose from argument tensors
699716 function accessDropdown ( parameterName , inputId , input ) {
700717 var parameter = dropdown ( parameterName , inputId , input ) ;
701- for ( var access of model . input . accesses ) {
702- parameter += "<li><a>" ;
703- parameter += access ;
704- parameter += "</a></li>" ;
718+ for ( var access in model . input . tensorOrders ) {
719+ if ( model . input . tensorOrders [ access ] > 0
720+ && model . input . expression . indexOf ( access ) > model . input . expression . indexOf ( "=" ) ) {
721+ parameter += "<li><a>" ;
722+ parameter += access ;
723+ parameter += "</a></li>" ;
724+ }
705725 }
706726 parameter += "</ul></div></li>" ;
707727 return parameter ;
@@ -907,7 +927,7 @@ function demo() {
907927
908928 $ ( "#txtExpr" ) . keyup ( function ( ) {
909929 model . setInput ( $ ( "#txtExpr" ) . val ( ) ) ;
910- model . resetSchedule ( ) ;
930+ model . updateScheduleView ( ) ;
911931 } ) ;
912932
913933 var panelKernelsView = {
0 commit comments