torch/csrc/jit/passes/to_batch.cpp
// clone prim::TensorToNum to new graph
clone prim::TensorToNum to new graph
clone prim :: TensorToNum to new graph
void ToBatch::visitTensorToNum(Node* n, Block* block, Block* res_block){
  auto res_graph = res_block->owningGraph();
  if(rn_env.find(n->input()) == rn_env.end()){
    rn_env[n->input()] = batch_map.at(n->input())[0];
  }
  auto* r_node = res_graph->createClone(n, rn_fn);
  r_node->setStage(n->stage());
  res_block->appendNode(r_node);
  rn_env[n->output()] = r_node->output();
  batch_map[n->output()] = batch_map.at(n->input());
}
void ToBatch :: visitTensorToNum ( Node * n , Block * block , Block * res_block ) { auto res_graph = res_block -> owningGraph ( ) ; if ( rn_env . find ( n -> input ( ) ) == rn_env . end ( ) ) { rn_env [ n -> input ( ) ] = batch_map . at ( n -> input ( ) ) [ 0 ] ; } auto * r_node = res_graph -> createClone ( n , rn_fn ) ; r_node -> setStage ( n -> stage ( ) ) ; res_block -> appendNode ( r_node ) ; rn_env [ n -> output ( ) ] = r_node -> output ( ) ; batch_map [ n -> output ( ) ] = batch_map . at ( n -> input ( ) ) ; }
clone prim::TensorToNum to new graph
clone prim :: TensorToNum to new graph