parameters: (tensor_list, labels, probs_list)
return_statement: return tensor_list, labels, checked_probs_list
docstring: Verify that batched inputs are well-formed.
docstring_summary: Verify that batched inputs are well-formed.
docstring_tokens: Verify that batched inputs are well - formed .
function: def _verify_input(tensor_list, labels, probs_list):
    """Verify that batched inputs are well-formed."""
    checked_probs_list = []
    for probs in probs_list:
      # Since number of classes shouldn't change at runtime, probalities shape
      # should be fully defined.
      probs.get_shape().assert_is_fully_defined()
  
      # Probabilities must be 1D.
      probs.get_shape().assert_has_rank(1)
  
      # Probabilities must be nonnegative and sum to one.
      tol = 1e-6
      prob_sum = math_ops.reduce_sum(probs)
      checked_probs = control_flow_ops.with_dependencies([
          check_ops.assert_non_negative(probs),
          check_ops.assert_less(prob_sum, 1.0 + tol),
          check_ops.assert_less(1.0 - tol, prob_sum)
      ], probs)
      checked_probs_list.append(checked_probs)
  
    # All probabilities should be the same length.
    prob_length = checked_probs_list[0].get_shape().num_elements()
    for checked_prob in checked_probs_list:
      if checked_prob.get_shape().num_elements() != prob_length:
        raise ValueError('Probability parameters must have the same length.')
  
    # Labels tensor should only have batch dimension.
    labels.get_shape().assert_has_rank(1)
  
    for tensor in tensor_list:
      # Data tensor should have a batch dimension.
      tensor_shape = tensor.get_shape().with_rank_at_least(1)
  
      # Data and label batch dimensions must be compatible.
      tensor_shape[0].assert_is_compatible_with(labels.get_shape()[0])
  
    # Data and labels must have the same, strictly positive batch size. Since we
    # can't assume we know the batch size at graph creation, add runtime checks.
    labels_batch_size = array_ops.shape(labels)[0]
    lbl_assert = check_ops.assert_positive(labels_batch_size)
  
    # Make each tensor depend on its own checks.
    labels = control_flow_ops.with_dependencies([lbl_assert], labels)
    tensor_list = [
        control_flow_ops.with_dependencies([
            lbl_assert,
            check_ops.assert_equal(array_ops.shape(x)[0], labels_batch_size)
        ], x) for x in tensor_list
    ]
  
    # Label's classes must be integers 0 <= x < num_classes.
    labels = control_flow_ops.with_dependencies([
        check_ops.assert_integer(labels), check_ops.assert_non_negative(labels),
        check_ops.assert_less(labels, math_ops.cast(prob_length, labels.dtype))
    ], labels)
  
    return tensor_list, labels, checked_probs_list
function_tokens: def _verify_input ( tensor_list , labels , probs_list ) : checked_probs_list = [ ] for probs in probs_list : # Since number of classes shouldn't change at runtime, probalities shape # should be fully defined. probs . get_shape ( ) . assert_is_fully_defined ( ) # Probabilities must be 1D. probs . get_shape ( ) . assert_has_rank ( 1 ) # Probabilities must be nonnegative and sum to one. tol = 1e-6 prob_sum = math_ops . reduce_sum ( probs ) checked_probs = control_flow_ops . with_dependencies ( [ check_ops . assert_non_negative ( probs ) , check_ops . assert_less ( prob_sum , 1.0 + tol ) , check_ops . assert_less ( 1.0 - tol , prob_sum ) ] , probs ) checked_probs_list . append ( checked_probs ) # All probabilities should be the same length. prob_length = checked_probs_list [ 0 ] . get_shape ( ) . num_elements ( ) for checked_prob in checked_probs_list : if checked_prob . get_shape ( ) . num_elements ( ) != prob_length : raise ValueError ( 'Probability parameters must have the same length.' ) # Labels tensor should only have batch dimension. labels . get_shape ( ) . assert_has_rank ( 1 ) for tensor in tensor_list : # Data tensor should have a batch dimension. tensor_shape = tensor . get_shape ( ) . with_rank_at_least ( 1 ) # Data and label batch dimensions must be compatible. tensor_shape [ 0 ] . assert_is_compatible_with ( labels . get_shape ( ) [ 0 ] ) # Data and labels must have the same, strictly positive batch size. Since we # can't assume we know the batch size at graph creation, add runtime checks. labels_batch_size = array_ops . shape ( labels ) [ 0 ] lbl_assert = check_ops . assert_positive ( labels_batch_size ) # Make each tensor depend on its own checks. labels = control_flow_ops . with_dependencies ( [ lbl_assert ] , labels ) tensor_list = [ control_flow_ops . with_dependencies ( [ lbl_assert , check_ops . assert_equal ( array_ops . shape ( x ) [ 0 ] , labels_batch_size ) ] , x ) for x in tensor_list ] # Label's classes must be integers 0 <= x < num_classes. labels = control_flow_ops . with_dependencies ( [ check_ops . assert_integer ( labels ) , check_ops . assert_non_negative ( labels ) , check_ops . assert_less ( labels , math_ops . cast ( prob_length , labels . dtype ) ) ] , labels ) return tensor_list , labels , checked_probs_list