Commit 2e6a4d5
committed
Update base for Update on "[WIP] Compute forward grads for saved_mean and saved_var when input requires grad"
We want to avoid having to recompute saved_mean and saved_invstd in batch_norm_backward's decomposition in functorch (see pytorch/functorch#877), but also avoid unnecessarily computing forward grads for saved_mean and saved_invstd when they are not needed.
Tested locally with: `python test/test_ops.py -k test_jvpvjp_nn_functional_batch_norm`
Issues:
- not sure if gradgrad in core is missing something, but it is able to pass while the fwgrad_bwgrad comparison fails in functorch
[ghstack-poisoned]File tree
2,902 files changed
+210068
-142501
lines changed- .circleci
- cimodel/data
- simple
- util
- docker
- centos-rocm
- common
- ubuntu-cuda
- ubuntu-rocm
- ubuntu
- scripts
- verbatim-sources/job-specs
- .github
- ISSUE_TEMPLATE
- actions
- filter-test-configs
- get-workflow-job-id
- pull-docker-image
- setup-ssh
- setup-win
- teardown-linux
- ci_commit_pins
- scripts
- templates
- workflows
- .jenkins
- caffe2
- pytorch
- win-test-helpers
- installation-helpers
- android
- pytorch_android/src/main/cpp
- aten
- src/ATen
- core
- boxing
- impl
- dispatch
- op_registration
- cpu/vec
- vec256
- vec512
- cuda
- detail
- cudnn
- functorch
- miopen
- mkl
- mps
- native
- ao_sparse
- quantized/cpu
- cpu
- cuda
- linalg
- cudnn
- metal
- mpscnn
- ops
- miopen
- mkldnn
- mkl
- mps
- operations
- nested
- cuda
- quantized
- cpu
- kernels
- qnnpack
- cmake
- deps/clog
- cmake
- test
- cuda
- cudnn
- sparse
- cuda
- transformers
- cuda
- flash_attn
- mem_eff_attention
- gemm
- iterators
- kernels
- utils
- vulkan
- api
- glsl
- ops
- xnnpack
- quantized
- templates
- test
- benchmarks
- cpp/nvfuser
- distributed/ddp
- instruction_counts/core
- operator_benchmark/pt
- static_runtime
- binaries
- c10
- core
- impl
- cuda
- impl
- macros
- test/core
- impl
- util
- caffe2
- contrib
- aten
- nccl
- core
- mobile/contrib/nnapi
- perfkernels
- proto
- python
- quantization/server
- serialize
- sgd
- utils
- threadpool
- cmake
- External
- Modules
- public
- docs
- cpp/source/notes
- source
- community
- elastic
- notes
- scripts/onnx
- functorch
- .circleci
- unittest
- linux/scripts
- windows/scripts
- .github/workflows
- _src
- benchmarks/transformer_fusion_patterns
- codegen
- compile
- csrc
- dim
- dim
- docs/source
- _static
- css
- images
- _templates
- examples
- dp_cifar10
- maml_omniglot
- support
- experimental
- functorch
- _src
- csrc
- notebooks
- colab
- op_analysis
- test
- tools/lint
- ios/TestApp
- TestApp.xcodeproj
- TestApp
- benchmark
- fastlane
- scripts
- onnx
- test
- ao/sparsity
- cpp_extensions
- cpp
- api
- c10d
- example
- jit
- lazy
- profiler
- rpc
- tensorexpr
- distributed
- _shard
- checkpoint
- sharded_tensor/ops
- elastic
- agent/server/test
- timer
- fsdp
- pipeline/sync
- distributions
- expect
- forward_backward_compatibility
- fx
- jit
- lazy
- mobile
- nn
- onnx
- expect
- internal
- symbolic_opsets
- profiler
- quantization
- ao_migration
- bc
- core
- experimental
- dbr
- eager
- fx
- jit
- third_party
- nccl
- tools
- amd_build
- autograd
- templates
- code_coverage/package/tool
- linter
- adapters
- clang_tidy
- onnx
- sarif
- templates
- pyi
- setup_helpers
- stats
- testing
- test
- torchgen
- api
- dest
- selective_build
- shape_functions
- static_runtime
- torch
- _C
- _decomp
- _dispatch
- _lazy
- _prims_common
- _prims
- _refs
- nn/functional
- special
- _subclasses
- ao
- nn
- intrinsic
- modules
- qat
- modules
- quantized
- dynamic
- modules
- modules
- qat
- dynamic
- modules
- modules
- quantizable
- modules
- quantized
- dynamic
- modules
- modules
- reference
- modules
- sparse/quantized
- dynamic
- ns
- fx
- pruning
- _experimental
- activation_sparsifier
- data_scheduler
- data_sparsifier
- benchmarks
- images
- lightning
- callbacks
- tests
- pruner
- images
- scheduler
- sparsifier
- quantization
- _dbr
- backend_config
- experimental
- fx
- _model_report
- autograd
- backends
- _coreml
- cuda
- opt_einsum
- quantized
- xeon
- csrc
- api/include/torch
- nn
- functional
- autograd
- functions
- utils
- cuda
- deploy
- example
- fx
- interpreter
- third_party
- unity
- tests
- distributed
- c10d
- quantization
- rpc
- functorch
- jit
- backends/coreml
- objc
- observer
- codegen
- cuda
- ops
- python_frontend
- examples
- test
- runtime
- scheduler
- test
- tools
- fuser/cuda
- frontend
- ir
- mobile
- compatibility
- model_tracer
- operator_upgraders
- passes
- onnx
- pattern_conversion
- quantization
- utils
- python
- runtime
- static
- serialization
- tensorexpr
- operators
- lazy
- backend
- core
- python
- ts_backend
- onnx
- diagnostics
- generated
- profiler
- orchestration
- python
- tensor
- utils
- cuda
- amp
- distributed
- _sharding_spec
- _shard
- checkpoint
- sharded_optim
- sharded_tensor
- _ops
- sharding_plan
- sharding_spec
- chunk_sharding_spec_ops
- _spmd
- algorithms
- _checkpoint
- _comm_hooks
- ddp_comm_hooks
- model_averaging
- autograd
- elastic
- agent/server
- multiprocessing
- errors
- timer
- fsdp
- nn
- api
- optim
- pipeline/sync
- rpc
- distributions
- futures
- fx
- experimental
- migrate_gradual_types
- unification
- multipledispatch
- passes
- backends
- infra
- utils
- jit
- lib/libshm
- linalg
- masked
- maskedtensor
- monitor
- nested
- nn
- intrinsic
- modules
- qat/modules
- quantized
- dynamic/modules
- modules
- modules
- parallel
- qat
- dynamic
- modules
- modules
- quantizable/modules
- quantized
- _reference/modules
- dynamic
- modules
- modules
- utils
- _expanded_weights
- onnx
- _internal
- diagnostics
- infra
- sarif
- optim
- package
- profiler
- quantization
- sparse
- special
- testing
- _internal
- distributed
- rpc
- jit
- opinfo
- definitions
- utils
- benchmark/utils
- valgrind_wrapper
- bottleneck
- data
- _utils
- datapipes
- iter
- map
- utils
- hipify
- tensorboard
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
2,902 files changed
+210068
-142501
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | | - | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
33 | 32 | | |
34 | | - | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
41 | | - | |
| 39 | + | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
45 | 42 | | |
46 | | - | |
47 | 43 | | |
48 | | - | |
| 44 | + | |
| 45 | + | |
49 | 46 | | |
50 | 47 | | |
51 | | - | |
52 | 48 | | |
53 | 49 | | |
54 | 50 | | |
| |||
57 | 53 | | |
58 | 54 | | |
59 | 55 | | |
| 56 | + | |
| 57 | + | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
78 | 72 | | |
79 | 73 | | |
80 | 74 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
84 | 78 | | |
85 | 79 | | |
86 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
| |||
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
18 | 27 | | |
19 | 28 | | |
20 | 29 | | |
| |||
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
51 | 147 | | |
52 | 148 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
| 20 | + | |
23 | 21 | | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
0 commit comments