Skip to content

Commit bd0e9a7

Browse files
Teaonlysoumith
authored andcommitted
Fix some simple build error on MacOS (pytorch#949)
Issue pytorch#948 Signed-off-by: Zhou Chang <[email protected]>
1 parent 2b1cd91 commit bd0e9a7

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

torch/csrc/autograd/engine.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ using thpp::Tensor;
2222

2323
namespace 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+
2536
struct 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-
6969
auto ReadyQueue::push_front(FunctionTask item) -> void {
7070
{
7171
std::lock_guard<std::mutex> lock(mutex);

torch/csrc/autograd/function.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "function.h"
22

3+
#include <string>
34
#include <THPP/THPP.h>
45

56
#include "variable.h"

torch/csrc/utils/tuple_parser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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"

0 commit comments

Comments
 (0)