Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Add Parametric Soft Exponential Unit (PSEU) activation layer #451

Closed
wants to merge 61 commits into from
Closed

Add Parametric Soft Exponential Unit (PSEU) activation layer #451

wants to merge 61 commits into from

Conversation

SriRangaTarun
Copy link
Contributor

- What I did
See above

- How I did it

- How you can verify it
I added unit tests


This pull request fixes #issue_number_here

@SriRangaTarun
Copy link
Contributor Author

@gabrieldemarmiesse I have added the Parametric Soft Exponential Unit (PSEU) activation layer. Here is the research paper on arXiv. The build is passing now. Do you know someone who can review this ?

@gabrieldemarmiesse
Copy link
Contributor

@SriRangaTarun We're currently focused on getting the design of this repo right to have a v1.0. So there might be delays to reviews PRs which add new features.

@@ -4,6 +4,7 @@
from .advanced_activations.srelu import SReLU
from .advanced_activations.swish import Swish
from .advanced_activations.sinerelu import SineReLU
from .advanced_activations.pseu import PSEU
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should insert the import in alphabetical order

Copy link
Contributor Author

@SriRangaTarun SriRangaTarun Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

self.build = True

def call(self, x, mask=None):
if self.alpha_init is not None and self.alpha_init < 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.alpha_init can't be None as it has a default value. You can remove the first condition

Copy link
Contributor Author

@SriRangaTarun SriRangaTarun Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


self.build = True

def call(self, x, mask=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if mask is not None, is there any change in the behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. It has no impact.

@@ -0,0 +1,87 @@
# -*- coding: utf-8 -*-
from keras import initializers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, we like to have the imports sorted alphabetically, with first all the import XXX and then all the from XX import YY. See this StackOverflow thread

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@RaphaelMeudec
Copy link
Contributor

@SriRangaTarun Thanks for the contribution! I've left some comments. Also, as soon as #441 gets merged, you can rebase on it and add yourself as the code owner for this feature. Nice work!

@SriRangaTarun
Copy link
Contributor Author

SriRangaTarun commented Feb 12, 2019

@RaphaelMeudec and @gabrieldemarmiesse Ever since the codeowners PR has been merged, it is failing the codeowners test. But, every other test is passing. Please check the latest CI Build here.

@SriRangaTarun
Copy link
Contributor Author

Now the build is passing after adding pseu.py to CODEOWNERS.

@SriRangaTarun
Copy link
Contributor Author

@RaphaelMeudec and @gabrieldemarmiesse Today I tried to add initializer and trainable options, instead of only having a constant alpha initializer. But, I removed them and reverted to the previous version because they cause numerical instability in the function (it is a piecewise function in alpha, so it becomes unstable when the negative formula is used for positive alpha weights and the other way round). A custom initializer or trainability can cause the signs of the weights to mismatch the function and result in NaNs. So, I am sticking to constant initial alpha weights which can not be trained.

@SriRangaTarun
Copy link
Contributor Author

@RaphaelMeudec Do you suggest any other changes ? The most recent build failed because the instancenormalization test suddenly failed for some reason.

@RaphaelMeudec
Copy link
Contributor

@SriRangaTarun All good, nothing to add IMO!

@gabrieldemarmiesse Failing test doesn't seem linked to this PR, code looks good to me!

@SriRangaTarun
Copy link
Contributor Author

Somehow, the build is passing now.

@RaphaelMeudec
Copy link
Contributor

@gabrieldemarmiesse I think we can merge this!

@gabrieldemarmiesse
Copy link
Contributor

We'll merge this after I merge the tf.keras PR. It's getting quite painful to resolve conflicts every two days.

@gabrieldemarmiesse
Copy link
Contributor

@SriRangaTarun Please merge master into your branches to make sure that it's compatible with tf.keras

@SriRangaTarun
Copy link
Contributor Author

SriRangaTarun commented Feb 16, 2019

@RaphaelMeudec and @gabrieldemarmiesse I am closing this PR and have created an alias here. There, I have merged master into my branch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants