Repository: pytorch
Issue: The libtorch test TestScalarTensor.TestScalarTensorMPS fails on Apple Silicon
Labels: triaged,actionable,module: mps,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/scalar_tensor_test
```

I get this error:

```
[ RUN      ] TestScalarTensor.TestScalarTensorMPS
/Users/samueles/github/pytorch/pytorch/aten/src/ATen/test/scalar_tensor_test.cpp:64: Failure
Expected: ss << t << std::endl doesn't throw an exception.
  Actual: it throws c10::TypeError with description "Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
Exception raised from empty_mps at /Users/samueles/github/pytorch/pytorch/aten/src/ATen/mps/EmptyTensor.cpp:40 (most recent call first):
frame #0: at::detail::empty_mps(c10::ArrayRef<long long>, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, c10::optional<c10::MemoryFormat>) + 1048 (0x10e32c944 in libtorch_cpu.dylib)
frame #1: at::native::empty_mps(c10::ArrayRef<long long>, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, c10::optional<c10::MemoryFormat>) + 48 (0x10e3370c4 in libtorch_cpu.dylib)
frame #2: at::native::mps::mps_copy_(at::Tensor&, at::Tensor const&, bool) + 6116 (0x10e368718 in libtorch_cpu.dylib)
frame #3: at::native::copy_impl(at::Tensor&, at::Tensor const&, bool) + 1484 (0x10a4dba5c in libtorch_cpu.dylib)
frame #4: at::native::copy_(at::Tensor&, at::Tensor const&, bool) + 100 (0x10a4db3d0 in libtorch_cpu.dylib)
frame #5: at::_ops::copy_::call(at::Tensor&, at::Tensor const&, bool) + 288 (0x10b114334 in libtorch_cpu.dylib)
frame #6: at::native::_to_copy(at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>) + 2984 (0x10a801564 in libtorch_cpu.dylib)
frame #7: at::_ops::_to_copy::redispatch(c10::DispatchKeySet, at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>) + 188 (0x10aca4588 in libtorch_cpu.dylib)
frame #8: at::_ops::_to_copy::redispatch(c10::DispatchKeySet, at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>) + 188 (0x10aca4588 in libtorch_cpu.dylib)
frame #9: c10::impl::wrap_kernel_functor_unboxed_<c10::impl::detail::WrapFunctionIntoFunctor_<c10::CompileTimeFunctionPointer<at::Tensor (c10::DispatchKeySet, at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>), &(torch::autograd::VariableType::(anonymous namespace)::_to_copy(c10::DispatchKeySet, at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>))>, at::Tensor, c10::guts::typelist::typelist<c10::DispatchKeySet, at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat> > >, at::Tensor (c10::DispatchKeySet, at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>)>::call(c10::OperatorKernel*, c10::DispatchKeySet, at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>) + 1096 (0x10c836cc8 in libtorch_cpu.dylib)
frame #10: at::_ops::_to_copy::call(at::Tensor const&, c10::optional<c10::ScalarType>, c10::optional<c10::Layout>, c10::optional<c10::Device>, c10::optional<bool>, bool, c10::optional<c10::MemoryFormat>) + 340 (0x10aca4250 in libtorch_cpu.dylib)
frame #11: at::_ops::to_device::call(at::Tensor const&, c10::Device, c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>) + 320 (0x10ae5c320 in libtorch_cpu.dylib)
frame #12: at::print(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, at::Tensor const&, long long) + 188 (0x10a323804 in libtorch_cpu.dylib)
frame #13: test(at::DeprecatedTypeProperties&) + 2136 (0x100a1c9c4 in scalar_tensor_test)
frame #14: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 116 (0x100a380c8 in scalar_tensor_test)
frame #15: testing::Test::Run() + 812 (0x100a37ffc in scalar_tensor_test)
frame #16: testing::TestInfo::Run() + 840 (0x100a39924 in scalar_tensor_test)
frame #17: testing::TestSuite::Run() + 348 (0x100a3a3d0 in scalar_tensor_test)
frame #18: testing::internal::UnitTestImpl::RunAllTests() + 1632 (0x100a4b594 in scalar_tensor_test)
frame #19: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 116 (0x100a4ad7c in scalar_tensor_test)
frame #20: testing::UnitTest::Run() + 124 (0x100a4acd4 in scalar_tensor_test)
frame #21: main + 68 (0x100a29234 in scalar_tensor_test)
frame #22: start + 520 (0x100c7508c in dyld)
".
[  FAILED  ] TestScalarTensor.TestScalarTensorMPS (20 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 @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr @abhudev