class_docstr: The supervertex structure in GripNet. Each supervertex is a subgraph containing nodes of the same category
      that are semantically-coherent. Supervertices can be homogeneous or heterogeneous.
  
  Args:
      name (str): the name of the supervertex.
      node_feat (torch.Tensor): node features of the supervertex with shape [#nodes, #features]. We recommend
          using `torch.sparse.FloatTensor()` if the node feature matrix is sparse.
      edge_index (torch.Tensor): edge indices in COO format with shape [2, #edges].
      edge_type (torch.Tensor, optional): one-dimensional relation type for each edge, indexed from 0. Defaults to None.
      edge_weight (torch.Tensor, optional): one-dimensional weight for each edge. Defaults to None.
  
  Examples:
      >>> import torch
      >>> node_feat = torch.randn(4, 20)
      >>> edge_index = torch.tensor([[0, 1, 2, 3], [1, 2, 3, 0]])
      >>> edge_type = torch.tensor([0, 0, 1, 1])
      >>> edge_weight = torch.randn(4)
      >>> # create a supervertex with homogeneous edges
      >>> supervertex_homo = SuperVertex(node_feat, edge_index)
      >>> # create a supervertex with heterogeneous edges
      >>> supervertex_hete = SuperVertex(node_feat, edge_index, edge_type)
      >>> # create a supervertex with weighted edges
      >>> supervertex_weight1 = SuperVertex(node_feat, edge_index, edge_weight=edge_weight)
      >>> supervertex_weight2 = SuperVertex(node_feat, edge_index, edge_type, edge_weight)
class_docstr_tok: ["The","supervertex","structure","in","GripNet",".","Each","supervertex","is","a","subgraph","containing","nodes","of","the","same","category","that","are","semantically-coherent",".","Supervertices","can","be","homogeneous","or","heterogeneous",".","Args",":","name","(","str",")",":","the","name","of","the","supervertex",".","node_feat","(","torch.Tensor",")",":","node","features","of","the","supervertex","with","shape","[","#","nodes",",","#","features","]",".","We","recommend","using","`","torch.sparse.FloatTensor","(",")","`","if","the","node","feature","matrix","is","sparse",".","edge_index","(","torch.Tensor",")",":","edge","indices","in","COO","format","with","shape","[","2",",","#","edges","]",".","edge_type","(","torch.Tensor",",","optional",")",":","one-dimensional","relation","type","for","each","edge",",","indexed","from","0",".","Defaults","to","None",".","edge_weight","(","torch.Tensor",",","optional",")",":","one-dimensional","weight","for","each","edge",".","Defaults","to","None",".","Examples",":",">",">",">","import","torch",">",">",">","node_feat","=","torch.randn","(","4",",","20",")",">",">",">","edge_index","=","torch.tensor","(","[","[","0",",","1",",","2",",","3","]",",","[","1",",","2",",","3",",","0","]","]",")",">",">",">","edge_type","=","torch.tensor","(","[","0",",","0",",","1",",","1","]",")",">",">",">","edge_weight","=","torch.randn","(","4",")",">",">",">","#","create","a","supervertex","with","homogeneous","edges",">",">",">","supervertex_homo","=","SuperVertex","(","node_feat",",","edge_index",")",">",">",">","#","create","a","supervertex","with","heterogeneous","edges",">",">",">","supervertex_hete","=","SuperVertex","(","node_feat",",","edge_index",",","edge_type",")",">",">",">","#","create","a","supervertex","with","weighted","edges",">",">",">","supervertex_weight1","=","SuperVertex","(","node_feat",",","edge_index",",","edge_weight=edge_weight",")",">",">",">","supervertex_weight2","=","SuperVertex","(","node_feat",",","edge_index",",","edge_type",",","edge_weight",")"]
docstr: get the range of edge types
docstr_tok: ["get","the","range","of","edge","types"]
code: def __get_range_list__(self):
      """get the range of edge types"""
      idx = 0
      range_list = [[0, 0]]
  
      for i, edge_type in enumerate(self.edge_type):
          if edge_type != idx:
              idx = edge_type
              range_list[-1][1] = i
              range_list.append([i, i])
  
      range_list[-1][1] = i + 1
  
      self.range_list = torch.tensor(range_list)
  
imports: import logging
  from typing import Dict, List, Optional
  import networkx
  import torch
label_desc: Use image node_id 3 for calling the SuperVertex obj's underlying member method code with example usage: obj.__get_range_list__() without return types