SetDiff1D
tensorflow C++ API
Computes the difference between two lists of numbers or strings.
Summary
Given a listx
and a listy
, this operation returns a listout
that represents all values that are inx
but not iny
. The returned listout
is sorted in the same order that the numbers appear inx
(duplicates are preserved). This operation also returns a listidx
that represents the position of eachout
element inx
. In other words:
out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]
For example, given this input:
``` x = [1, 2, 3, 4, 5, 6] y = [1, 3, 5] ```
This operation would return:
``` out ==> [2, 4, 6] idx ==> [1, 3, 5] ```
Arguments:
- scope: A Scope object
- x: 1-D. Values to keep.
- y: 1-D. Values to remove.
Returns:
Output
out: 1-D. Values present inx
but not iny
.Output
idx: 1-D. Positions ofx
values preserved inout
.
SetDiff1D block
Source link :https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_array_ops.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
- Input x: 1-D. Values to keep.
- Input y: 1-D. Values to remove.
- SetDiff1D::Attrs attrs
- out_idx : The type of idx tensor.(DT_INT32, DT_INT64, DT_FLOAT, DT_DOUBLE….. etc)
Output:
- Output out: Output object of SetDiff1D class object.
- Output idx: Output object of SetDiff1D class object.
Result:
- std::vector(Tensor)
result_out
: 1-D. Values present inx
but not iny
. - std::vector(Tensor)
result_idx
: 1-D. Positions ofx
values preserved inout
.
Using Method
※ x의 value에서 y에 있는 value와 같은 값을 지워버린다. out은 y에 해당하는 값을 지우고 남은 x이고, idx는 남아있는 x값이 y에 의해 지워지기 전의 index값을 나열한 것이다.