Repository: pytorch
Issue: The libtorch test SequentialTest.ModuleForwardMethodOptionalArg fails on Apple Silicon
Labels: module: build,triaged,module: m1

### 🐛 Describe the bug

Following [these docs](https://github.com/pytorch/pytorch/blob/v1.13.0/docs/libtorch.rst#building-libtorch-using-python) to build libtorch v1.13.0, then running one of the test binaries:

```sh
gh repo clone pytorch/pytorch && cd pytorch
git checkout v1.13.0
git submodule update --init --recursive
mkdir build_libtorch && cd build_libtorch
python ../tools/build_libtorch.py
build/bin/test_api
```

I get this error:

```
[ RUN      ] SequentialTest.ModuleForwardMethodOptionalArg
unknown file: Failure
C++ exception with description "Expected argument #1 to be of type c10::optional<c10::ArrayRef<long long> >, but received value of type c10::optional<c10::ArrayRef<long long> >
Exception raised from operator() at /Users/samueles/github/pytorch/pytorch/torch/csrc/api/include/torch/nn/modules/container/any_module_holder.h:55 (most recent call first):
frame #0: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 92 (0x105e4669c in libc10.dylib)
frame #1: std::__1::decay<c10::optional<c10::ArrayRef<long long> > const&>::type&& torch::nn::AnyModuleHolder<torch::nn::ConvTranspose1dImpl, at::Tensor const&, c10::optional<c10::ArrayRef<long long> > const&>::CheckedGetter::operator()<c10::optional<c10::ArrayRef<long long> > const&>(unsigned long) + 348 (0x10529c608 in test_api)
frame #2: torch::nn::AnyModuleHolder<torch::nn::ConvTranspose1dImpl, at::Tensor const&, c10::optional<c10::ArrayRef<long long> > const&>::forward(std::__1::vector<torch::nn::AnyValue, std::__1::allocator<torch::nn::AnyValue> >&&) + 480 (0x10529bd24 in test_api)
frame #3: torch::nn::AnyValue torch::nn::AnyModule::any_forward<torch::nn::AnyValue>(torch::nn::AnyValue&&) + 136 (0x1051c6ac8 in test_api)
frame #4: at::Tensor torch::nn::SequentialImpl::forward<at::Tensor, at::Tensor&>(at::Tensor&) + 84 (0x1051c65fc in test_api)
frame #5: SequentialTest_ModuleForwardMethodOptionalArg_Test::TestBody() + 1696 (0x105226274 in test_api)
frame #6: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 116 (0x1055a2588 in test_api)
frame #7: testing::Test::Run() + 812 (0x1055a24bc in test_api)
frame #8: testing::TestInfo::Run() + 840 (0x1055a3de4 in test_api)
frame #9: testing::TestSuite::Run() + 348 (0x1055a4890 in test_api)
frame #10: testing::internal::UnitTestImpl::RunAllTests() + 1632 (0x1055b5a54 in test_api)
frame #11: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 116 (0x1055b523c in test_api)
frame #12: testing::UnitTest::Run() + 124 (0x1055b5194 in test_api)
frame #13: main + 440 (0x104accb30 in test_api)
frame #14: start + 520 (0x105c6508c in dyld)
" thrown in the test body.
[  FAILED  ] SequentialTest.ModuleForwardMethodOptionalArg (0 ms)
```

### Versions

PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: macOS 12.6.1 (arm64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.202)
CMake version: version 3.24.2
Libc version: N/A

Python version: 3.9.7 (default, Sep 8 2021, 10:47:21) [Clang 12.0.5 (clang-1205.0.22.11)] (64-bit runtime)
Python platform: macOS-12.6.1-arm64-arm-64bit
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.23.2
[pip3] torch==1.12.1
[pip3] torchvision==0.13.1
[conda] Could not collect

cc @malfet @seemethere