#pragma once #include #include #include namespace torch { namespace autograd { using hooks_list = std::vector>; struct CppFunctionTensorPreHook : public FunctionPreHook { CppFunctionTensorPreHook(std::shared_ptr hooks, int value_idx); variable_list operator()(const variable_list& values) override; std::shared_ptr hooks_; int value_idx_; }; struct CppFunctionSingleTensorPreHook : public FunctionPreHook { CppFunctionSingleTensorPreHook( std::function hook, int value_idx); variable_list operator()(const variable_list& values) override; std::function hook_; int value_idx_; }; } // namespace autograd } // namespace torch