Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions paconvert/global_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@ class GlobalManager:
"torch.cosh",
"torch.frac",
"torch.Tensor.diag",
"torch.std",
"torch.Tensor.std",
# lijialin
"torch.group_norm",
"torch.layer_norm",
Expand Down
11 changes: 11 additions & 0 deletions tests/test_Tensor_std.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,14 @@ def test_case_6():
"""
)
obj.run(pytorch_code, ["result"])


def test_case_7():
pytorch_code = textwrap.dedent(
"""
import torch
input = torch.tensor([[1.4907, 1.0593, 1.5696], [1.4907, 1.0593, 1.5696]])
result = input.std(keepdim=True, correction=0, dim=1)
"""
)
obj.run(pytorch_code, ["result"])
22 changes: 22 additions & 0 deletions tests/test_std.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,25 @@ def test_case_9():
"""
)
obj.run(pytorch_code, ["result"])


def test_case_10():
pytorch_code = textwrap.dedent(
"""
import torch
input = torch.tensor([[1.4907, 1.0593, 1.5696], [1.4907, 1.0593, 1.5696]])
result = torch.std(unbiased=False, dim=1, input=input, keepdim=True)
"""
)
obj.run(pytorch_code, ["result"])


def test_case_11():
pytorch_code = textwrap.dedent(
"""
import torch
args = (torch.tensor([[1.4907, 1.0593, 1.5696], [1.4907, 1.0593, 1.5696]]), 1, False, True)
result = torch.std(*args)
"""
)
obj.run(pytorch_code, ["result"])