新しい高階関数は、ここでは詳述されている:TensorFlowの高階関数 - 使用方法は? TF内
https://www.tensorflow.org/versions/r0.8/api_docs/python/functional_ops.html#map_fn
は特に、マップ機能が便利になります。ここで彼らは、チュートリアルのために書いたものです:
これは、このエラーを与える実行import tensorflow as tf
elems = [1, 2, 3, 4, 5, 6]
squares = tf.map_fn(lambda x: x * x, elems)
:
/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.pyc in make_tensor_proto(values, dtype, shape)
323 else:
324 if values is None:
--> 325 raise ValueError("None values not supported.")
326 # if dtype is provided, forces numpy array to be the type
327 # provided if possible.
ValueError: None values not supported.
、誰もが何が起こっているか知ってい
elems = [1, 2, 3, 4, 5, 6]
squares = map_fn(lambda x: x * x, elems)
# squares == [1, 4, 9, 16, 25, 36]
したがって、私は、空のpythonファイルを作成しました?ありがとう!
編集:私はTensorFlowバージョン0.8を使用しています。
ありがとうございます! 'tf.map_fn()'とその仲間にいくつかのバグがあり、テンソルへの変換が適切に処理されないことが分かります。私は[GitHubの問題](https://github.com/tensorflow/tensorflow/issues/2366)を開いて進行中の修正を持っています。 – mrry
ありがとう!あなたはテンソルを入力としてtf.map_fn()の例を見つけることができるところをどこから知っていますか? – Carl
私はそれが図書館にかなり新しく追加されたと思うので、まだあまり例はありません。私が見つけた唯一のものは[このユニットテスト](https://github.com/tensorflow/tensorflow/blob/f06280b0b8fd4bda35231124186ba3ff7a1f271b/tensorflow/python/kernel_tests/functional_ops_test.py#L65)でした。 – mrry