Question: Read the PyTorch code given below; Draw the corresponding computational graph ( 8 points ) ; Describe the output of the code and show your

Read the PyTorch code given below; Draw the corresponding computational graph (8 points); Describe the output of the code and show your work
import torch
w1= torch.tensor([-2.],requires_grad = True)
x1= torch.tensor([1.],requires_grad = True)
w2= torch.tensor([1.],requires_grad = True)
x2= torch.tensor([2.],requires_grad = True)
a = min(w1, x1)
b = w2*x2
c = a+b
y = F.sigmoid(c)
y.backward()
print(y)
print(w2.grad)
print(w1.grad)
I always remember to Thumbs Up correct posts!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!