我所能夠將張量流適用於二維張量的每個元素,例如Tensorflow適用於二維張量的每個元素
input = tf.Variable([[1.0, 2.0], [3.0, 4.0])
myCustomOp = ... # some kind of custom op that operates on 1D tensors
finalResult = tf.[thing I'm after](input, myCustomOp)
# when run final result should look like: [myCustomOp([1.0, 2.0]), myCustomOp([3.0, 4.0)]
任何想法?
也許'map_fn'? Docs - https://github.com/tensorflow/tensorflow/blob/5688f5bc27e65886ca84ea4a9d58f4bb7701964b/tensorflow/g3doc/api_docs/python/control_flow_ops.md#tfmap_fnfn-elems-dtypenone-parallel_iterations10-back_proptrue-swap_memoryfalse-namenone-map_fn –