diff --git a/tinygrad/helpers.py b/tinygrad/helpers.py index 10af5c0255..c6b4bd8256 100644 --- a/tinygrad/helpers.py +++ b/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)) diff --git a/tinygrad/ops.py b/tinygrad/ops.py index 09e0d0467a..c1f91669b6 100644 --- a/tinygrad/ops.py +++ b/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: diff --git a/tinygrad/shape/__init__.py b/tinygrad/shape/__init__.py index 753b6b59f4..788be7fad4 100644 --- a/tinygrad/shape/__init__.py +++ b/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 diff --git a/tinygrad/tensor.py b/tinygrad/tensor.py index 74e98833f7..562026c682 100644 --- a/tinygrad/tensor.py +++ b/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