Skip to content
ml-recall

#custom-function

1 question from PyTorch

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Select all that apply

mediumAI-checkedPyTorch

A custom autograd function implements tanh:

class TanhFunction(torch.autograd.Function):
    @staticmethod
    def forward(ctx, x):
        ctx.save_for_backward(x)
        return x.tanh()

    @staticmethod
    def backward(ctx, grad_output):
        x, = ctx.saved_tensors
        return ...

Which expressions are correct return values for backward? Select all that apply.

Select all options that apply