mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Use random inputs for mps extension tests (#104597)
The tested function simply adds `x` and `y`, given this fact, using random inputs instead of zeros makes more sense. Pull Request resolved: https://github.com/pytorch/pytorch/pull/104597 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
6bfd507c15
commit
ac9c2aa6ee
@ -90,8 +90,8 @@ class TestCppExtensionAOT(common.TestCase):
|
||||
import torch_test_cpp_extension.mps as mps_extension
|
||||
|
||||
tensor_length = 100000
|
||||
x = torch.zeros(tensor_length, device="cpu", dtype=torch.float32)
|
||||
y = torch.zeros(tensor_length, device="cpu", dtype=torch.float32)
|
||||
x = torch.randn(tensor_length, device="cpu", dtype=torch.float32)
|
||||
y = torch.randn(tensor_length, device="cpu", dtype=torch.float32)
|
||||
|
||||
cpu_output = mps_extension.get_cpu_add_output(x, y)
|
||||
mps_output = mps_extension.get_mps_add_output(x.to("mps"), y.to("mps"))
|
||||
|
Reference in New Issue
Block a user