parameters: (op)
return_statement: return [tensor_shape.TensorShape(result_shape)]
docstring: Determine shape for squeeze op's output tensor.
  
    Args:
      op: Operation for which to determine shape.
    Returns:
      Shape of op's output tensor.
    Raises:
      ValueError: if squeeze_dims includes a dimension outside of [-rank, rank),
          where rank is the number of dimensions in the input tensor. Or, if
          squeeze_dims includes a dimension for which input shape has a value
          not equal to 1.
docstring_summary: Determine shape for squeeze op's output tensor.
docstring_tokens: Determine shape for squeeze op s output tensor .
function: def _SqueezeShape(op):
    """Determine shape for squeeze op's output tensor.
  
    Args:
      op: Operation for which to determine shape.
    Returns:
      Shape of op's output tensor.
    Raises:
      ValueError: if squeeze_dims includes a dimension outside of [-rank, rank),
          where rank is the number of dimensions in the input tensor. Or, if
          squeeze_dims includes a dimension for which input shape has a value
          not equal to 1.
    """
    input_shape = op.inputs[0].get_shape()
    if input_shape.dims is None:
      return [tensor_shape.unknown_shape()]
  
    squeeze_dims = op.get_attr("squeeze_dims") or []
    wrapped_squeeze_dims = []
    input_ndims = input_shape.ndims
    for i, squeeze_dim in enumerate(squeeze_dims):
      if squeeze_dim < -input_ndims or squeeze_dim >= input_ndims:
        raise ValueError(
            "squeeze_dims[%d]=%d not in [%d, %d)." % (
                i, squeeze_dim, -input_ndims, input_ndims))
      if squeeze_dim < 0:
        squeeze_dim += input_ndims
      wrapped_squeeze_dims.append(squeeze_dim)
  
    result_shape = []
    for i, dim in enumerate([d.value for d in input_shape.dims]):
      is_explicit_match = i in wrapped_squeeze_dims
      if dim is None:
        if is_explicit_match:
          # Assume that the squeezed dimension will be 1 at runtime.
          continue
        if not wrapped_squeeze_dims:
          # If squeezing all 1 dimensions and we see a None, give up.
          return [tensor_shape.unknown_shape()]
      elif dim == 1:
        if is_explicit_match or not wrapped_squeeze_dims:
          continue
      elif is_explicit_match:
        raise ValueError(
            "Can not squeeze dim[%d], expected a dimension of 1, got %d." % (
                i, dim))
      result_shape.append(dim)
    return [tensor_shape.TensorShape(result_shape)]
function_tokens: def _SqueezeShape ( op ) : input_shape = op . inputs [ 0 ] . get_shape ( ) if input_shape . dims is None : return [ tensor_shape . unknown_shape ( ) ] squeeze_dims = op . get_attr ( "squeeze_dims" ) or [ ] wrapped_squeeze_dims = [ ] input_ndims = input_shape . ndims for i , squeeze_dim in enumerate ( squeeze_dims ) : if squeeze_dim < - input_ndims or squeeze_dim >= input_ndims : raise ValueError ( "squeeze_dims[%d]=%d not in [%d, %d)." % ( i , squeeze_dim , - input_ndims , input_ndims ) ) if squeeze_dim < 0 : squeeze_dim += input_ndims wrapped_squeeze_dims . append ( squeeze_dim ) result_shape = [ ] for i , dim in enumerate ( [ d . value for d in input_shape . dims ] ) : is_explicit_match = i in wrapped_squeeze_dims if dim is None : if is_explicit_match : # Assume that the squeezed dimension will be 1 at runtime. continue if not wrapped_squeeze_dims : # If squeezing all 1 dimensions and we see a None, give up. return [ tensor_shape . unknown_shape ( ) ] elif dim == 1 : if is_explicit_match or not wrapped_squeeze_dims : continue elif is_explicit_match : raise ValueError ( "Can not squeeze dim[%d], expected a dimension of 1, got %d." % ( i , dim ) ) result_shape . append ( dim ) return [ tensor_shape . TensorShape ( result_shape ) ]