maybe implementation of torch.repeat is here,

  
      github.com
  
  
    zdevito/ATen/blob/2448a0d8b547e8c787bb948a23009c375c46272c/aten/src/ATen/native/TensorShape.cpp
#include <TH/THTensor.hpp>
#include <algorithm>
#include <vector>
#include <ATen/ATen.h>
#include <ATen/ExpandUtils.h>
#include <ATen/InferSize.h>
#include <ATen/NativeFunctions.h>
#include <ATen/WrapDimUtils.h>
#include <c10/util/Exception.h>
#include <c10/util/Optional.h>
#include <ATen/native/Resize.h>
#include <ATen/SparseTensorUtils.h>
#include <ATen/quantized/QTensorImpl.h>
#include <algorithm>
#include <vector>
#include <ATen/NamedTensorUtils.h>
#include <ATen/core/EnableNamedTensor.h>

namespace at {
namespace native {


  This file has been truncated. show original

  
  
    
    
  
  


where they say, add new leading dimensions to the tensor if the number of target dimensions is larger than the number of source dimensions, that is this,
Screenshot (652)1208×565 27.8 KB