mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert D21089648: Put TORCH_LIBRARY in torch/library.h; add custom class API
Test Plan: revert-hammer Differential Revision: D21089648 Original commit changeset: 8d54329c1252 fbshipit-source-id: 636e8a11afc628a4cdae9d44824985c10c70555e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a05406ea56
commit
2ccdc39dce
@ -5,12 +5,12 @@
|
||||
#include <ATen/core/ivalue.h>
|
||||
#include <ATen/core/jit_type.h>
|
||||
#include <ATen/core/op_registration/infer_schema.h>
|
||||
#include <ATen/core/op_registration/op_registration.h>
|
||||
#include <ATen/core/stack.h>
|
||||
#include <c10/util/C++17.h>
|
||||
#include <c10/util/Metaprogramming.h>
|
||||
#include <c10/util/TypeList.h>
|
||||
#include <c10/util/TypeTraits.h>
|
||||
#include <torch/library.h>
|
||||
#include <torch/custom_class_detail.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@ -270,14 +270,4 @@ using ::torch::class_;
|
||||
|
||||
} // namespace jit
|
||||
|
||||
template <class CurClass>
|
||||
inline class_<CurClass> Library::class_(const std::string& className) {
|
||||
TORCH_CHECK(kind_ == DEF || kind_ == FRAGMENT,
|
||||
"class_(\"", className, "\"): Cannot define a class inside of a TORCH_LIBRARY_IMPL block. "
|
||||
"All class_()s should be placed in the (unique) TORCH_LIBRARY block for their namespace. "
|
||||
"(Error occurred at ", file_, ":", line_, ")");
|
||||
TORCH_INTERNAL_ASSERT(ns_.has_value(), file_, ":", line_);
|
||||
return torch::class_<CurClass>(*ns_, className);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace torch
|
||||
|
Reference in New Issue
Block a user