mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-06 21:32:08 +08:00
dd778596b7
date: 2025-03-15T21:10:51 master commit: fb7b9c0f9420d228f03362970ebcfb7237095cf3
10 lines
370 B
Python
10 lines
370 B
Python
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)
|