Why do you pass dtype='float32'? This can be dangerous, but as we won't implement other dtype, it is not very important.

You could pass dtype=node.outputs[0].type.dtype