fix layer/node topo sort problem (#2433)
fix layer/node topo sort problem (#2433)

* fix layer/node topo sort problem

* fix to only iterate over valid layer/node keys

kemaswill/keras,nebw/keras,DeepGnosis/keras,kuza55/keras,dolaameng/keras,keras-team/keras,relh/keras,keras-team/keras