I profile a model using the torch.profiler, only to find I am confused with the aten::fill_ API. Since there is no specific documentation about ATen, I couldn’t make sense of the original code in the following URL.

  

      github.com
  

  
    pytorch/pytorch/blob/87465a6e68b62fe9a10482b98f42b48c71aacb68/aten/src/ATen/native/Fill.cpp#L35



      
      
            auto iter = TensorIteratorConfig()
              .set_check_mem_overlap(false)  // Fill is idempotent, so overlap is okay
              .check_all_same_dtype(false)
              .add_output(self)
              .resize_outputs(false)
              .build();
            fill_stub(iter.device_type(), iter, value);
            return self;
          }
          
          
Tensor& fill_(Tensor& self, const Scalar& value) {
            return fill_out(self, value);
          }
          
          
Tensor& fill_(Tensor& self, const Tensor& value) {
            TORCH_CHECK(value.dim() == 0, "fill_ only supports 0-dimension value tensor but got tensor with ", value.dim(), " dimensions.");
            return fill_out(self, value.item());
          }
          
          
Tensor& fill_meta_(Tensor& self, const Scalar& value) {
            return self;
      
    
  


  

  
    
    
  

  


What’s the difference between aten::fill_ on GPU and CPU? Compared to GPU, it seems that aten::fill_ costs much more time while running the same model on CPU.
If anyone is familiar with ATen and its APIs, please show me the points of their working mechanism.