diff --git a/docs/abstractions2.py b/docs/abstractions2.py index 6006d9d84c..42f33163a6 100644 --- a/docs/abstractions2.py +++ b/docs/abstractions2.py @@ -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 ***********") diff --git a/docs/abstractions3.py b/docs/abstractions3.py index a92351f5a8..02fe7e29c1 100644 --- a/docs/abstractions3.py +++ b/docs/abstractions3.py @@ -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