Skip to content

Potential problem with example code on extending the autograd #18

Closed
@zli117

Description

@zli117

In the example code for extending the autograd (link), in the backward function, grad_output is a Variable, but all the saved variables input, weight, bias are tensors since they got converted before the call of forward. If we invoke mm with mixture of Tensor and Variable, we will get a RuntimeError: mm(): argument 'mat2' (position 1) must be Variable, not torch.FloatTensor error. Should we convert grad_output to Tensor first and then convert the results back to Variable in backward?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions