-
Notifications
You must be signed in to change notification settings - Fork 0
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
FrEIA.modules #3
Comments
it might be worth considering to create a PR for this and to drop tags in the code, so people know where to direct their attention to. |
Thank you! I will consider that. |
Another point that came up:
|
I really like the So we could aim for a signature like this: TensorOrTensorList = Union[Tensor, List[Tensor]]
def forward(self, x: TensorOrTensorList, c=None, rev=False, jac=True) -> Tuple[TensorOrTensorList, Union[TensorOrTensorList, None]]:
...
if jac:
return z, jac
return z, None Pro: This would also solve #7 and simplify #8, because there is no state to be stored between forward() and jacobian(). |
Let's think about this, it seems like a very good idea, except for ruining existing code if people update FrEIA. But I admit the current system is pretty janky. (with the run_forward kwarg in .log_jacobian() etc.) It was the best we could do at the time without breaking code. But maybe it's the right time to just do it. |
Also:
|
I am in favor of this breaking change. We are super inconsistent with the log-Jacobian functions and buffered values anyway. Also it seems that most other normalizing flow implementations chose that signature, so might make it easier for people to understand our API. |
Any opinion on how do we handle multiple in- & outputs, i.e. split and merge modules? Do we make all modules to work with tuples of tensors everywhere? Then Compromise: We enforce that a module spits out a tuple exactly when it got a tuple in (unit tests #4 for the win!)? This makes minimal breaking changes for users. Tuples of Jacobian make no sense from a mathematic stand point, I think. |
No, I think we keep tuples for in- and outut of the individual nodes i.e. I don't think the internal stuff necessarily has to be consistent with the |
Also, I don't understand: |
We should also have the |
Yes, that is true! |
Good, I added it in my branch. Maybe even slicker: Modules should not have a method |
If it can't be missed by users implementing their own modules how and where to do that, I like the idea. |
I think this is a very good idea, just let me know before you go ahead so that i can it around in all the modules. |
Ok, the PR vislearn/FrEIA#69 is a proposal. |
Did I understand correctly, the proposal is rejected? |
What?
There are many modules that are 2-3 years old, introduced for some specific purpose.
Sometimes it turned out that the concept didn't even work and the module is useless.
In some cases, they overlap in functionality with other modules.
Some of them also don't have docstrings or explanations what it does.
How?
Ensure that
Go through all the modules listed in
FrEIA/modules/__init__.py
.Check points 1-3 above, and perhaps 4 (overlap with unittests).
Then deprecate modules that are old or unnecessary, or can be combined with similar ones,
and add docstrings.
Delete the ones that were already deprecated with v0.2 (see
FrEIA/modules/coupling_layers.py
, lines 430-434)The text was updated successfully, but these errors were encountered: