update layer constructors

This commit is contained in:
Leon Chen
2016-08-26 21:34:40 -04:00
parent ef6f18bd0a
commit 032e290607
12 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ export default class ELU extends Layer {
* Creates a ELU activation layer
* @param {number} alpha - scale for the negative factor
*/
constructor (alpha = 1.0) {
super({})
constructor (alpha = 1.0, attrs = {}) {
super(attrs)
this.alpha = alpha
}
+2 -2
View File
@@ -9,8 +9,8 @@ export default class LeakyReLU extends Layer {
* Creates a LeakyReLU activation layer
* @param {number} alpha - negative slope coefficient
*/
constructor (alpha = 0.3) {
super({})
constructor (alpha = 0.3, attrs = {}) {
super(attrs)
this.alpha = alpha
}
+2 -2
View File
@@ -14,8 +14,8 @@ export default class PReLU extends Layer {
/**
* Creates a PReLU activation layer
*/
constructor () {
super({})
constructor (attrs = {}) {
super(attrs)
// Layer weights specification
this.params = ['alphas']
@@ -9,8 +9,8 @@ export default class ParametricSoftplus extends Layer {
/**
* Creates a ParametricSoftplus activation layer
*/
constructor () {
super({})
constructor (attrs = {}) {
super(attrs)
// Layer weights specification
this.params = ['alphas', 'betas']
+2 -2
View File
@@ -9,8 +9,8 @@ export default class SReLU extends Layer {
/**
* Creates a SReLU activation layer
*/
constructor () {
super({})
constructor (attrs = {}) {
super(attrs)
// Layer weights specification
this.params = ['t_left', 'a_left', 't_right', 'a_right']
@@ -9,8 +9,8 @@ export default class ThresholdedReLU extends Layer {
* Creates a ThresholdedReLU activation layer
* @param {number} theta - float >= 0. Threshold location of activation.
*/
constructor (theta = 1.0) {
super({})
constructor (theta = 1.0, attrs = {}) {
super(attrs)
this.theta = theta
}
+1 -1
View File
@@ -10,7 +10,7 @@ export default class Activation extends Layer {
* @param {string} activation - name of activation function
*/
constructor (activation, attrs = {}) {
super({})
super(attrs)
this.activation = activations[activation]
}
+2 -2
View File
@@ -9,8 +9,8 @@ export default class Dropout extends Layer {
* Creates an Dropout layer
* @param {number} p - fraction of the input units to drop (between 0 and 1)
*/
constructor (p) {
super({})
constructor (p, attrs = {}) {
super(attrs)
this.p = Math.min(Math.max(0, p), 1)
}
+2 -2
View File
@@ -12,8 +12,8 @@ export default class Flatten extends Layer {
/**
* Creates a Flatten layer
*/
constructor () {
super({})
constructor (attrs = {}) {
super(attrs)
}
/**
+2 -2
View File
@@ -10,8 +10,8 @@ export default class Permute extends Layer {
* Creates a Permute layer
* @param {number[]} dims
*/
constructor (dims) {
super({})
constructor (dims, attrs = {}) {
super(attrs)
this.dims = dims.map(dim => dim - 1)
}
+2 -2
View File
@@ -12,8 +12,8 @@ export default class RepeatVector extends Layer {
* Creates a RepeatVector layer
* @param {number} n
*/
constructor (n) {
super({})
constructor (n, attrs = {}) {
super(attrs)
this.n = n
}
+2 -2
View File
@@ -13,8 +13,8 @@ export default class Reshape extends Layer {
* Creates a Reshape layer
* @param {number[]} shape
*/
constructor (shape) {
super({})
constructor (shape, attrs = {}) {
super(attrs)
this.shape = shape
}