parameters: (op)
return_statement: return [tensor_shape.TensorShape(returned_dims)]
docstring: Shape function for the ReduceJoin op.
docstring_summary: Shape function for the ReduceJoin op.
docstring_tokens: Shape function for the ReduceJoin op .
function: def _ReduceJoinShape(op):
    """Shape function for the ReduceJoin op."""
    input_shape = op.inputs[0].get_shape()
    reduction_indices = np.ravel(tensor_util.constant_value(op.inputs[1]))
    keep_dims = op.get_attr("keep_dims")
  
    if input_shape.ndims is None:
      return [tensor_shape.unknown_shape()]
  
    if input_shape.ndims == 0:
      raise ValueError("Input string tensor cannot be a scalar.")
  
    true_indices = set()
    for reduction_index in reduction_indices:
      if reduction_index is None:
        return [tensor_shape.unknown_shape()]
  
      if (reduction_index < -input_shape.ndims or
          reduction_index >= input_shape.ndims):
        raise ValueError("Invalid reduction dimension %d for input with %d "
                         "dimensions" % (reduction_index, input_shape.ndims))
  
      true_index = reduction_index % input_shape.ndims
      if true_index in true_indices:
        raise ValueError("Duplicate reduction index %d." % reduction_index)
  
      if input_shape.dims[true_index] == 0:
        raise ValueError("Cannot reduce dimension %d with size 0." %
                         reduction_index)
  
      true_indices.add(true_index)
  
    returned_dims = []
    for i, dim in enumerate(input_shape.dims):
      if i in true_indices:
        if keep_dims:
          returned_dims.append(1)
      else:
        returned_dims.append(dim)
  
    return [tensor_shape.TensorShape(returned_dims)]
function_tokens: def _ReduceJoinShape ( op ) : input_shape = op . inputs [ 0 ] . get_shape ( ) reduction_indices = np . ravel ( tensor_util . constant_value ( op . inputs [ 1 ] ) ) keep_dims = op . get_attr ( "keep_dims" ) if input_shape . ndims is None : return [ tensor_shape . unknown_shape ( ) ] if input_shape . ndims == 0 : raise ValueError ( "Input string tensor cannot be a scalar." ) true_indices = set ( ) for reduction_index in reduction_indices : if reduction_index is None : return [ tensor_shape . unknown_shape ( ) ] if ( reduction_index < - input_shape . ndims or reduction_index >= input_shape . ndims ) : raise ValueError ( "Invalid reduction dimension %d for input with %d " "dimensions" % ( reduction_index , input_shape . ndims ) ) true_index = reduction_index % input_shape . ndims if true_index in true_indices : raise ValueError ( "Duplicate reduction index %d." % reduction_index ) if input_shape . dims [ true_index ] == 0 : raise ValueError ( "Cannot reduce dimension %d with size 0." % reduction_index ) true_indices . add ( true_index ) returned_dims = [ ] for i , dim in enumerate ( input_shape . dims ) : if i in true_indices : if keep_dims : returned_dims . append ( 1 ) else : returned_dims . append ( dim ) return [ tensor_shape . TensorShape ( returned_dims ) ]