pytorch/test/cpp/api/torch_include.cpp
Ilia Cherniavskii 5835165ce3 Add get/set_num_interop_threads into torch.h include (#20659)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/20659
ghimport-source-id: 4858d03a9f89c613f64901c3430a7b212f76eb95

Reviewed By: dzhulgakov

Differential Revision: D15399780

Pulled By: ilia-cher

fbshipit-source-id: c1c3cb628c5ee664468f9d181bcd76a5105a89fd
2019-05-20 00:34:59 -07:00

15 lines
429 B
C++

#include <gtest/gtest.h>
#include <torch/torch.h>
// NOTE: This test suite exists to make sure that common `torch::` functions
// can be used without additional includes beyond `torch/torch.h`.
TEST(TorchIncludeTest, GetSetNumThreads) {
torch::init_num_threads();
torch::set_num_threads(2);
ASSERT_EQ(torch::get_num_threads(), 2);
torch::set_num_interop_threads(2);
ASSERT_EQ(torch::get_num_interop_threads(), 2);
}