MCPcopy
hub / github.com/tinygrad/tinygrad / reshape

Function reshape

tinygrad/nn/onnx.py:512–515  ·  view source on GitHub ↗
(val:Tensor)

Source from the content-addressed store, hash-verified

510 if axis < 0: axis += x.ndim
511 # https://github.com/onnx/onnx/blob/main/onnx/reference/ops/op_quantize_linear.py#L31
512 def reshape(val:Tensor):
513 if val.numel() == 1: return val
514 if block_size == 0: return val.reshape([val.shape[0] if dim == axis else 1 for dim in range(x.ndim)])
515 return val.repeat_interleave(block_size, axis)
516 return (reshape(scale), reshape(zero_point) if isinstance(zero_point, Tensor) else zero_point)
517
518 def _op_integer(op, inputs:list[Tensor], zero_points:list[Tensor], **opts):

Callers 1

_prepare_quantizeFunction · 0.85

Calls 3

numelMethod · 0.80
reshapeMethod · 0.80
repeat_interleaveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…