A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pytorch.org/docs/stable/generated/torch.take.html below:

torch.take — PyTorch 2.7 documentation

torch.take
torch.take(input, index) Tensor

Returns a new tensor with the elements of input at the given indices. The input tensor is treated as if it were viewed as a 1-D tensor. The result takes the same shape as the indices.

Parameters
  • input (Tensor) – the input tensor.

  • index (LongTensor) – the indices into tensor

Example:

>>> src = torch.tensor([[4, 3, 5],
...                     [6, 7, 8]])
>>> torch.take(src, torch.tensor([0, 2, 5]))
tensor([ 4,  5,  8])
Docs

Access comprehensive developer documentation for PyTorch

View Docs Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials Resources

Find development resources and get your questions answered

View Resources

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4