I have a function computing fft2 containing this code:
  void DoSomeThing(Tensor *x)
  {
    c10::optional<IntArrayRef> n_opt = c10::nullopt;
    c10::optional<IntArrayRef> norm= c10::nullopt;
    IntArrayRef dim_arr = {-2, 1};
    Tensor z = torch::fft::fft2(*x, n_opt, dim_arr, norm);
  }

it will fail in release mode but not in debug mode. The issue seem to be that fft2 find huge values for dim_arr. E.g. values like 10032412311. (Note that if I print the content of dim_arr I got -2 and -1.) If I change it to
  void DoSomeThing(Tensor *x)
  {
    c10::optional<IntArrayRef> n_opt = c10::nullopt;
    c10::optional<IntArrayRef> norm= c10::nullopt;
    int64_t arr[2] = {-2,-1};
    IntArrayRef dim_arr = IntArrayRef(arr, 2) ;
    Tensor z = torch::fft::fft2(*x, n_opt, dim_arr, norm);
  }

it works fine. Note that this also works fine:
  void DoSomeThing(Tensor *x)
  {
    c10::optional<IntArrayRef> n_opt = c10::nullopt;
    c10::optional<IntArrayRef> norm= c10::nullopt;
    Tensor z = torch::fft::fft2(*x, n_opt,  {-2,-1}, norm);
  }

I probably missed some essential c++ here. That one cannot initialize a IntArrayRef using a list other than in a function argument list.
Someone who can explain what is happening?