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

torch.mul — PyTorch 2.7 documentation

torch.mul
torch.mul(input, other, *, out=None) Tensor

Multiplies input by other.

out i = input i × other i \text{out}_i = \text{input}_i \times \text{other}_i outi=inputi×otheri

Supports broadcasting to a common shape, type promotion, and integer, float, and complex inputs.

Parameters
  • input (Tensor) – the input tensor.

  • other (Tensor or Number) –

Keyword Arguments

out (Tensor, optional) – the output tensor.

Examples:

>>> a = torch.randn(3)
>>> a
tensor([ 0.2015, -0.4255,  2.6087])
>>> torch.mul(a, 100)
tensor([  20.1494,  -42.5491,  260.8663])

>>> b = torch.randn(4, 1)
>>> b
tensor([[ 1.1207],
        [-0.3137],
        [ 0.0700],
        [ 0.8378]])
>>> c = torch.randn(1, 4)
>>> c
tensor([[ 0.5146,  0.1216, -0.5244,  2.2382]])
>>> torch.mul(b, c)
tensor([[ 0.5767,  0.1363, -0.5877,  2.5083],
        [-0.1614, -0.0382,  0.1645, -0.7021],
        [ 0.0360,  0.0085, -0.0367,  0.1567],
        [ 0.4312,  0.1019, -0.4394,  1.8753]])

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