mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/60035 In Caffe2, the operator schema for the MulGradient op indicates that MulGradient may be performed in-place, overwriting one of its inputs as the output. The implementation is not safe to perform in-place however, due to an accidentally-introduced write-read dependency on the overwriten input in the in-place case. We fix it here. Test Plan: ``` buck test //caffe2/caffe2/python/operator_test:elementwise_ops_test ``` Note that the newly added test fails without this change, but passes with this change: ``` ✓ ListingSuccess: caffe2/caffe2/python/operator_test:elementwise_ops_test - main (24.992) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_exp (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_log1p (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_abs (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_bitwise_and (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_reciprocal (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_sqr (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_rsqrt (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_mul (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_sqrt (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_add (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_swish_gradient_inplace (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_sigmoid (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_bitwise_or (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_cbrt_grad (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_not (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_sub (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_div (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_eq (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_softsign (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_eq_bcast (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_powt (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ************************************************************************************************************************************************************************************* ***********************************<NEW_TEST_YAY>************************************************************************************************************************************ ************************************************************************************************************************************************************************************* ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_mul_gradient_inplace (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ************************************************************************************************************************************************************************************* ***********************************</NEW_TEST_YAY>*********************************************************************************************************************************** ************************************************************************************************************************************************************************************* ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_hard_sigmoid (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_bitwise_xor (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_log (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_cube (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_swish (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_cbrt (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - test_div_legacy_grad (caffe2.caffe2.python.operator_test.elementwise_ops_test.TestElementwiseOps) (125.898) ✓ Pass: caffe2/caffe2/python/operator_test:elementwise_ops_test - main (125.898) Summary Pass: 30 ListingSuccess: 1 ``` Reviewed By: clrfb Differential Revision: D29034265 fbshipit-source-id: 98550e1d5976398e45d37ff2120591af1439c42a |
||
|---|---|---|
| .. | ||
| benchmarks | ||
| docs | ||
| examples | ||
| fakelowp | ||
| helpers | ||
| ideep | ||
| layers | ||
| mint | ||
| mkl | ||
| modeling | ||
| models | ||
| onnx | ||
| operator_test | ||
| predictor | ||
| rnn | ||
| serialized_test | ||
| test | ||
| trt | ||
| __init__.py | ||
| _import_c_extension.py | ||
| _import_c_extension.pyi | ||
| allcompare_test.py | ||
| attention.py | ||
| benchmark_generator.py | ||
| binarysize.py | ||
| brew.py | ||
| brew_test.py | ||
| build.py | ||
| cached_reader.py | ||
| caffe_translator.py | ||
| caffe_translator_test.py | ||
| checkpoint.py | ||
| checkpoint_test.py | ||
| CMakeLists.txt | ||
| cnn.py | ||
| context.py | ||
| context.pyi | ||
| context_test.py | ||
| control.py | ||
| control_ops_grad.py | ||
| control_ops_grad_test.py | ||
| control_ops_util.py | ||
| control_test.py | ||
| convert.py | ||
| convert_test.py | ||
| convnet_benchmarks.py | ||
| convnet_benchmarks_test.py | ||
| core.py | ||
| core_gradients_test.py | ||
| core_test.py | ||
| crf.py | ||
| crf_predict.py | ||
| crf_viterbi_test.py | ||
| data_parallel_model.py | ||
| data_parallel_model_test.py | ||
| data_workers.py | ||
| data_workers_test.py | ||
| dataio.py | ||
| dataio_test.py | ||
| dataset.py | ||
| db_file_reader.py | ||
| db_test.py | ||
| device_checker.py | ||
| dlpack.h | ||
| dyndep.py | ||
| embedding_generation_benchmark.py | ||
| experiment_util.py | ||
| extension_loader.py | ||
| fakefp16_transform_lib.py | ||
| filler_test.py | ||
| functional.py | ||
| functional_test.py | ||
| fused_8bit_rowwise_conversion_ops_test.py | ||
| gradient_check_test.py | ||
| gradient_checker.py | ||
| gru_cell.py | ||
| hip_test_util.py | ||
| hsm_util.py | ||
| hypothesis_test.py | ||
| hypothesis_test_util.py | ||
| ideep_test_util.py | ||
| layer_model_helper.py | ||
| layer_model_instantiator.py | ||
| layer_parameter_sharing_test.py | ||
| layer_test_util.py | ||
| layers_test.py | ||
| lazy.py | ||
| lazy_dyndep.py | ||
| lazy_dyndep_test.py | ||
| lengths_reducer_fused_8bit_rowwise_ops_test.py | ||
| lengths_reducer_rowwise_8bit_ops_test.py | ||
| lstm_benchmark.py | ||
| memonger.py | ||
| memonger_test.py | ||
| mkl_test_util.py | ||
| model_device_test.py | ||
| model_helper.py | ||
| model_helper_test.py | ||
| modifier_context.py | ||
| mpi_python.cc | ||
| muji.py | ||
| muji_test.py | ||
| net_builder.py | ||
| net_builder_test.py | ||
| net_drawer.py | ||
| net_printer.py | ||
| net_printer_test.py | ||
| nomnigraph.py | ||
| nomnigraph_test.py | ||
| nomnigraph_transformations.py | ||
| nomnigraph_transformations_test.py | ||
| normalizer.py | ||
| normalizer_context.py | ||
| normalizer_test.py | ||
| numa_benchmark.py | ||
| numa_test.py | ||
| observer_test.py | ||
| operator_fp_exceptions_test.py | ||
| optimizer.py | ||
| optimizer_context.py | ||
| optimizer_test.py | ||
| optimizer_test_util.py | ||
| parallel_workers.py | ||
| parallel_workers_test.py | ||
| parallelize_bmuf_distributed_test.py | ||
| pipeline.py | ||
| pipeline_test.py | ||
| predictor_constants.py | ||
| pybind_state.cc | ||
| pybind_state.h | ||
| pybind_state_dlpack.cc | ||
| pybind_state_dlpack.h | ||
| pybind_state_gpu.cc | ||
| pybind_state_hip.cc | ||
| pybind_state_ideep.cc | ||
| pybind_state_int8.cc | ||
| pybind_state_nomni.cc | ||
| pybind_state_registry.cc | ||
| pybind_state_registry.h | ||
| python_op_test.py | ||
| queue_util.py | ||
| record_queue.py | ||
| recurrent.py | ||
| regularizer.py | ||
| regularizer_context.py | ||
| regularizer_test.py | ||
| rnn_cell.py | ||
| schema.py | ||
| schema_test.py | ||
| scope.py | ||
| scope_test.py | ||
| session.py | ||
| session_test.py | ||
| sparse_to_dense_mask_test.py | ||
| sparse_to_dense_test.py | ||
| task.py | ||
| task_test.py | ||
| test_util.py | ||
| text_file_reader.py | ||
| timeout_guard.py | ||
| toy_regression_test.py | ||
| transformations.py | ||
| transformations_test.py | ||
| tt_core.py | ||
| tt_core_test.py | ||
| utils.py | ||
| utils_test.py | ||
| visualize.py | ||
| workspace.py | ||
| workspace_test.py | ||