(features, labels, mode, params, config)
return estimator_spec_util.get_estimator_spec(
      hparams, mode, features, labels, frame_logits, onset_logits,
      offset_logits, velocity_values, offset_network=hparams.offset_network)
Builds the acoustic (for Estimator API).
Builds the acoustic (for Estimator API).
Builds the acoustic ( for Estimator API ) .
def model_fn(features, labels, mode, params, config):
  """Builds the acoustic (for Estimator API)."""
  del config
  hparams = params

  length = features.length
  spec = features.spec
  is_training = mode == tf.estimator.ModeKeys.TRAIN

  frame_logits, onset_logits, offset_logits, velocity_values = build_model(
      spec, length, hparams, is_training)

  # Hack to restore the batch dimension, which is lost in some cases.
  def fix_shape(output):
    shape = list(output.shape)
    shape[0] = spec.shape[0]
    output.set_shape(shape)
  for output in (frame_logits, onset_logits, offset_logits, velocity_values):
    fix_shape(output)

  return estimator_spec_util.get_estimator_spec(
      hparams, mode, features, labels, frame_logits, onset_logits,
      offset_logits, velocity_values, offset_network=hparams.offset_network)
def model_fn ( features , labels , mode , params , config ) : del config hparams = params length = features . length spec = features . spec is_training = mode == tf . estimator . ModeKeys . TRAIN frame_logits , onset_logits , offset_logits , velocity_values = build_model ( spec , length , hparams , is_training ) # Hack to restore the batch dimension, which is lost in some cases. def fix_shape ( output ) : shape = list ( output . shape ) shape [ 0 ] = spec . shape [ 0 ] output . set_shape ( shape ) for output in ( frame_logits , onset_logits , offset_logits , velocity_values ) : fix_shape ( output ) return estimator_spec_util . get_estimator_spec ( hparams , mode , features , labels , frame_logits , onset_logits , offset_logits , velocity_values , offset_network = hparams . offset_network )