diff options
author | Yong Tang <yong.tang.github@outlook.com> | 2017-10-18 09:18:00 -0700 |
---|---|---|
committer | Vijay Vasudevan <vrv@google.com> | 2017-10-18 09:18:00 -0700 |
commit | 139e1e0771faeaa614e3c6672a5c203866ba0176 (patch) | |
tree | 2eaf849d3c2ca5813cc9bc9296cfac243ab7c906 /.gitignore | |
parent | bedfe8ac14bddbf21c5acf80d55abff9df4a7967 (diff) |
Add `int64` axis support for `tf.cumsum` and `tf.cumprod` (#13791)
* Add `int64` axis support for `tf.cumsum` and `tf.cumprod`
This fix adds `int64` axis support for `tf.cumsum` and `tf.cumprod`.
Though `int64` is the registered data type for `axis` (`Tidx`), no
kernel is available.
The issue could be described as:
```
>>> import tensorflow as tf
>>> v = tf.cumsum([1, 2, 3], tf.constant(0, tf.int64))
>>> tf.Session().run(v)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 889, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1120, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1317, in _do_run
options, run_metadata)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1336, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'Cumsum' with these attrs. Registered devices: [CPU], Registered kernels:
device='CPU'; T in [DT_COMPLEX128]; Tidx in [DT_INT32]
device='CPU'; T in [DT_COMPLEX64]; Tidx in [DT_INT32]
device='CPU'; T in [DT_DOUBLE]; Tidx in [DT_INT32]
device='CPU'; T in [DT_FLOAT]; Tidx in [DT_INT32]
device='CPU'; T in [DT_HALF]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT8]; Tidx in [DT_INT32]
device='CPU'; T in [DT_UINT8]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT16]; Tidx in [DT_INT32]
device='CPU'; T in [DT_UINT16]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT32]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT64]; Tidx in [DT_INT32]
[[Node: Cumsum = Cumsum[T=DT_INT32, Tidx=DT_INT64, exclusive=false, reverse=false](Cumsum/x, Const)]]
Caused by op u'Cumsum', defined at:
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/math_ops.py", line 2246, in cumsum
x, axis, exclusive=exclusive, reverse=reverse, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_math_ops.py", line 1370, in cumsum
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2966, in create_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1473, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'Cumsum' with these attrs. Registered devices: [CPU], Registered kernels:
device='CPU'; T in [DT_COMPLEX128]; Tidx in [DT_INT32]
device='CPU'; T in [DT_COMPLEX64]; Tidx in [DT_INT32]
device='CPU'; T in [DT_DOUBLE]; Tidx in [DT_INT32]
device='CPU'; T in [DT_FLOAT]; Tidx in [DT_INT32]
device='CPU'; T in [DT_HALF]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT8]; Tidx in [DT_INT32]
device='CPU'; T in [DT_UINT8]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT16]; Tidx in [DT_INT32]
device='CPU'; T in [DT_UINT16]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT32]; Tidx in [DT_INT32]
device='CPU'; T in [DT_INT64]; Tidx in [DT_INT32]
[[Node: Cumsum = Cumsum[T=DT_INT32, Tidx=DT_INT64, exclusive=false, reverse=false](Cumsum/x, Const)]]
>>>
```
This fix adds the missing kernel.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add test cases for `int64` axis support of `tf.cumsum` and `tf.cumprod`
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Reformat scan_ops.cc with `clang-format -i`
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions