mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-31 17:58:25 -05:00
as pointed out by #4877, need to add `__init__.py` to trigger pylint. fixed some errors except ops_python (will do in a separate pr, it has a lot of errors), and sub-folders in runtime
10 lines
404 B
Python
10 lines
404 B
Python
import numpy as np
|
|
from tinygrad.helpers import flat_mv
|
|
from tinygrad.device import Compiled, Allocator
|
|
|
|
class NpyAllocator(Allocator): # pylint: disable=abstract-method
|
|
def copyout(self, dest:memoryview, src:np.ndarray): dest[:] = flat_mv(np.require(src, requirements='C').data)
|
|
|
|
class NpyDevice(Compiled):
|
|
def __init__(self, device:str): super().__init__(device, NpyAllocator(), None, None, None)
|