Some changes
This commit is contained in:
@@ -16,3 +16,11 @@ print(positions)
|
||||
print(indices)
|
||||
|
||||
|
||||
# Create a tensor with attached grads from a numpy array
|
||||
# Note: We pass zero=True to initialize the grads to zero on allocation
|
||||
x = spy.Tensor.numpy(device, np.array([1, 2, 3, 4], dtype=np.float32)).with_grads(zero=True)
|
||||
|
||||
# Evaluate the polynomial and ask for a tensor back
|
||||
# Expecting result = 2x^2 + 8x - 1
|
||||
result: spy.Tensor = module.polynomial(a=2, b=8, c=-1, x=x, _result='tensor')
|
||||
print(result.to_numpy())
|
||||
Reference in New Issue
Block a user