-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
type:featureNew feature or requestNew feature or request
Description
TensorFlow.js version
1.1.0
Browser version
Chrome 75
Feature request
Add the Swish activation function (https://arxiv.org/abs/1710.05941). I tried implementing it by adding a custom layer, but I couldn't get it to work. I looked into the source at activations.ts and it seems pretty easy to add Swish. Here's my example code:
export class Swish extends Activation {
/** @nocollapse */
static readonly className = 'Swish';
/**
* Calculate the activation function.
*
* @param x: Input.
* @param alpha: Scaling factor for the sigmoid function.
* @return Output of the Swish activation.
*/
apply(x: Tensor, alpha = 1): Tensor {
return K.sigmoid(x.mul(alpha)).mul(x);
}
}
serialization.registerClass(Swish);Sadly, I don't know the whole process of contributing (Are there any other source file to change? What about testing?), so I'd like for someone else to implement this change.
jessetrana
Metadata
Metadata
Assignees
Labels
type:featureNew feature or requestNew feature or request