touchup abstraction docs (#7327)

fix typing and use tinygrad tqdm
This commit is contained in:
chenyu
2024-10-27 22:29:55 -04:00
committed by GitHub
parent cb5702f170
commit 96fcc47e27
2 changed files with 4 additions and 5 deletions

View File

@@ -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 ***********")

View File

@@ -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