mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
parent
cb5702f170
commit
96fcc47e27
2 changed files with 4 additions and 5 deletions
|
|
@ -15,8 +15,8 @@ a = MallocAllocator.alloc(4)
|
|||
b = MallocAllocator.alloc(4)
|
||||
|
||||
# load in some values (little endian)
|
||||
MallocAllocator.copyin(a, bytearray([2,0,0,0]))
|
||||
MallocAllocator.copyin(b, bytearray([3,0,0,0]))
|
||||
MallocAllocator.copyin(a, memoryview(bytearray([2,0,0,0])))
|
||||
MallocAllocator.copyin(b, memoryview(bytearray([3,0,0,0])))
|
||||
|
||||
# compile a program to a binary
|
||||
lib = ClangCompiler().compile("void add(int *out, int *a, int *b) { out[0] = a[0] + b[0]; }")
|
||||
|
|
@ -103,7 +103,7 @@ print(sched[-1].ast)
|
|||
run_schedule(sched)
|
||||
|
||||
# check the data out
|
||||
assert out.realized.as_buffer().cast('I')[0] == 5
|
||||
assert out.realized is not None and out.realized.as_buffer().cast('I')[0] == 5
|
||||
|
||||
|
||||
print("******** fourth, the Tensor ***********")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# abstractions2 goes from back to front, here we will go from front to back
|
||||
from typing import List
|
||||
from tqdm import tqdm
|
||||
from tinygrad.helpers import DEBUG
|
||||
from tinygrad.helpers import tqdm
|
||||
|
||||
# *****
|
||||
# 0. Load mnist on the device
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue