no generic exceptions
MODIFY
tinygrad/helpers.py
tinygrad/helpers.py
@@ -39,7 +39,7 @@ def get_conv_args(x_shape, w_shape, stride=1, groups=1, padding=0, dilation=1, o
oy = (iy + py + py_ - dy * (H-1) - 1)//sy + 1
ox = (ix + px + px_ - dx * (W-1) - 1)//sx + 1
if cin*groups != cin_:
- raise Exception(f"Input Tensor shape {x_shape} does not match the shape of the weights {w_shape}. ({cin*groups} vs. {cin_})")
+ raise TypeError(f"Input Tensor shape {x_shape} does not match the shape of the weights {w_shape}. ({cin*groups} vs. {cin_})")
assert cout % groups == 0 and (out_shape is None or out_shape == (bs, cout, oy, ox))
return ConvArgs(H, W, groups, cout//groups, cin, oy, ox, iy, ix, sy, sx, bs, cout, py, py_, px, px_, dy, dx, (bs, cout, oy, ox))

MODIFY
tinygrad/ops.py
tinygrad/ops.py
@@ -59,7 +59,7 @@ class GenericExecAST(DeviceBuffer): # pylint: disable=abstract-method
elif ast.op in ProcessingOps:
ret = srcs[0].processing_op(ast.op, srcs[1], ast.arg)
else:
- raise Exception("unknown op")
+ raise TypeError("unknown op")
return ret
class GlobalCounters:

MODIFY
tinygrad/shape/__init__.py
tinygrad/shape/__init__.py
@@ -53,10 +53,10 @@ class ZeroView:
self.shape : Tuple[int, ...] = tuple([y-x for x,y in self.arg])
@property
- def strides(self): raise Exception("ZeroView doesn't have strides")
+ def strides(self): raise NotImplementedError("ZeroView doesn't have strides")
@property
- def offset(self): raise Exception("ZeroView doesn't have offset")
+ def offset(self): raise NotImplementedError("ZeroView doesn't have offset")
@property
def contiguous(self): return False

MODIFY
tinygrad/tensor.py
tinygrad/tensor.py
@@ -24,7 +24,7 @@ class Tensor:
elif isinstance(data, LazyBuffer):
self.lazydata = data
else:
- raise Exception(f"can't create Tensor from {data}")
+ raise RuntimeError(f"can't create Tensor from {data}")
# tensors have gradients, buffers do not
self.grad : Optional[Tensor] = None

no generic exceptions