Complete the code to disable gradient calculation during inference.
with torch.[1](): output = model(input_tensor)
The no_grad context manager disables gradient calculation, which saves memory and computations during inference.
Complete the code to prevent gradient tracking for the tensor operation.
with torch.no_grad(): result = tensor.[1](2)
The pow method raises the tensor to a power. Inside no_grad, this operation won't track gradients.
Fix the error in the code to correctly disable gradient calculation.
with torch.no_grad[1]: prediction = model(data)
The no_grad context manager must be called with parentheses () to work properly.
Fill both blanks to create a dictionary of squared values without tracking gradients.
with torch.[1](): squares = {x: x[2]2 for x in range(1, 6)}
Use no_grad to disable gradients and ** to square numbers.
Fill all three blanks to compute model output without gradients and convert it to a numpy array.
with torch.[1](): output = model(input_tensor) numpy_output = output.[2]().cpu().[3]()
Use no_grad to disable gradients, detach() to get a tensor without gradient tracking, and numpy() to convert to a numpy array.