parameters: (op)
return_statement: return [input_shape[:mid].merge_with(input_shape[mid:])]
docstring: Shape function for array_ops.diag_part.
  
    This op has one input (of rank k = 2, 4, or 6), and one output (of rank k/2),
    where the shape of the output is the diagonal of the input shape.
  
    Args:
      op: A DiagPart Operation.
  
    Returns:
      A single-element list containing the shape of the output.
  
    Raises:
      ValueError: If input has odd rank or greater than 6, or the first and
      second halves of the shape are incompatible.
docstring_summary: Shape function for array_ops.diag_part.
docstring_tokens: Shape function for array_ops . diag_part .
function: def _DiagPartShape(op):
    """Shape function for array_ops.diag_part.
  
    This op has one input (of rank k = 2, 4, or 6), and one output (of rank k/2),
    where the shape of the output is the diagonal of the input shape.
  
    Args:
      op: A DiagPart Operation.
  
    Returns:
      A single-element list containing the shape of the output.
  
    Raises:
      ValueError: If input has odd rank or greater than 6, or the first and
      second halves of the shape are incompatible.
  
    """
    input_shape = op.inputs[0].get_shape().with_rank_at_most(6)
    rank = input_shape.ndims
    if rank is None:
      return [tensor_shape.unknown_shape()]
    if rank % 2:
      raise ValueError("Input must be even rank, got rank = " + str(rank) + ".")
    mid = rank // 2
    return [input_shape[:mid].merge_with(input_shape[mid:])]
function_tokens: def _DiagPartShape ( op ) : input_shape = op . inputs [ 0 ] . get_shape ( ) . with_rank_at_most ( 6 ) rank = input_shape . ndims if rank is None : return [ tensor_shape . unknown_shape ( ) ] if rank % 2 : raise ValueError ( "Input must be even rank, got rank = " + str ( rank ) + "." ) mid = rank // 2 return [ input_shape [ : mid ] . merge_with ( input_shape [ mid : ] ) ]