class_docstr: Implementation of bigraph interface in pgl.
  
  This is a simple implementation of graph structure in pgl. 
  
  `pgl.BiGraph` is an alias for `pgl.graph.BiGraph` 
  
  Args:
  
      edges: list of (u, v) tuples, 2D numpy.ndarry or 2D paddle.Tensor 
  
      src_num_nodes (optional: int, numpy or paddle.Tensor): Number of src_nodes in a bigraph. 
                         If not provided, the number of src nodes will be infered from edges[:, 0]. 
      dst_num_nodes (optional: int, numpy or paddle.Tensor): Number of dst nodes in a bigraph. 
                         If not provided, the number of dst_nodes will be infered from edges[:, 1]. 
  
      src_node_feat (optional): a dict of numpy array as src node features
      dst_node_feat (optional): a dict of numpy array as dst node features
  
      edge_feat (optional): a dict of numpy array as edge features (should
                              have consistent order with edges)
  
  Examples 1:
  
      - Create a graph with numpy.
      - Convert it into paddle.Tensor .
      - Do send recv for graph neural network.
  
      .. code-block:: python
  
          import numpy as np
          import pgl
  
          src_num_nodes = 4
          dst_num_nodes = 5
          edges = [ (0, 1), (1, 2), (3, 4)]
          src_feat = np.random.randn(4, 100).astype(np.float32)
          dst_feat = np.random.randn(5, 100).astype(np.float32)
          edge_feature = np.random.randn(3, 100).astype(np.float32)
          graph = pgl.BiGraph(
                      src_num_nodes=src_num_nodes,
                      dst_num_nodes=dst_num_nodes,
                      edges=edges,
                      src_node_feat={
                          "src_feat": src_feat
                      },
                      dst_node_feat={
                          "dst_feat": dst_feat
                      },
                      edge_feat={
                          "edge_feature": edge_feature
                      })
          graph.tensor() 
  
  Examples 2: 
  
      - Create a graph with paddle.Tensor.
      - Do send recv for graph neural network.
  
      .. code-block:: python
          import numpy as np
          import pgl
  
          src_num_nodes = 4
          dst_num_nodes = 5
          edges = paddle.to_tensor([ (0, 1), (1, 2), (3, 4)])
          src_feat = np.random.randn(4, 100).astype(np.float32)
          src_feat = paddle.to_tensor(src_feat)
          dst_feat = np.random.randn(5, 100).astype(np.float32)
          dst_feat = paddle.to_tensor(dst_feat)
          edge_feature = np.random.randn(3, 100).astype(np.float32)
          edge_feature = paddle.to_tensor(edge_feature)
          graph = pgl.BiGraph(
                      src_num_nodes=src_num_nodes,
                      dst_num_nodes=dst_num_nodes,
                      edges=edges,
                      src_node_feat={
                          "src_feat": src_feat
                      },
                      dst_node_feat={
                          "dst_feat": dst_feat
                      },
                      edge_feat={
                          "edge_feature": edge_feature
                      })
