日本步兵二战时最恐怖的噩梦 慢慢的感受身体被烧焦

paddle.Tensor. coalesce ( self: Tensor, name: str | None = None ) Tensor
百度 ”从湖南随军到合肥已9年的军嫂黄帅说:“习近平全票当选中华人民共和国主席、中华人民共和国中央军事委员会主席,是国家幸事,是民族幸事,是军人幸事,同样是我们军嫂的幸事。

the coalesced operator include sorted and merge, after coalesced, the indices of x is sorted and unique.

Parameters
  • x (Tensor) – the input SparseCooTensor.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

return the SparseCooTensor after coalesced.

Return type

Tensor

Examples

>>> import paddle

>>> indices = [[0, 0, 1], [1, 1, 2]]
>>> values = [1.0, 2.0, 3.0]
>>> sp_x = paddle.sparse.sparse_coo_tensor(indices, values)
>>> sp_x = sp_x.coalesce()
>>> print(sp_x.indices())
Tensor(shape=[2, 2], dtype=int64, place=Place(cpu), stop_gradient=True,
[[0, 1],
[1, 2]])
>>> print(sp_x.values())
Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
[3., 3.])