コーヒー買ってきて☕
*メモ:
fmod() は、0 個以上の要素の 0D または複数の D テンソル、または 0 個以上の要素の 0D またはそれ以上の D テンソルの 2 つと、スカラー。以下に示すように、0 個以上の要素の 0D またはそれ以上の D テンソルを取得します。
*メモ:
import torch tensor1 = torch.tensor([9, 7, 6]) tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]]) torch.fmod(input=tensor1, other=tensor2) tensor1.fmod(other=tensor2) # tensor([[1, 3, 0], [1, 2, 1]]) torch.fmod(input=tensor1, other=4) # tensor([1, 3, 2]) tensor1 = torch.tensor([-9, -7, -6]) tensor2 = torch.tensor([[4, -4, 3], [-2, 5, -5]]) torch.fmod(input=tensor1, other=tensor2) # tensor([[-1, -3, 0], [-1, -2, -1]]) torch.fmod(input=tensor1, other=4) # tensor([-1, -3, -2]) tensor1 = torch.tensor([9.75, 7.08, 6.26]) tensor2 = torch.tensor([[4.26, -4.54, 3.37], [-2.16, 5.43, -5.98]]) torch.fmod(input=tensor1, other=tensor2) # tensor([[1.2300, 2.5400, 2.8900], [1.1100, 1.6500, 0.2800]]) torch.fmod(input=tensor1, other=4.26) # tensor([1.2300, 2.8200, 2.0000])
以上がPyTorch の fmodの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。