def build_step(self, signals):
time = signals.time if self.time_input else []
inputs = ([] if self.input_data is None
else signals.gather(self.input_data))
with tf.device("/cpu:0"):
node_outputs = tf.py_func(
self.merged_func, [time, inputs], self.output_dtype,
name=self.merged_func.__name__)
node_outputs.set_shape(self.output_shape)
if self.output_data is not None:
signals.scatter(self.output_data, node_outputs)
# note: we only need to run the node for side effects, not the
# assignment operator. if the result of the assignment is actually
# used anywhere, then it will be run as part of the normal graph.
return node_outputs
评论列表
文章目录