tf.sets.set_intersection

tf.sets.set_intersection

tf.contrib.metrics.set_intersection

tf.sets.set_intersection

set_intersection(
    a,
    b,
    validate_indices=True
)

Defined in tensorflow/python/ops/sets_impl.py.

See the guide: Metrics (contrib) > Set Ops

Compute set intersection of elements in last dimension of a and b.

All but the last dimension of a and b must match.

Example:

a = [
  [
    [
      [1, 2],
      [3],
    ],
    [
      [4],
      [5, 6],
    ],
  ],
]
b = [
  [
    [
      [1, 3],
      [2],
    ],
    [
      [4, 5],
      [5, 6, 7, 8],
    ],
  ],
]
set_intersection(a, b) = [
  [
    [
      [1],
      [],
    ],
    [
      [4],
      [5, 6],
    ],
  ],
]

Args:

  • a: Tensor or SparseTensor of the same type as b. If sparse, indices must be sorted in row-major order.
  • b: Tensor or SparseTensor of the same type as a. If sparse, indices must be sorted in row-major order.
  • validate_indices: Whether to validate the order and range of sparse indices in a and b.

Returns:

A SparseTensor whose shape is the same rank as a and b, and all but the last dimension the same. Elements along the last dimension contain the intersections.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/sets/set_intersection

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部