(session, checkpoint_path)
Loads a pre-trained VGGish-compatible checkpoint.

  This function can be used as an initialization function (referred to as
  init_fn in TensorFlow documentation) which is called in a Session after
  initializating all variables. When used as an init_fn, this will load
  a pre-trained checkpoint that is compatible with the VGGish model
  definition. Only variables defined by VGGish will be loaded.

  Args:
    session: an active TensorFlow session.
    checkpoint_path: path to a file containing a checkpoint that is
      compatible with the VGGish model definition.
Loads a pre-trained VGGish-compatible checkpoint.
Loads a pre - trained VGGish - compatible checkpoint .
def load_vggish_slim_checkpoint(session, checkpoint_path):
  """Loads a pre-trained VGGish-compatible checkpoint.

  This function can be used as an initialization function (referred to as
  init_fn in TensorFlow documentation) which is called in a Session after
  initializating all variables. When used as an init_fn, this will load
  a pre-trained checkpoint that is compatible with the VGGish model
  definition. Only variables defined by VGGish will be loaded.

  Args:
    session: an active TensorFlow session.
    checkpoint_path: path to a file containing a checkpoint that is
      compatible with the VGGish model definition.
  """
  # Get the list of names of all VGGish variables that exist in
  # the checkpoint (i.e., all inference-mode VGGish variables).
  with tf.Graph().as_default():
    define_vggish_slim(training=False)
    vggish_var_names = [v.name for v in tf.global_variables()]

  # Get the list of all currently existing variables that match
  # the list of variable names we just computed.
  vggish_vars = [v for v in tf.global_variables() if v.name in vggish_var_names]

  # Use a Saver to restore just the variables selected above.
  saver = tf.train.Saver(vggish_vars, name='vggish_load_pretrained',
                         write_version=1)
  saver.restore(session, checkpoint_path)
def load_vggish_slim_checkpoint ( session , checkpoint_path ) : # Get the list of names of all VGGish variables that exist in # the checkpoint (i.e., all inference-mode VGGish variables). with tf . Graph ( ) . as_default ( ) : define_vggish_slim ( training = False ) vggish_var_names = [ v . name for v in tf . global_variables ( ) ] # Get the list of all currently existing variables that match # the list of variable names we just computed. vggish_vars = [ v for v in tf . global_variables ( ) if v . name in vggish_var_names ] # Use a Saver to restore just the variables selected above. saver = tf . train . Saver ( vggish_vars , name = 'vggish_load_pretrained' , write_version = 1 ) saver . restore ( session , checkpoint_path )