File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,17 @@ using thpp::Tensor;
2222
2323namespace torch { namespace autograd {
2424
25+ struct FunctionTask {
26+ BackwardTask* base;
27+ std::shared_ptr<Function> fn;
28+ GradBuffer grad;
29+
30+ FunctionTask (BackwardTask* base, std::shared_ptr<Function> fn, GradBuffer grad)
31+ : base(base)
32+ , fn(fn)
33+ , grad(std::move(grad)) {}
34+ };
35+
2536struct ReadyQueue {
2637 std::deque<FunctionTask> queue;
2738 std::condition_variable not_empty;
@@ -55,17 +66,6 @@ struct BackwardTask {
5566 , dependencies() {}
5667};
5768
58- struct FunctionTask {
59- BackwardTask* base;
60- std::shared_ptr<Function> fn;
61- GradBuffer grad;
62-
63- FunctionTask (BackwardTask* base, std::shared_ptr<Function> fn, GradBuffer grad)
64- : base(base)
65- , fn(fn)
66- , grad(std::move(grad)) {}
67- };
68-
6969auto ReadyQueue::push_front (FunctionTask item) -> void {
7070 {
7171 std::lock_guard<std::mutex> lock (mutex);
Original file line number Diff line number Diff line change 11#include " function.h"
22
3+ #include < string>
34#include < THPP/THPP.h>
45
56#include " variable.h"
Original file line number Diff line number Diff line change 11#include " tuple_parser.h"
22
3+ #include < string>
4+
35#include " torch/csrc/DynamicTypes.h"
46#include " torch/csrc/autograd/python_variable.h"
57#include " python_numbers.h"
You can’t perform that action at this time.
0 commit comments