clean up nan handling in transcendental (#7332)

* clean up nan handling in transcendental

* skip remu crash
This commit is contained in:
chenyu
2024-10-28 16:21:49 -04:00
committed by GitHub
parent 75dcd98e79
commit 0843734927
2 changed files with 12 additions and 11 deletions

View File

@@ -1,11 +1,10 @@
import time, math, unittest
import time, math, unittest, functools
import numpy as np
from typing import List, Callable
import torch
from tinygrad.helpers import getenv, IMAGE, DEBUG, CI, Context
from tinygrad.helpers import getenv, IMAGE, DEBUG, CI, Context, TRANSCENDENTAL
from tinygrad import Tensor, Device, dtypes
from tinygrad.tensor import _to_np_dtype
import functools
if CI:
import warnings
@@ -605,6 +604,7 @@ class TestOps(unittest.TestCase):
def test_abs_exact(self):
helper_test_op(None, torch.abs, Tensor.abs, vals=[[-1.,0,1]])
@unittest.skipIf(TRANSCENDENTAL and Device.DEFAULT=="AMD", "TODO: remu crashes")
def test_log(self):
helper_test_op([(45,65)], torch.log, Tensor.log)
helper_test_op(None, torch.log, Tensor.log, vals=[[math.inf, -math.inf, math.nan]])
@@ -614,6 +614,7 @@ class TestOps(unittest.TestCase):
helper_test_op(None, torch.log2, Tensor.log2, vals=[[math.inf, -math.inf, math.nan]])
helper_test_op([()], torch.log2, Tensor.log2)
@unittest.skipIf(TRANSCENDENTAL and Device.DEFAULT=="AMD", "TODO: remu crashes")
def test_exp(self):
helper_test_op([(45,65)], torch.exp, Tensor.exp)
helper_test_op(None, torch.exp, Tensor.exp, vals=[[math.inf, -math.inf, math.nan]])