class_docstr: Discrete bottleneck class.
class_docstr_tok: ["Discrete","bottleneck","class","."]
docstr: Embedding function that takes discrete latent and returns embedding.
  
  Args:
      x: Input to the discretization bottleneck.
  Returns:
      Continuous embedding to be passed on to the decoder.
  
  Raises:
      ValueError: For unknown or missing arguments.
docstr_tok: ["Embedding","function","that","takes","discrete","latent","and","returns","embedding",".","Args",":","x",":","Input","to","the","discretization","bottleneck",".","Returns",":","Continuous","embedding","to","be","passed","on","to","the","decoder",".","Raises",":","ValueError",":","For","unknown","or","missing","arguments","."]
code: def embed(self, x):
      """Embedding function that takes discrete latent and returns embedding.
  
      Args:
          x: Input to the discretization bottleneck.
      Returns:
          Continuous embedding to be passed on to the decoder.
  
      Raises:
          ValueError: For unknown or missing arguments.
      """
      shape_x = common_layers.shape_list(x)
      x_flat = tf.reshape(x, [-1, 1])
      c = self.int_to_bit(x_flat, num_bits=self.hparams.z_size, base=2)
      shape = common_layers.shape_list(c)
      new_shape = shape
      new_shape.append(self.hparams.num_blocks)
      new_shape.append(
          int(self.hparams.z_size / self.hparams.num_blocks)
      )
      c = tf.to_int32(tf.reshape(c, shape=new_shape))
      h1_shape = shape_x
      h1_shape.append(self.hparams.hidden_size)
      h1 = tf.zeros(dtype=tf.float32, shape=h1_shape)
      c_int = self.bit_to_int(
          c,
          num_bits=int(self.hparams.z_size / self.hparams.num_blocks),
          base=2,
      )
      c_hot = tf.one_hot(
          c_int, depth=self.hparams.block_v_size, axis=-1
      )
      c_hot_flat = tf.reshape(
          c_hot,
          shape=[
              -1,
              self.hparams.num_blocks,
              self.hparams.block_v_size,
          ],
      )
      h1 = tf.matmul(
          tf.transpose(c_hot_flat, perm=[1, 0, 2]), self.means
      )
      h1 = tf.transpose(h1, perm=[1, 0, 2])
      h1 = tf.reshape(h1, shape=h1_shape)
      h1_shape[0] = self.hparams.batch_size
      h2 = tf.layers.dense(
          tf.nn.relu(h1), self.hparams.filter_size, name="vch2"
      )
      res = tf.layers.dense(
          tf.nn.relu(h2), self.hparams.hidden_size, name="vcfin"
      )
      return res
  
file_path: tensor2tensor/tensor2tensor/layers/vq_discrete.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from functools import partial
  from tensor2tensor.layers import common_layers
  import tensorflow.compat.v1
  from tensorflow.python.training import moving_averages
label_desc: Use image node_id 7 for calling the DiscreteBottleneck obj's underlying member method code with example usage: obj.embed(x) and returns: res