Skip to content

AttributeError: 'module' object has no attribute 'Function' #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anshulpaigwar opened this issue May 31, 2018 · 1 comment
Closed

Comments

@anshulpaigwar
Copy link

I think there is an typing error in an example code in the tutorials Link on Pytorch website

import math
import torch

# Our module!
import lltm

class LLTMFunction(torch.nn.Function): # <-------------- Here
    @staticmethod
    def forward(ctx, input, weights, bias, old_h, old_cell):
        outputs = lltm.forward(input, weights, bias, old_h, old_cell)
        new_h, new_cell = outputs[:2]
        variables = outputs[1:] + [weights, old_cell]
        ctx.save_for_backward(*variables)

        return new_h, new_cell

torch.nn does not have module Function, It should be torch.autograd.Function

@goldsborough
Copy link
Contributor

True, thanks. Will fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants