Repository: pytorch
Issue: Error: ‘str’ is not a member of ‘c10’; did you mean ‘c10::aten::str’? while using libtorch
Labels: module: cpp,triaged

## 🐛 Bug

While trying to reproduce the first example in the libtorch tutorial ( https://pytorch.org/tutorials/advanced/cpp_frontend.html ) the code does not compile and the following error is given: 

``` 
/home/*****/Downloads/libtorch/include/ATen/core/interned_strings.h:530:1: note: ‘c10::aten::str’ declared here
  530 | FORALL_NS_SYMBOLS(DEFINE_SYMBOL)
      | ^~~~~~~~~~~~~~~~~
In file included from /home/*****/Downloads/libtorch/include/c10/core/Device.h:5,
                 from /home/*****/Downloads/libtorch/include/c10/core/Allocator.h:6,
                 from /home/*****/Downloads/libtorch/include/ATen/ATen.h:7,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/all.h:8,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/*****/Desktop/example/example.cpp:1:
/home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/optim/adagrad.h:55:5: error: ‘str’ is not a member of ‘c10’; did you mean ‘c10::aten::str’?
   55 |     TORCH_CHECK(defaults.eps() >= 0, "Invalid epsilon value: ", defaults.eps());
      |     ^~~~~~~~~~~
In file included from /home/*****/Downloads/libtorch/include/ATen/core/Dimname.h:3,
                 from /home/*****/Downloads/libtorch/include/ATen/core/NamedTensor.h:3,
                 from /home/*****/Downloads/libtorch/include/ATen/core/TensorBody.h:22,
                 from /home/*****/Downloads/libtorch/include/ATen/Tensor.h:3,
                 from /home/*****/Downloads/libtorch/include/ATen/Context.h:4,
                 from /home/*****/Downloads/libtorch/include/ATen/ATen.h:9,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/all.h:8,
                 from /home/*****/Downloads/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/*****/Desktop/example/example.cpp:1: 
```

## To Reproduce

Steps to reproduce the behavior:

1. Follow the tutorial given in the bug report and try to compile the code using the CMakeLists.txt file 



## Expected behavior

It was expected that the code would compile and being built correctly as shown in the tutorial. 

## Environment

Collecting environment information...
PyTorch version: 1.7.1
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: version 3.19.4

Python version: 3.8 (64-bit runtime)
Is CUDA available: True
CUDA runtime version: 11.2
GPU models and configuration: GPU 0: GeForce RTX 3060 Ti
Nvidia driver version: 460.27.04
cuDNN version: 8.1.0.77
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.0
[pip3] torch==1.7.1
[pip3] torchvision==0.8.2
[conda] Could not collect


## Additional context

Used CMakeLists file: 

```
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(example)

set(CMAKE_PREFIX_PATH "libtorch/share/cmake/Torch")

set(Torch_DIR "/home/*****/Downloads/libtorch/share/cmake/Torch")
find_package(Torch REQUIRED)

add_executable(example example.cpp)
target_link_libraries(example "${TORCH_LIBRARIES}")
set_property(TARGET example PROPERTY CXX_STANDARD 11)
```

cc @yf225 @glaringlee