Skip to content
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

TorchSparse #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ncps/torch/cfc_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,17 @@ def forward(self, input, hx, ts):
# Cfc
if self.sparsity_mask is not None:
ff2 = F.linear(x, self.ff2.weight * self.sparsity_mask, self.ff2.bias)
t_a = F.linear(x, self.time_a.weight * self.sparsity_mask, self.time_a.bias)
t_b = F.linear(x, self.time_b.weight * self.sparsity_mask, self.time_b.bias)
else:
ff2 = self.ff2(x)
t_a = self.time_a(x)
t_b = self.time_b(x)
ff1 = self.tanh(ff1)
ff2 = self.tanh(ff2)
t_a = self.time_a(x)
t_b = self.time_b(x)
t_interp = self.sigmoid(t_a * ts + t_b)
if self.mode == "no_gate":
new_hidden = ff1 + t_interp * ff2
else:
new_hidden = ff1 * (1.0 - t_interp) + t_interp * ff2
return new_hidden, new_hidden
return new_hidden, new_hidden