Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit 6dfa19e

Browse files
zdevitozou3519
authored andcommitted
Add _unsafe_set_level for torchdim (#924)
[torchdim](https://github.com/facebookresearch/torchdim) reuses BatchTensorImpl objects where it can across batched invocations, but needs to patch their levels to match what _vmap_increment_nesting returns. [ghstack-poisoned]
1 parent 442483c commit 6dfa19e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

functorch/csrc/BatchedTensorImpl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ struct BatchedTensorImpl : public c10::TensorImpl {
7878
#endif
7979

8080
void refreshTensorMetadata();
81-
81+
void _unsafe_set_level(int64_t level) {
82+
level_ = level;
83+
}
8284
private:
8385
// see NOTE: [BatchedTensorImpl levels invariant]
8486
void checkInvariants() const;

0 commit comments

Comments
 (0)