What is `sym_size` and how is it different from `size` in pytorch C++?

Here is a sample code:

#include <torch/torch.h>
#include <iostream>

int main() {
  torch::Tensor input = torch::rand({2, 3});

  auto size = input.sizes();
  // What is sym_size and how is it different from size?
  auto sym_size = input.sym_sizes();

  std::cout  << " size " << size << " sym size " << sym_size << std::endl;
  // prints size [2, 3] sym size [2, 3]
}

In the above snippet, what is sym_size and how is it different from size?

1 Like

sym_size should correspond to symbolic shape and is used during tracing. Unless you are working on the symbolic tracing this method might not be useful.

1 Like