xref: /aosp_15_r20/external/pytorch/test/cpp/api/nested.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #include <gtest/gtest.h>
2 
3 #include <torch/nested.h>
4 #include <torch/torch.h>
5 
6 #include <test/cpp/api/support.h>
7 
8 // Simple test that verifies the nested namespace is registered properly
9 //   properly in C++
TEST(NestedTest,Nested)10 TEST(NestedTest, Nested) {
11   auto a = torch::randn({2, 3});
12   auto b = torch::randn({4, 5});
13   auto nt = torch::nested::nested_tensor({a, b});
14   torch::nested::to_padded_tensor(nt, 0);
15 }
16