mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Custom transforms (#1246)
This commit is contained in:
committed by
GitHub
parent
a3c287354f
commit
5c1fa64fb0
@@ -50,4 +50,20 @@ struct InTracing {
|
||||
static int tracing_counter;
|
||||
};
|
||||
|
||||
struct RetainGraph {
|
||||
RetainGraph() {
|
||||
tracing_counter++;
|
||||
}
|
||||
~RetainGraph() {
|
||||
tracing_counter--;
|
||||
}
|
||||
|
||||
static bool retain_graph() {
|
||||
return tracing_counter > 0;
|
||||
}
|
||||
|
||||
private:
|
||||
static int tracing_counter;
|
||||
};
|
||||
|
||||
} // namespace mlx::core::detail
|
||||
|
||||
Reference in New Issue
Block a user