Slicing Tensors with the C++ API

966 views
Skip to first unread message

Pablo Rozas Larraondo

unread,
Oct 9, 2016, 7:07:16 AM10/9/16
to Discuss
The Python TensorFlow API provides a method for slicing tensors at any dimension: tf.slice(input_, begin, size, name=None) whereas the C++ API tensorflow::Tensor::Slice(int64 dim0_start, int64 dim0_limit) can only slice in the first dimension.

Does anyone know if there's a way of slicing a Tensor at any given dimension using the C++ API?

Christian S. Perone

unread,
Oct 10, 2016, 8:27:47 AM10/10/16
to Pablo Rozas Larraondo, Discuss

On Sun, Oct 9, 2016 at 8:06 AM, Pablo Rozas Larraondo <p.rozas....@gmail.com> wrote:
The Python TensorFlow API provides a method for slicing tensors at any dimension: tf.slice(input_, begin, size, name=None) whereas the C++ API tensorflow::Tensor::Slice(int64 dim0_start, int64 dim0_limit) can only slice in the first dimension.

Does anyone know if there's a way of slicing a Tensor at any given dimension using the C++ API?

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+unsubscribe@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/CAGOzVwke5_rqDvwCTjeYbQsk-gi0PDjXUD1G0akBOGdbJ%2B_48A%40mail.gmail.com.



--
"Forgive, O Lord, my little jokes on Thee, and I'll forgive Thy great big joke on me."

Andrew Selle

unread,
Oct 10, 2016, 1:23:01 PM10/10/16
to Pablo Rozas Larraondo, Discuss
The Python API is used to build operations. In this case, we have two ops that can be built with the python api
tf.slice and tf.strided_slice. tf.slice will likely be deprecated, tf.strided_slice supports basic indexing semantics. In C++ you should still build TensorFlow graphs that use TensorFlow ops. Functions on Tensor are not ops and don't build graphs, it is the underlying backing data type to Tensors in the graph. Thus, it really doesn't support the same comprehensive functionality that TensorFlow graph ops do.
-A

On Sun, Oct 9, 2016 at 4:07 AM Pablo Rozas Larraondo <p.rozas....@gmail.com> wrote:
The Python TensorFlow API provides a method for slicing tensors at any dimension: tf.slice(input_, begin, size, name=None) whereas the C++ API tensorflow::Tensor::Slice(int64 dim0_start, int64 dim0_limit) can only slice in the first dimension.

Does anyone know if there's a way of slicing a Tensor at any given dimension using the C++ API?




--

You received this message because you are subscribed to the Google Groups "Discuss" group.

To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
Reply all
Reply to author
Forward
0 new messages