@@ -1070,35 +1070,39 @@ export function build(
1070
1070
attr : [ ] ,
1071
1071
} ) ;
1072
1072
1073
- // Makes an OpNode out of either an input_arg of a library
1074
- // function.
1075
- let currentInputIndex = 0 ;
1076
- const processInput = ( arg ) => {
1077
- const opNode = processRawNode ( {
1078
- name : functionNodeName + NAMESPACE_DELIM + arg . name ,
1079
- input : [ ] ,
1080
- device : '' ,
1081
- op : 'input_arg' ,
1082
- attr : [ {
1083
- key : 'T' ,
1084
- value : {
1085
- type : arg . type ,
1086
- } ,
1087
- } ] ,
1088
- } ) ;
1089
- opNode . functionInputIndex = currentInputIndex ;
1090
- currentInputIndex ++ ;
1091
- } ;
1092
-
1093
- // Make nodes for input args of the function. Unfortunately, the
1094
- // pbtxt configuration language is not rich enough to
1095
- // differentiate between an array with 1 item vs 1 object property.
1096
- if ( func . signature . input_arg [ 'name' ] ) {
1097
- // There is only 1 input arg.
1098
- processInput ( func . signature . input_arg ) ;
1099
- } else {
1100
- // There are several input args.
1101
- _ . each ( func . signature . input_arg , processInput ) ;
1073
+ // If the function has inputs, make nodes out of them.
1074
+ if ( func . signature . input_arg ) {
1075
+ // Makes an OpNode out of either an input_arg of a library
1076
+ // function.
1077
+ let currentInputIndex = 0 ;
1078
+ const processInput = ( arg ) => {
1079
+ const opNode = processRawNode ( {
1080
+ name : functionNodeName + NAMESPACE_DELIM + arg . name ,
1081
+ input : [ ] ,
1082
+ device : '' ,
1083
+ op : 'input_arg' ,
1084
+ attr : [ {
1085
+ key : 'T' ,
1086
+ value : {
1087
+ type : arg . type ,
1088
+ } ,
1089
+ } ] ,
1090
+ } ) ;
1091
+ opNode . functionInputIndex = currentInputIndex ;
1092
+ currentInputIndex ++ ;
1093
+ } ;
1094
+
1095
+ // Make nodes for input args of the function. Unfortunately, the
1096
+ // pbtxt configuration language is not rich enough to
1097
+ // differentiate between an array with 1 item vs 1 object
1098
+ // property.
1099
+ if ( func . signature . input_arg [ 'name' ] ) {
1100
+ // There is only 1 input arg.
1101
+ processInput ( func . signature . input_arg ) ;
1102
+ } else {
1103
+ // There are several input args.
1104
+ _ . each ( func . signature . input_arg , processInput ) ;
1105
+ }
1102
1106
}
1103
1107
1104
1108
// Make nodes for output args of the function. Track the names of
@@ -1107,17 +1111,22 @@ export function build(
1107
1111
// node_defs of the library function.
1108
1112
let currentOutputIndex = 0 ;
1109
1113
const outputArgNames = { } ;
1110
- const processOutput = arg => {
1111
- outputArgNames [ functionNodeName + NAMESPACE_DELIM + arg . name ] =
1112
- currentOutputIndex ;
1113
- currentOutputIndex ++ ;
1114
- } ;
1115
- if ( func . signature . output_arg [ 'name' ] ) {
1116
- // There is only 1 output arg.
1117
- processOutput ( func . signature . output_arg ) ;
1118
- } else {
1119
- // There are several output args.
1120
- _ . each ( func . signature . output_arg , processOutput ) ;
1114
+
1115
+ // If the function has outputs, make nodes out of them.
1116
+ if ( func . signature . output_arg ) {
1117
+ const processOutput = arg => {
1118
+ outputArgNames [
1119
+ functionNodeName + NAMESPACE_DELIM + arg . name ] =
1120
+ currentOutputIndex ;
1121
+ currentOutputIndex ++ ;
1122
+ } ;
1123
+ if ( func . signature . output_arg [ 'name' ] ) {
1124
+ // There is only 1 output arg.
1125
+ processOutput ( func . signature . output_arg ) ;
1126
+ } else {
1127
+ // There are several output args.
1128
+ _ . each ( func . signature . output_arg , processOutput ) ;
1129
+ }
1121
1130
}
1122
1131
1123
1132
_ . each ( func . node_def , rawNode => {
0 commit comments