(self)
Build the TF graph and heads from pre-trained WaveGAN ckpts.

    It also prepares different graph, session and heads for sampling and
    classification respectively.
Build the TF graph and heads from pre-trained WaveGAN ckpts.
Build the TF graph and heads from pre - trained WaveGAN ckpts .
def build(self):
    """Build the TF graph and heads from pre-trained WaveGAN ckpts.

    It also prepares different graph, session and heads for sampling and
    classification respectively.
    """

    # pylint:disable=unused-variable,possibly-unused-variable
    # Reason:
    #   All endpoints are stored as attribute at the end of `_build`.
    #   Pylint cannot infer this case so it emits false alarm of
    #   unused-variable if we do not disable this warning.

    # pylint:disable=invalid-name
    # Reason:
    #   Variable useing 'G' in is name to be consistent with WaveGAN's author
    #   has name consider to be invalid by pylint so we disable the warning.

    # Dataset (SC09, WaveGAN)'s generator
    graph_sc09_gan = tf.Graph()
    with graph_sc09_gan.as_default():
      # Use the retrained, Gaussian priored model
      gen_ckpt_dir = os.path.expanduser(FLAGS.wavegan_gen_ckpt_dir)
      sess_sc09_gan = tf.Session(graph=graph_sc09_gan)
      saver_gan = tf.train.import_meta_graph(
          os.path.join(gen_ckpt_dir, 'infer', 'infer.meta'))

    # Dataset (SC09, WaveGAN)'s  classifier (inception)
    graph_sc09_class = tf.Graph()
    with graph_sc09_class.as_default():
      inception_ckpt_dir = os.path.expanduser(FLAGS.wavegan_inception_ckpt_dir)
      sess_sc09_class = tf.Session(graph=graph_sc09_class)
      saver_class = tf.train.import_meta_graph(
          os.path.join(inception_ckpt_dir, 'infer.meta'))

    # Dataset B (SC09, WaveGAN)'s Tensor symbols
    sc09_gan_z = graph_sc09_gan.get_tensor_by_name('z:0')
    sc09_gan_G_z = graph_sc09_gan.get_tensor_by_name('G_z:0')[:, :, 0]

    # Classification: Tensor symbols
    sc09_class_x = graph_sc09_class.get_tensor_by_name('x:0')
    sc09_class_scores = graph_sc09_class.get_tensor_by_name('scores:0')

    # Add all endpoints as object attributes
    for k, v in locals().items():
      self.__dict__[k] = v
def build ( self ) : # pylint:disable=unused-variable,possibly-unused-variable # Reason: #   All endpoints are stored as attribute at the end of `_build`. #   Pylint cannot infer this case so it emits false alarm of #   unused-variable if we do not disable this warning. # pylint:disable=invalid-name # Reason: #   Variable useing 'G' in is name to be consistent with WaveGAN's author #   has name consider to be invalid by pylint so we disable the warning. # Dataset (SC09, WaveGAN)'s generator graph_sc09_gan = tf . Graph ( ) with graph_sc09_gan . as_default ( ) : # Use the retrained, Gaussian priored model gen_ckpt_dir = os . path . expanduser ( FLAGS . wavegan_gen_ckpt_dir ) sess_sc09_gan = tf . Session ( graph = graph_sc09_gan ) saver_gan = tf . train . import_meta_graph ( os . path . join ( gen_ckpt_dir , 'infer' , 'infer.meta' ) ) # Dataset (SC09, WaveGAN)'s  classifier (inception) graph_sc09_class = tf . Graph ( ) with graph_sc09_class . as_default ( ) : inception_ckpt_dir = os . path . expanduser ( FLAGS . wavegan_inception_ckpt_dir ) sess_sc09_class = tf . Session ( graph = graph_sc09_class ) saver_class = tf . train . import_meta_graph ( os . path . join ( inception_ckpt_dir , 'infer.meta' ) ) # Dataset B (SC09, WaveGAN)'s Tensor symbols sc09_gan_z = graph_sc09_gan . get_tensor_by_name ( 'z:0' ) sc09_gan_G_z = graph_sc09_gan . get_tensor_by_name ( 'G_z:0' ) [ : , : , 0 ] # Classification: Tensor symbols sc09_class_x = graph_sc09_class . get_tensor_by_name ( 'x:0' ) sc09_class_scores = graph_sc09_class . get_tensor_by_name ( 'scores:0' ) # Add all endpoints as object attributes for k , v in locals ( ) . items ( ) : self . __dict__ [ k ] = v