mirror of
https://github.com/xiph/opus.git
synced 2025-06-02 08:37:43 +00:00
Remove trailing whitespace in dnn
This commit is contained in:
parent
26ab10d0c8
commit
f36685fc97
37 changed files with 231 additions and 246 deletions
|
@ -3,7 +3,7 @@ Modification of Tensorflow's Embedding Layer:
|
|||
1. Not restricted to be the first layer of a model
|
||||
2. Differentiable (allows non-integer lookups)
|
||||
- For non integer lookup, this layer linearly interpolates between the adjacent embeddings in the following way to preserver gradient flow
|
||||
- E = (1 - frac(x))*embed(floor(x)) + frac(x)*embed(ceil(x))
|
||||
- E = (1 - frac(x))*embed(floor(x)) + frac(x)*embed(ceil(x))
|
||||
"""
|
||||
|
||||
import tensorflow as tf
|
||||
|
@ -26,13 +26,13 @@ class diff_Embed(Layer):
|
|||
self.pcm_init = pcm_init
|
||||
self.initializer = initializer
|
||||
|
||||
def build(self, input_shape):
|
||||
def build(self, input_shape):
|
||||
w_init = tf.random_normal_initializer()
|
||||
if self.pcm_init:
|
||||
if self.pcm_init:
|
||||
w_init = self.initializer
|
||||
self.w = tf.Variable(initial_value=w_init(shape=(self.dict_size, self.units),dtype='float32'),trainable=True)
|
||||
|
||||
def call(self, inputs):
|
||||
def call(self, inputs):
|
||||
alpha = inputs - tf.math.floor(inputs)
|
||||
alpha = tf.expand_dims(alpha,axis = -1)
|
||||
alpha = tf.tile(alpha,[1,1,1,self.units])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue