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

Commit 6452ee3

Browse files
authored
Clearly mark the old batching rule API as "legacy" (#897)
It's possible it is buggy and we should aim to delete the old batching rule API in the future.
1 parent 14cda62 commit 6452ee3

File tree

7 files changed

+13
-6
lines changed

7 files changed

+13
-6
lines changed

functorch/csrc/BatchRulesHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <functorch/csrc/DynamicLayer.h>
1313
#include <functorch/csrc/TensorWrapper.h>
1414
#include <functorch/csrc/BatchingMetaprogramming.h>
15-
#include <functorch/csrc/VmapTransforms.h>
15+
#include <functorch/csrc/LegacyVmapTransforms.h>
1616
#include <functorch/csrc/BatchedFallback.h>
1717
#include <functorch/csrc/PlumbingHelper.h>
1818
#include <ATen/core/dispatch/Dispatcher.h>

functorch/csrc/BatchedFallback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// LICENSE file in the root directory of this source tree.
66

77
#include <functorch/csrc/BatchedFallback.h>
8-
#include <functorch/csrc/VmapTransforms.h>
8+
#include <functorch/csrc/LegacyVmapTransforms.h>
99
#include <functorch/csrc/Constants.h>
1010
#include <functorch/csrc/TensorWrapper.h>
1111
#include <functorch/csrc/DynamicLayer.h>

functorch/csrc/BatchingRegistrations.cpp renamed to functorch/csrc/LegacyBatchingRegistrations.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <functorch/csrc/DynamicLayer.h>
1313
#include <functorch/csrc/TensorWrapper.h>
1414
#include <functorch/csrc/BatchingMetaprogramming.h>
15-
#include <functorch/csrc/VmapTransforms.h>
15+
#include <functorch/csrc/LegacyVmapTransforms.h>
1616
#include <functorch/csrc/BatchedFallback.h>
1717
#include <functorch/csrc/Constants.h>
1818
#include <functorch/csrc/BatchRulesHelper.h>
@@ -23,6 +23,10 @@ namespace functorch {
2323

2424
// NOTE: [What is a batching rule?]
2525
//
26+
// This files contains batching rules written with the legacy (now-deprecated)
27+
// batching rule API.
28+
// Please try to use the new-style batching rule API (see writing_batch_rules.md)
29+
//
2630
// A *batching rule* implements the logic of how to call an operator on inputs
2731
// that have zero or more additional batch dimensions. When one does a vmap, the
2832
// dimension(s) being vmap'ed over get recorded as batch dimensions.

functorch/csrc/VmapTransforms.cpp renamed to functorch/csrc/LegacyVmapTransforms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// This source code is licensed under the BSD-style license found in the
55
// LICENSE file in the root directory of this source tree.
66

7-
#include <functorch/csrc/VmapTransforms.h>
7+
#include <functorch/csrc/LegacyVmapTransforms.h>
88
#include <functorch/csrc/DynamicLayer.h>
99

1010
#include <ATen/ATen.h>

functorch/csrc/VmapTransforms.h renamed to functorch/csrc/LegacyVmapTransforms.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
namespace at {
1313
namespace functorch {
1414

15+
// This files contains the legacy (now-deprecated) batching rule API.
16+
// Please try to use the new-style batching rule API (see writing_batch_rules.md)
17+
1518
// This file contains abstractions used for transforming *logical* vmap arguments
1619
// into *physical* arguments. (Keep reading for definitions of these terms).
1720

functorch/csrc/VmapModeRegistrations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <torch/library.h>
88
#include <ATen/ATen.h>
9-
#include <functorch/csrc/VmapTransforms.h>
9+
#include <functorch/csrc/LegacyVmapTransforms.h>
1010
#include <functorch/csrc/BatchedTensorImpl.h>
1111
#include <functorch/csrc/PlumbingHelper.h>
1212
#include <functorch/csrc/Constants.h>

functorch/csrc/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <functorch/csrc/TensorWrapper.h>
1212
#include <functorch/csrc/DynamicLayer.h>
1313
#include <functorch/csrc/BatchedTensorImpl.h>
14-
#include <functorch/csrc/VmapTransforms.h>
14+
#include <functorch/csrc/LegacyVmapTransforms.h>
1515
#include <functorch/csrc/BatchedFallback.h>
1616
#include <functorch/csrc/BatchRulesHelper.h>
1717
#include <functorch/csrc/CompileCache.h>

0 commit comments

Comments
 (0)