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

Method get_tiny_gradient

test/backend/test_ops.py:715–717  ·  view source on GitHub ↗
(x, c)

Source from the content-addressed store, hash-verified

713 def test_pow_const_direct(self):
714 # x ** c
715 def get_tiny_gradient(x, c):
716 t = Tensor([x], dtype=dtypes.float)
717 return (t ** c)[0].gradient(t)[0].item()
718 def get_torch_gradient(x, c):
719 t = torch.tensor([x], dtype=torch.float, requires_grad=True)
720 return torch.autograd.grad(t ** c, t)[0].item()

Callers

nothing calls this directly

Calls 3

TensorClass · 0.90
itemMethod · 0.80
gradientMethod · 0.80

Tested by

no test coverage detected