You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
370 B
9 lines
370 B
import numpy as np
|
|
from tinygrad.helpers import flat_mv
|
|
from tinygrad.device import Compiled, Allocator
|
|
|
|
class NpyAllocator(Allocator):
|
|
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)
|
|
|