```
for i in range(10):
```

res=inputs@w+b

err=mse(res,targets)

err.backward()

with tf.no_grad():

w=w-w.grad*1e-5
b=b-b.grad*1e-5

w.grad.zero_()

b.grad.zero_()

```
for i in range(10):
```

res=inputs@w+b

err=mse(res,targets)

err.backward()

with tf.no_grad():

w=w-w.grad*1e-5
b=b-b.grad*1e-5

w.grad.zero_()

b.grad.zero_()

1 Like

i am getting error

RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

You probably forgot `requires_grad=True`

somewhere.

3 Likes

Thank you that was the mistake

1 Like

Can we also do the opposite in ML like with given yield of apples and oranges we could say that how much temperature, rainfall, humidity we need.

Obviously we can do that, but we will be predicting that values using just only one column for apples or one column for oranges so I am not sure how good the model will work, nevertheless you can try taking column like apple, oranges and temperature and then predict rainfall and humidity.