torch/csrc/jit/passes/to_batch.cpp
// clone prim::Constant to new graph
// batching transformation is applied to the output of prim::NumToTensor.
// If there is a prim::NumToTensor following prim::Constant, it will be finally transformed to BatchTensor.
clone prim::Constant to new graph
batching transformation is applied to the output of prim::NumToTensor.
If there is a prim::NumToTensor following prim::Constant, it will be finally transformed to BatchTensor.
clone prim :: Constant to new graph batching transformation is applied to the output of prim :: NumToTensor . If there is a prim :: NumToTensor following prim :: Constant it will be finally transformed to BatchTensor .
void ToBatch::visitConstant(Node* n, Block* block, Block* res_block){
  auto res_graph = res_block->owningGraph();
  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();
}
void ToBatch :: visitConstant ( Node * n , Block * block , Block * res_block ) { auto res_graph = res_block -> owningGraph ( ) ; 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 ( ) ; }
clone prim::Constant to new graph
batching transformation is applied to the output of prim::NumToTensor.
clone prim :: Constant to new graph batching transformation is applied to the output of prim :: NumToTensor .