-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change to batch_first; add criterions
- Loading branch information
1 parent
fdbc708
commit 9945383
Showing
14 changed files
with
105 additions
and
30 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from . import model | ||
from . import layer | ||
from . import mask | ||
from . import utils | ||
from . import criterion | ||
from . import constraint |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
from .rnn_loss import RNNLoss | ||
from .mlp_loss import MLPLoss | ||
|
||
if __name__ == '__main__': | ||
print(RNNLoss) | ||
print(MLPLoss) | ||
from .firing_rate import * |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import torch | ||
import torch.nn as nn | ||
|
||
|
||
class L1FiringRateLoss(nn.Module): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
def forward(self, states): | ||
mean_fr = torch.mean(states, dim=(0, 1)) | ||
return torch.norm(mean_fr, p=1)**2/mean_fr.numel() | ||
|
||
|
||
class L2FiringRateLoss(nn.Module): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
def forward(self, states): | ||
mean_fr = torch.mean(states, dim=(0, 1)) | ||
return torch.norm(mean_fr, p=2)**2/mean_fr.numel() |
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# TODOs: | ||
- [ ] The examples need to be updated. Especially on the main branch. | ||
- [ ] Resolve the transpose issue in the model module and the mask module. | ||
- [ ] Resolve the transpose issue in the model module and the mask module. | ||
- [ ] Make the model use `batch_first` by default. | ||
- [ ] Refactor the RNNLoss part, let it take a dictionary instead of many separate `lambda_*` parameters. |