MCPcopy Index your code
hub / github.com/tinygrad/tinygrad / vec

Method vec

tinygrad/dtype.py:111–116  ·  view source on GitHub ↗
(self, sz:int)

Source from the content-addressed store, hash-verified

109 def base(self): return self._base
110 @functools.cache # pylint: disable=method-cache-max-size-none
111 def vec(self, sz:int) -> DType:
112 assert self.v == 1, f"can't vectorize ptr {self} with size {sz}"
113 if sz == 1: return self # sz=1 is a scalar
114 if isinstance(self, ImageDType):
115 return ImageDType(self.priority, self.bitsize, self.name, self.fmt, self.count, self, self._base, self.addrspace, sz, self.size, self.shape)
116 return type(self)(self.priority, self.bitsize, self.name, self.fmt, self.count, self, self._base, self.addrspace, sz, self.size)
117 def ptr(self, size=-1, addrspace=AddrSpace.GLOBAL) -> PtrDType: raise RuntimeError("can't make a pointer from a pointer")
118 def nbytes(self) -> int:
119 if self.size == -1: raise RuntimeError("can't get nbytes of a pointer with unlimited size")

Callers

nothing calls this directly

Calls 1

ImageDTypeClass · 0.85

Tested by

no test coverage detected