MCPcopy
hub / github.com/tinygrad/tinygrad / const

Method const

tinygrad/tensor.py:162–163  ·  view source on GitHub ↗
(dtype:DType, b:ConstType|UOp, device:str|tuple[str, ...]|None=None)

Source from the content-addressed store, hash-verified

160 def const_like(self, b:ConstType) -> Tensor: return Tensor(self.uop.const_like(b))
161 @staticmethod
162 def const(dtype:DType, b:ConstType|UOp, device:str|tuple[str, ...]|None=None) -> Tensor:
163 return Tensor(b if isinstance(b, UOp) else UOp.const(dtype, b, device))
164 @staticmethod
165 def unique_const(fill_value:ConstType|UOp, **kwargs) -> Tensor:
166 if isinstance(fill_value, UOp): return Tensor(fill_value, **kwargs)

Callers 4

_frompyFunction · 0.45
__init__Method · 0.45
from_uopMethod · 0.45
decode_hevc_frameMethod · 0.45

Calls 1

TensorClass · 0.85

Tested by

no test coverage detected