xref: /aosp_15_r20/external/pytorch/functorch/csrc/init_dim_only.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // This source code is licensed under the BSD-style license found in the
5 // LICENSE file in the root directory of this source tree.
6 
7 #include <torch/extension.h>
8 #include <functorch/csrc/dim/dim.h>
9 
10 namespace at {
11 namespace functorch {
12 
PYBIND11_MODULE(TORCH_EXTENSION_NAME,m)13 PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
14   // initialize first-class dims and install it as a submodule on _C
15   auto dim = Dim_init();
16   if (!dim) {
17     throw py::error_already_set();
18   }
19   py::setattr(m, "dim", py::reinterpret_steal<py::object>(dim));
20 }
21 
22 }}
23