class_docstr_tok: ["Implementation","of","bigraph","interface","in","pgl",".","This","is","a","simple","implementation","of","graph","structure","in","pgl",".","`","pgl.BiGraph","`","is","an","alias","for","`","pgl.graph.BiGraph","`","Args",":","edges",":","list","of","(","u",",","v",")","tuples",",","2D","numpy.ndarry","or","2D","paddle.Tensor","src_num_nodes","(","optional",":","int",",","numpy","or","paddle.Tensor",")",":","Number","of","src_nodes","in","a","bigraph",".","If","not","provided",",","the","number","of","src","nodes","will","be","infered","from","edges","[",":",",","0","]",".","dst_num_nodes","(","optional",":","int",",","numpy","or","paddle.Tensor",")",":","Number","of","dst","nodes","in","a","bigraph",".","If","not","provided",",","the","number","of","dst_nodes","will","be","infered","from","edges","[",":",",","1","]",".","src_node_feat","(","optional",")",":","a","dict","of","numpy","array","as","src","node","features","dst_node_feat","(","optional",")",":","a","dict","of","numpy","array","as","dst","node","features","edge_feat","(","optional",")",":","a","dict","of","numpy","array","as","edge","features","(","should","have","consistent","order","with","edges",")","Examples","1",":","-","Create","a","graph","with","numpy",".","-","Convert","it","into","paddle.Tensor",".","-","Do","send","recv","for","graph","neural","network",".","..","code-block",":",":","python","import","numpy","as","np","import","pgl","src_num_nodes","=","4","dst_num_nodes","=","5","edges","=","[","(","0",",","1",")",",","(","1",",","2",")",",","(","3",",","4",")","]","src_feat","=","np.random.randn","(","4",",","100",")",".astype","(","np.float32",")","dst_feat","=","np.random.randn","(","5",",","100",")",".astype","(","np.float32",")","edge_feature","=","np.random.randn","(","3",",","100",")",".astype","(","np.float32",")","graph","=","pgl.BiGraph","(","src_num_nodes=src_num_nodes",",","dst_num_nodes=dst_num_nodes",",","edges=edges",",","src_node_feat=","{","``","src_feat","''",":","src_feat","}",",","dst_node_feat=","{","``","dst_feat","''",":","dst_feat","}",",","edge_feat=","{","``","edge_feature","''",":","edge_feature","}",")","graph.tensor","(",")","Examples","2",":","-","Create","a","graph","with","paddle.Tensor",".","-","Do","send","recv","for","graph","neural","network",".","..","code-block",":",":","python","import","numpy","as","np","import","pgl","src_num_nodes","=","4","dst_num_nodes","=","5","edges","=","paddle.to_tensor","(","[","(","0",",","1",")",",","(","1",",","2",")",",","(","3",",","4",")","]",")","src_feat","=","np.random.randn","(","4",",","100",")",".astype","(","np.float32",")","src_feat","=","paddle.to_tensor","(","src_feat",")","dst_feat","=","np.random.randn","(","5",",","100",")",".astype","(","np.float32",")","dst_feat","=","paddle.to_tensor","(","dst_feat",")","edge_feature","=","np.random.randn","(","3",",","100",")",".astype","(","np.float32",")","edge_feature","=","paddle.to_tensor","(","edge_feature",")","graph","=","pgl.BiGraph","(","src_num_nodes=src_num_nodes",",","dst_num_nodes=dst_num_nodes",",","edges=edges",",","src_node_feat=","{","``","src_feat","''",":","src_feat","}",",","dst_node_feat=","{","``","dst_feat","''",":","dst_feat","}",",","edge_feat=","{","``","edge_feature","''",":","edge_feature","}",")"]
docstr: Convert the BiGraph into paddle.Tensor format.
  
  In paddle.Tensor format, the bigraph edges and node features are in paddle.Tensor format.
  You can use send and recv in paddle.Tensor bigraph.
  
  Args:
  
      inplace: (Default True) Whether to convert the bigraph into tensor inplace. 
docstr_tok: ["Convert","the","BiGraph","into","paddle.Tensor","format",".","In","paddle.Tensor","format",",","the","bigraph","edges","and","node","features","are","in","paddle.Tensor","format",".","You","can","use","send","and","recv","in","paddle.Tensor","bigraph",".","Args",":","inplace",":","(","Default","True",")","Whether","to","convert","the","bigraph","into","tensor","inplace","."]
code: def tensor(self, inplace=True):
      """Convert the BiGraph into paddle.Tensor format.
  
      In paddle.Tensor format, the bigraph edges and node features are in paddle.Tensor format.
      You can use send and recv in paddle.Tensor bigraph.
  
      Args:
  
          inplace: (Default True) Whether to convert the bigraph into tensor inplace.
  
      """
      if self._is_tensor:
          return self
  
      if inplace:
          for key in self.__dict__:
              self.__dict__[key] = self._apply_to_tensor(
                  key, self.__dict__[key], inplace
              )
          return self
      else:
          new_dict = {}
          for key in self.__dict__:
              new_dict[key] = self._apply_to_tensor(
                  key, self.__dict__[key], inplace
              )
  
          graph = self.__class__(
              src_num_nodes=new_dict["_src_num_nodes"],
              dst_num_nodes=new_dict["_dst_num_nodes"],
              edges=new_dict["_edges"],
              src_node_feat=new_dict["_src_node_feat"],
              dst_node_feat=new_dict["_dst_node_feat"],
              edge_feat=new_dict["_edge_feat"],
              adj_src_index=new_dict["_adj_src_index"],
              adj_dst_index=new_dict["_adj_dst_index"],
              **new_dict,
          )
          return graph
  
imports: import os
  import json
  import copy
  import warnings
  from collections import defaultdict
  import numpy
  import paddle
  import paddle.distributed
  from pgl.utils import op
  import pgl.graph_kernel
  from pgl.message import Message
  from pgl.utils.edge_index import EdgeIndex
  from pgl.utils.helper import check_is_tensor, maybe_num_nodes
  from pgl.utils.helper import generate_segment_id_from_index, unique_segment
label_desc: Use image node_id 6 for calling the BiGraph obj's underlying member method code with example usage: obj.tensor(inplace) and returns: self, self, graph