MCPcopy Create free account
hub / github.com/apache/tvm / _gen_weights

Function _gen_weights

tests/python/relax/test_op_gradient_numeric.py:100–105  ·  view source on GitHub ↗
(out_sinfo)

Source from the content-addressed store, hash-verified

98 return data
99
100 def _gen_weights(out_sinfo):
101 if isinstance(out_sinfo, TupleStructInfo):
102 return [_gen_weights(sinfo) for sinfo in out_sinfo.fields]
103 else:
104 assert isinstance(out_sinfo, TensorStructInfo)
105 return np.random.uniform(size=[int(i) for i in out_sinfo.shape]).astype(out_sinfo.dtype)
106
107 def _is_call_no_grad(expr):
108 return isinstance(expr, Call) and expr.op == Op.get("relax.grad.no_grad")

Callers 1

relax_check_gradientsFunction · 0.85

Calls 2

uniformMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…