Spec-Zone.ru › PyTorch 1

torch.neg

torch.neg(input, *, out=None) → Tensor

Возвращает новый тензор с отрицанием элементов input.

out=−1×input\text{out} = -1 \times \text{input}
Параметры:

input (Тензор) – входной тензор.

Ключевые аргументы:

out (Тензор, необязательно) – выходной тензор.

Пример:

>>> a = torch.randn(5)
>>> a
tensor([ 0.0090, -0.2262, -0.0682, -0.2866,  0.3940])
>>> torch.neg(a)
tensor([-0.0090,  0.2262,  0.0682,  0.2866, -0.3940])

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/1.13/generated/torch.neg.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API