parameters: (context, builder, ndim, seqty, seq)
return_statement: return tuple(shapes)
docstring: Compute the likely shape of a nested sequence (possibly 0d).
docstring_summary: Compute the likely shape of a nested sequence (possibly 0d).
docstring_tokens: Compute the likely shape of a nested sequence ( possibly 0d ) .
function: def compute_sequence_shape(context, builder, ndim, seqty, seq):
      """
      Compute the likely shape of a nested sequence (possibly 0d).
      """
      intp_t = context.get_value_type(types.intp)
      zero = Constant.int(intp_t, 0)
  
      def get_first_item(seqty, seq):
          if isinstance(seqty, types.BaseTuple):
              if len(seqty) == 0:
                  return None, None
              else:
                  return seqty[0], builder.extract_value(seq, 0)
          else:
              getitem_impl = _get_borrowing_getitem(context, seqty)
              return seqty.dtype, getitem_impl(builder, (seq, zero))
  
      # Compute shape by traversing the first element of each nested
      # sequence
      shapes = []
      innerty, inner = seqty, seq
  
      for i in range(ndim):
          if i > 0:
              innerty, inner = get_first_item(innerty, inner)
          shapes.append(_get_seq_size(context, builder, innerty, inner))
  
      return tuple(shapes)
function_tokens: def compute_sequence_shape ( context , builder , ndim , seqty , seq ) : intp_t = context . get_value_type ( types . intp ) zero = Constant . int ( intp_t , 0 ) def get_first_item ( seqty , seq ) : if isinstance ( seqty , types . BaseTuple ) : if len ( seqty ) == 0 : return None , None else : return seqty [ 0 ] , builder . extract_value ( seq , 0 ) else : getitem_impl = _get_borrowing_getitem ( context , seqty ) return seqty . dtype , getitem_impl ( builder , ( seq , zero ) ) # Compute shape by traversing the first element of each nested # sequence shapes = [ ] innerty , inner = seqty , seq for i in range ( ndim ) : if i > 0 : innerty , inner = get_first_item ( innerty , inner ) shapes . append ( _get_seq_size ( context , builder , innerty , inner ) ) return tuple ( shapes )