Created
August 28, 2017 11:52
-
-
Save iacolippo/91486cd95d77e705f61894ae162b267a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from FunctionErrorFeedback import ErrorFeedbackFunction | |
from torch.autograd import Function, Variable | |
import torch | |
import torch.nn as nn | |
class EF(nn.Module): | |
def __init__(self, layer_dim, error_dim): | |
super(EF, self).__init__() | |
self.feedback = torch.Tensor(error_dim, layer_dim) | |
self.reset_variables() | |
def reset_variables(self): | |
# brutal initialization | |
self.feedback.uniform_(-0.1, 0.1) | |
def forward(self, input): | |
return ErrorFeedbackFunction(input, self.feedback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment