FreeTensor
Loading...
Searching...
No Matches
user_grad.h
Go to the documentation of this file.
1#ifndef FREE_TENSOR_USER_GRAD_H
2#define FREE_TENSOR_USER_GRAD_H
3
4#include <optional>
5#include <unordered_set>
6
7#include <stmt.h>
8
9namespace freetensor {
10
13 std::unordered_set<ID> oriStmts_;
14
17
18 StmtSetToUserGrad(const std::unordered_set<ID> &oriStmts,
19 const Stmt &bwdBody)
20 : oriStmts_(oriStmts), bwdBody_(bwdBody) {}
21};
22
26
29
30 RangeToUserGrad(const ID &oriBegin, const ID &oriEnd, const Stmt &bwdBody)
31 : oriBegin_(oriBegin), oriEnd_(oriEnd), bwdBody_(bwdBody) {}
32};
33
34std::optional<std::pair<ID, ID>>
35getRangeFromStmtSeq(const Stmt &op, const std::unordered_set<ID> &stmts);
36
37} // namespace freetensor
38
39#endif // FREE_TENSOR_USER_GRAD_H
Definition: id.h:18
Definition: allocator.h:9
std::optional< std::pair< ID, ID > > getRangeFromStmtSeq(const Stmt &op, const std::unordered_set< ID > &stmts)
Definition: user_grad.cc:53
Ref< StmtNode > Stmt
Definition: ast.h:152
Definition: user_grad.h:23
RangeToUserGrad(const ID &oriBegin, const ID &oriEnd, const Stmt &bwdBody)
Definition: user_grad.h:30
ID oriBegin_
Range of statements in the original program, inclusive.
Definition: user_grad.h:25
Stmt bwdBody_
Backward statement (can be a scope)
Definition: user_grad.h:28
ID oriEnd_
Definition: user_grad.h:25
Definition: user_grad.h:11
StmtSetToUserGrad(const std::unordered_set< ID > &oriStmts, const Stmt &bwdBody)
Definition: user_grad.h:18
Stmt bwdBody_
Backward statement (can be a scope)
Definition: user_grad.h:16
std::unordered_set< ID > oriStmts_
Set of statements in the original program.
Definition: user_grad.h:13