~magnusmorton/delayrepay

ref: e717043df8564034c25616beb20e4878f4fc0641 delayrepay/delayrepay/cpu.py -rw-r--r-- 460 bytes
e717043d — Magnus Morton renamed run_gpu; added __matmul__ 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from .visitor import Visitor


class CpuVisitor(Visitor):
    def visit_NPArray(self, node):
        return node.array

    def visit_Scalar(self, node):
        return node.val

    def visit_UnaryFuncEx(self, node):
        return node.func(*self.visit(node.children))

    def visit_BinaryFuncEx(self, node):
        return node.func(*self.visit(node.children))

    def visit_BinaryNumpyEx(self, node):
        return node.func(*self.visit(node.children))