Pytorch関数の徹底解説 - torch.maximum

カテゴリ:「よくわかるPytorch関数」総合カタログ
関連記事:
よくわかるPytorch関数——torch.max
よくわかるPytorch関数——torch.maximum


input要素ごとのother合計の最大値を計算します。

文法

torch.maximum(input, other, *, out=None) -> Tensor

パラメータ

  • input:[ Tensor] 入力テンソル
  • other:[ Tensor] 2 番目のテンソル入力

>>> a = torch.randn(4, 5)
>>> b = torch.randn(4, 5)
>>> torch.max(a, b)
tensor([[ 0.9931,  0.3162,  1.7202,  0.2977,  2.4843],
        [ 2.1384,  0.6760,  0.6328, -1.2002,  0.2046],
        [-0.1132,  0.6711,  2.5104,  1.2836, -1.5387],
        [ 0.4333, -0.1055,  2.3136,  1.2815,  0.3704]])

おすすめ

転載: blog.csdn.net/hy592070616/article/details/131882113