File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ export default class ComputationalGraph {
142
142
}
143
143
let parentinfos = [ ]
144
144
if ( ! inputs ) {
145
- if ( this . _nodes . length > 0 ) {
145
+ if ( layer . calc . length > 0 && this . _nodes . length > 0 ) {
146
146
parentinfos . push ( {
147
147
index : this . _nodes . length - 1 ,
148
148
subscript : null ,
Original file line number Diff line number Diff line change @@ -185,6 +185,14 @@ describe('Computational Graph', () => {
185
185
expect ( graph . nodes [ 1 ] . parents [ 0 ] . subscript ) . toBeNull ( )
186
186
} )
187
187
188
+ test ( 'no input' , ( ) => {
189
+ const graph = new ComputationalGraph ( )
190
+ graph . add ( Layer . fromObject ( { type : 'input' , name : 'a' } ) )
191
+ graph . add ( Layer . fromObject ( { type : 'const' , value : 1 } ) )
192
+
193
+ expect ( graph . nodes [ 1 ] . parents ) . toHaveLength ( 0 )
194
+ } )
195
+
188
196
test ( 'string input' , ( ) => {
189
197
const graph = new ComputationalGraph ( )
190
198
graph . add ( Layer . fromObject ( { type : 'input' } ) , 'in' )
You can’t perform that action at this time.
0 commit comments