def _prepare_feed_values(model, inputs, targets, sample_weights, mode):
  """Prepare feed values to the model execution function.

  Arguments:
    model: Model to prepare feed values for.
    inputs: List or dict of model inputs.
    targets: Optional list of model targets.
    sample_weights: Optional list of sample weight arrays.
    mode: One of 'train'/'test'/'predict'.

  Returns:
    Feed values for the model in the given mode.
  """
  if model._distribution_strategy:
    return training_distributed._prepare_feed_values(model, inputs, targets,
                                                     sample_weights, mode)
  inputs = training_utils.ModelInputs(inputs).as_list()
  targets = targets or []
  sample_weights = sample_weights or []
  ins = inputs + targets + sample_weights
  if mode == 'train' and not isinstance(K.symbolic_learning_phase(), int):
    ins += [True]
  return ins
Beispiel #2
0
def _prepare_feed_values(model, inputs, targets, sample_weights, mode):
    """Prepare feed values to the model execution function.

  Arguments:
    model: Model to prepare feed values for.
    inputs: List or dict of model inputs.
    targets: Optional list of model targets.
    sample_weights: Optional list of sample weight arrays.
    mode: One of 'train'/'test'/'predict'.

  Returns:
    Feed values for the model in the given mode.
  """
    if model._distribution_strategy:
        return training_distributed._prepare_feed_values(
            model, inputs, targets, sample_weights, mode)
    inputs = training_utils.ModelInputs(inputs).as_list()
    targets = targets or []
    sample_weights = sample_weights or []
    ins = inputs + targets + sample_weights
    if mode == 'train' and not isinstance(K.symbolic_learning_phase(), int):
        ins += [True]
    return ins
Beispiel #3
0
 def get_distributed_inputs():
     return training_distributed._prepare_feed_values(
         model, inputs, targets, sample_weights, mode)
Beispiel #4
0
 def get_distributed_inputs():
   return training_distributed._prepare_feed_values(
       model, inputs, targets, sample_weights, mode)