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.isclose.html below:

torch.isclose — PyTorch 2.7 documentation

torch.isclose
torch.isclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False) Tensor

Returns a new tensor with boolean elements representing if each element of input is “close” to the corresponding element of other. Closeness is defined as:

∣ input i − other i ∣ ≤ rtol × ∣ other i ∣ + atol \lvert \text{input}_i - \text{other}_i \rvert \leq \texttt{rtol} \times \lvert \text{other}_i \rvert + \texttt{atol} inputiotherirtol×otheri+atol

where input and other are finite. Where input and/or other are nonfinite they are close if and only if they are equal, with NaNs being considered equal to each other when equal_nan is True.

Parameters
  • input (Tensor) – first tensor to compare

  • other (Tensor) – second tensor to compare

  • rtol (float, optional) – relative tolerance. Default: 1e-05

  • atol (float, optional) – absolute tolerance. Default: 1e-08

  • equal_nan (bool, optional) – if True, then two NaN s will be considered equal. Default: False

Examples:

>>> torch.isclose(torch.tensor((1., 2, 3)), torch.tensor((1 + 1e-10, 3, 4)))
tensor([ True, False, False])
>>> torch.isclose(torch.tensor((float('inf'), 4)), torch.tensor((float('inf'), 6)), rtol=.5)
tensor([True, True])
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