MCPcopy
hub / github.com/tinygrad/tinygrad / derandomize_model

Function derandomize_model

test/helpers.py:35–38  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

33def replace_opts(ast:UOp, opts:list) -> UOp: return ast.replace(arg=replace(ast.arg, opts_to_apply=tuple(opts)))
34
35def derandomize_model(model):
36 for p in get_parameters(model):
37 p.replace(Tensor.empty(p.shape, device=p.device, dtype=p.dtype))
38 p.realize()
39
40def call_is_graph(call:UOp) -> bool:
41 ast = call.src[0]

Callers 6

test_stable_diffusionMethod · 0.90
test_unet_resblockMethod · 0.90
test_llamaMethod · 0.90
test_gpt2Method · 0.90

Calls 4

get_parametersFunction · 0.90
realizeMethod · 0.80
replaceMethod · 0.45
emptyMethod · 0.45

Tested by 6

test_stable_diffusionMethod · 0.72
test_unet_resblockMethod · 0.72
test_llamaMethod · 0.72
test_gpt2Method · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…