Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29bbe09

Browse files
Setogitsoumith
authored andcommitted
Fix main.py in C-Extension doc (#142)
1 parent 456e260 commit 29bbe09

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

advanced_source/c_extension.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ import your extension just like a regular python file.
109109
.. code:: python
110110
111111
# main.py
112+
import torch
112113
import torch.nn as nn
113114
from torch.autograd import Variable
114115
from modules.add import MyAddModule
115116
116117
class MyNetwork(nn.Module):
117118
def __init__(self):
118-
super(MyNetwork, self).__init__(
119-
add=MyAddModule(),
120-
)
119+
super(MyNetwork, self).__init__()
120+
self.add = MyAddModule()
121121
122122
def forward(self, input1, input2):
123123
return self.add(input1, input2)

0 commit comments

Comments
 (0)