CastLike works with one type hack

This commit is contained in:
George Hotz 2023-02-27 10:51:26 -08:00
parent 1ffe8d68d5
commit 082134952b
1 changed files with 5 additions and 0 deletions

View File

@ -151,3 +151,8 @@ def Tile(input, repeats):
def Range(start, limit, delta): return Tensor.arange(safe_numpy(limit)[0], safe_numpy(start)[0], safe_numpy(delta)[0])
def Where(condition, X, Y): return condition*X + (1-condition)*Y
# NOTE: since we only have one type, this is valid!
def CastLike(input, target_type):
assert isinstance(target_type, Tensor), "can only CastLike Tensor"
return input