class_docstr: The base class for various Layer-wise Sampling techniques,
  providing basic functionality of composing sampled data for mini-batches.
  
  Parameters
  ------------
  edge_index:
      edge index of integral graph
  target_nodes_indexes:
      indexes of target nodes in the integral graph
  layer_wise_arguments:
      layer-wise arguments for sampling
  batch_size:
      batch size for target nodes
  num_workers:
      number of workers
  shuffle:
      flag for shuffling, default to True
  kwargs:
      remaining keyword arguments
class_docstr_tok: ["The","base","class","for","various","Layer-wise","Sampling","techniques",",","providing","basic","functionality","of","composing","sampled","data","for","mini-batches",".","Parameters","--","--","--","--","--","--","edge_index",":","edge","index","of","integral","graph","target_nodes_indexes",":","indexes","of","target","nodes","in","the","integral","graph","layer_wise_arguments",":","layer-wise","arguments","for","sampling","batch_size",":","batch","size","for","target","nodes","num_workers",":","number","of","workers","shuffle",":","flag","for","shuffling",",","default","to","True","kwargs",":","remaining","keyword","arguments"]
code: def __sample_layers(
      self, __top_layer_target_nodes_indexes: torch.LongTensor
  ) -> TargetDependantSampledData:
      sampled_edges_for_layers: _typing.List[
          _typing.Tuple[
              torch.LongTensor, _typing.Optional[torch.Tensor]
          ]
      ] = list()
      __current_layer_target_nodes_indexes: torch.LongTensor = (
          __top_layer_target_nodes_indexes
      )
      " Reverse self.__layer_wise_arguments from bottom-up to top-down "
      for layer_argument in self.__layer_wise_arguments[::-1]:
          current_layer_result: _typing.Tuple[
              torch.LongTensor, _typing.Optional[torch.Tensor]
          ] = self._sample_edges_for_layer(
              __current_layer_target_nodes_indexes,
              __top_layer_target_nodes_indexes,
              layer_argument,
          )
          __source_nodes_indexes_for_current_layer: torch.Tensor = (
              self._edge_index[0, current_layer_result[0]]
          )
          __current_layer_target_nodes_indexes: torch.LongTensor = (
              __source_nodes_indexes_for_current_layer.unique()
          )
          sampled_edges_for_layers.append(current_layer_result)
      """ Reverse sampled_edges_for_layers from top-down to bottom-up """
      sampled_edges_for_layers: _typing.Sequence[
          _typing.Tuple[
              torch.LongTensor, _typing.Optional[torch.Tensor]
          ]
      ] = sampled_edges_for_layers[::-1]
  
      sampled_nodes_in_sub_graph: torch.LongTensor = torch.cat(
          [
              self._edge_index[:, current_layer_result[0]].reshape([-1])
              for current_layer_result in sampled_edges_for_layers
          ]
      ).unique()
      __sampled_nodes_in_sub_graph_mapping: _typing.Dict[
          int, int
      ] = dict(
          list(
              zip(
                  sampled_nodes_in_sub_graph.tolist(),
                  range(sampled_nodes_in_sub_graph.size(0)),
              )
          )
      )
  
      __sampled_edge_index_for_layers_in_sub_graph: _typing.Sequence[
          torch.Tensor
      ] = [
          torch.stack(
              [
                  torch.tensor(
                      [
                          __sampled_nodes_in_sub_graph_mapping.get(
                              node_index
                          )
                          for node_index in self._edge_index[
                              0, current_layer_result[0]
                          ].tolist()
                      ]
                  ),
                  torch.tensor(
                      [
                          __sampled_nodes_in_sub_graph_mapping.get(
                              node_index
                          )
                          for node_index in self._edge_index[
                              1, current_layer_result[0]
                          ].tolist()
                      ]
                  ),
              ]
          )
          for current_layer_result in sampled_edges_for_layers
      ]
  
      return TargetDependantSampledData(
          [
              (temp_tuple[0], temp_tuple[1][0], temp_tuple[1][1])
              for temp_tuple in zip(
                  __sampled_edge_index_for_layers_in_sub_graph,
                  sampled_edges_for_layers,
              )
          ],
          (
              torch.tensor(
                  [
                      __sampled_nodes_in_sub_graph_mapping.get(
                          current_target_node_index_in_integral_data
                      )
                      for current_target_node_index_in_integral_data in __top_layer_target_nodes_indexes.tolist()
                      if current_target_node_index_in_integral_data
                      in __sampled_nodes_in_sub_graph_mapping
                  ]
              ).long(),  # Remap
              torch.tensor(
                  [
                      current_target_node_index_in_integral_data
                      for current_target_node_index_in_integral_data in __top_layer_target_nodes_indexes.tolist()
                      if current_target_node_index_in_integral_data
                      in __sampled_nodes_in_sub_graph_mapping
                  ]
              ).long(),
          ),
          sampled_nodes_in_sub_graph,
      )
  
file_path: AutoGL/autogl/module/train/sampling/sampler/target_dependant_sampler.py
imports: import torch.utils.data
  import typing
label_desc: Use image node_id 5 for calling the BasicLayerWiseTargetDependantSampler obj's underlying member method code with example usage: obj.__sample_layers(__top_layer_target_nodes_indexes) and returns: TargetDependantSampledData