pytorch/test/cpp/api/tensor_cuda.cpp
Gregory Chanan e00fb69b25 Use CATCH prefix to avoid name conflicts with Caffe2.
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/11780

Differential Revision: D9889925

Pulled By: gchanan

fbshipit-source-id: 5eca849c36ced00b8ae7482b7945b445a3e1687e
2018-09-18 08:12:45 -07:00

11 lines
331 B
C++

#include "catch_utils.hpp"
#include <ATen/ATen.h>
#include <cmath>
CATCH_TEST_CASE("Tensor/AllocatesTensorOnTheCorrectDevice", "[multi-cuda]") {
auto tensor = at::tensor({1, 2, 3}, at::device({at::kCUDA, 1}));
CATCH_REQUIRE(tensor.device().type() == at::Device::Type::CUDA);
CATCH_REQUIRE(tensor.device().index() == 1);
}