Where3
tensorflow C++ API
Computes the sum along segments of a tensor.
Summary
Thex
, andy
tensors must all have the same shape, and the output will also have that shape.
Thecondition
tensor must be a scalar ifx
andy
are scalars. Ifx
andy
are vectors or higher rank, thencondition
must be either a scalar, a vector with size matching the first dimension ofx
, or must have the same shape asx
.
Thecondition
tensor acts as a mask that chooses, based on the value at each element, whether the corresponding element / row in the output should be taken fromx
(if true) ory
(if false).
Ifcondition
is a vector andx
andy
are higher rank matrices, then it chooses which row (outer dimension) to copy fromx
andy
. Ifcondition
has the same shape asx
andy
, then it chooses which element to copy fromx
andy
.
For example:
```python 'condition' tensor is [[True, False]
[False, True]]
't' is [[1, 2],[3, 4]]
'e' is [[5, 6],[7, 8]]
select(condition, t, e) # => [[1, 6], [7, 4]]
'condition' tensor is [True, False]
't' is [[1, 2],[3, 4]]
'e' is [[5, 6],[7, 8]]
select(condition, t, e) ==> [[1, 2], [7, 8]]
```
Arguments:
- scope: A Scope object
- x: = A
Tensor
which may have the same shape ascondition
. Ifcondition
is rank 1,x
may have higher rank, but its first dimension must match the size ofcondition
. - y: = A
Tensor
with the same type and shape asx
.
Returns:
Constructor
- Where3(const ::tensorflow::Scope & scope, ::tensorflow::Input condition, ::tensorflow::Input x, ::tensorflow::Input y)
Public attributes
- tensorflow::Output output.
Where3 block
Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_math.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.).
- Input condition : connect Input node.
- Input x : connect Input node.
- Input y : connect Input node.
Return:
- Output output: Output object of Where3 class object.
Result:
- std::vector(Tensor) product_result : Returned object of executed result by calling session.