MCPcopy
hub / github.com/ibab/tensorflow-wavenet / _one_hot

Method _one_hot

wavenet/model.py:516–529  ·  view source on GitHub ↗

One-hot encodes the waveform amplitudes. This allows the definition of the network as a categorical distribution over a finite set of possible amplitudes.

(self, input_batch)

Source from the content-addressed store, hash-verified

514 return conv2
515
516 def _one_hot(self, input_batch):
517 '''One-hot encodes the waveform amplitudes.
518
519 This allows the definition of the network as a categorical distribution
520 over a finite set of possible amplitudes.
521 '''
522 with tf.name_scope('one_hot_encode'):
523 encoded = tf.one_hot(
524 input_batch,
525 depth=self.quantization_channels,
526 dtype=tf.float32)
527 shape = [self.batch_size, -1, self.quantization_channels]
528 encoded = tf.reshape(encoded, shape)
529 return encoded
530
531 def _embed_gc(self, global_condition):
532 '''Returns embedding for global condition.

Callers 2

predict_probaMethod · 0.95
lossMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected