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
import tensorflow as tf | |
class Orthonormal(tf.keras.constraints.Constraint): | |
"""approximate Orthonormal weight constraint. | |
Constrains the weights incident to each hidden unit | |
to be approximately orthonormal | |
# Arguments | |
beta: the strength of the 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
from keras import backend as K | |
from keras import activations, initializations, regularizers, constraints | |
from keras.engine import Layer, InputSpec | |
from keras.utils.np_utils import conv_output_length | |
from keras.layers import Convolution1D, Convolution2D | |
import tensorflow as tf | |
class Convolution1D_tied(Layer): | |
'''Convolution operator for filtering neighborhoods of one-dimensional inputs. | |
When using this layer as the first layer in a model, |