Skip test that requires lru if device's allocator isn't lru (#10003)

This commit is contained in:
uuuvn 2025-04-23 20:12:56 +05:00 committed by GitHub
commit 0730ff0e50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,7 +1,7 @@
import unittest
import numpy as np
from tinygrad import Device, dtypes, Tensor, Context
from tinygrad.device import is_dtype_supported
from tinygrad.device import LRUAllocator, is_dtype_supported
from tinygrad.dtype import ImageDType
from tinygrad.engine.realize import lower_schedule
from tinygrad.helpers import prod, unwrap
@ -91,6 +91,7 @@ class TestImageDType(unittest.TestCase):
imgv = it.numpy()
np.testing.assert_equal(np.maximum(imgv[:, 0], 0), it[:, 0].relu().numpy())
@unittest.skipUnless(isinstance(Device.default.allocator, LRUAllocator), "Requires LRU")
def test_lru_alloc(self):
data = Tensor.randn(9*27*4).realize()
it = data.cast(dtypes.imagef((9,27,4))).realize()