mindspore 2.4.10__cp311-cp311-win_amd64.whl → 2.6.0__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +13 -6
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_check_jit_forbidden_api.py +3 -0
- mindspore/_checkparam.py +3 -38
- mindspore/_deprecated/__init__.py +17 -0
- mindspore/_deprecated/jit.py +198 -0
- mindspore/_extends/builtin_operations.py +1 -1
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +6 -7
- mindspore/_extends/parse/compile_config.py +83 -0
- mindspore/_extends/parse/deprecated/__init__.py +0 -0
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +394 -0
- mindspore/_extends/parse/jit_fallback_modules/__init__.py +0 -0
- mindspore/_extends/parse/jit_fallback_modules/check_utils.py +123 -0
- mindspore/_extends/parse/jit_fallback_modules/third_party_modules.py +50 -0
- mindspore/_extends/parse/parser.py +47 -198
- mindspore/_extends/parse/resources.py +1 -5
- mindspore/_extends/parse/standard_method.py +229 -99
- mindspore/_extends/pijit/__init__.py +2 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +17 -12
- mindspore/_extends/pijit/tensor_func_list.py +27 -0
- mindspore/_extends/utils.py +1 -1
- mindspore/amp.py +11 -5
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/__init__.py +2 -2
- mindspore/boost/base.py +3 -7
- mindspore/boost/boost_cell_wrapper.py +138 -43
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +6 -3
- mindspore/common/_grad_function.py +56 -0
- mindspore/common/_pijit_context.py +14 -5
- mindspore/common/_register_for_tensor.py +1 -2
- mindspore/common/_stub_tensor.py +30 -14
- mindspore/common/_tensor_cpp_method.py +17 -0
- mindspore/common/_tensor_docs.py +4760 -0
- mindspore/common/api.py +480 -372
- mindspore/common/auto_dynamic_shape.py +41 -44
- mindspore/common/dtype.py +39 -36
- mindspore/common/dump.py +9 -6
- mindspore/common/file_system.py +9 -1
- mindspore/common/generator.py +5 -0
- mindspore/common/hook_handle.py +6 -2
- mindspore/common/initializer.py +13 -10
- mindspore/common/jit_begin_end.py +94 -0
- mindspore/common/jit_config.py +6 -1
- mindspore/common/jit_context.py +76 -0
- mindspore/common/jit_trace.py +378 -0
- mindspore/common/lazy_inline.py +9 -3
- mindspore/common/mindir_util.py +10 -2
- mindspore/common/mutable.py +5 -4
- mindspore/common/parameter.py +135 -52
- mindspore/common/seed.py +2 -2
- mindspore/common/sparse_tensor.py +23 -17
- mindspore/common/tensor.py +975 -1981
- mindspore/communication/__init__.py +7 -5
- mindspore/communication/_comm_helper.py +52 -2
- mindspore/communication/comm_func.py +240 -181
- mindspore/communication/management.py +95 -26
- mindspore/context.py +324 -573
- mindspore/dataset/__init__.py +65 -37
- mindspore/dataset/audio/__init__.py +2 -8
- mindspore/dataset/audio/transforms.py +3 -17
- mindspore/dataset/callback/ds_callback.py +2 -1
- mindspore/dataset/core/config.py +87 -6
- mindspore/dataset/engine/cache_admin.py +3 -3
- mindspore/dataset/engine/cache_client.py +6 -5
- mindspore/dataset/engine/datasets.py +292 -267
- mindspore/dataset/engine/datasets_audio.py +22 -8
- mindspore/dataset/engine/datasets_standard_format.py +46 -27
- mindspore/dataset/engine/datasets_text.py +78 -48
- mindspore/dataset/engine/datasets_user_defined.py +183 -117
- mindspore/dataset/engine/datasets_vision.py +120 -44
- mindspore/dataset/engine/iterators.py +283 -63
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +1 -1
- mindspore/dataset/engine/obs/util.py +8 -0
- mindspore/dataset/engine/queue.py +40 -0
- mindspore/dataset/engine/samplers.py +289 -43
- mindspore/dataset/engine/serializer_deserializer.py +3 -2
- mindspore/dataset/engine/validators.py +53 -11
- mindspore/dataset/text/__init__.py +7 -6
- mindspore/dataset/text/transforms.py +6 -5
- mindspore/dataset/text/utils.py +3 -3
- mindspore/dataset/transforms/__init__.py +0 -9
- mindspore/dataset/transforms/py_transforms_util.py +17 -0
- mindspore/dataset/transforms/transforms.py +31 -14
- mindspore/dataset/utils/browse_dataset.py +1 -1
- mindspore/dataset/vision/__init__.py +2 -9
- mindspore/dataset/vision/transforms.py +202 -158
- mindspore/dataset/vision/utils.py +7 -5
- mindspore/dataset/vision/validators.py +1 -2
- mindspore/device_context/__init__.py +21 -0
- mindspore/device_context/ascend/__init__.py +25 -0
- mindspore/device_context/ascend/device.py +72 -0
- mindspore/device_context/ascend/op_debug.py +153 -0
- mindspore/device_context/ascend/op_precision.py +193 -0
- mindspore/device_context/ascend/op_tuning.py +123 -0
- mindspore/{ops_generate/gen_constants.py → device_context/cpu/__init__.py} +6 -17
- mindspore/device_context/cpu/device.py +62 -0
- mindspore/device_context/cpu/op_tuning.py +43 -0
- mindspore/device_context/gpu/__init__.py +21 -0
- mindspore/device_context/gpu/device.py +70 -0
- mindspore/device_context/gpu/op_precision.py +67 -0
- mindspore/device_context/gpu/op_tuning.py +175 -0
- mindspore/device_manager.py +170 -0
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/es/embedding_service.py +35 -27
- mindspore/experimental/llm_boost/__init__.py +1 -0
- mindspore/experimental/llm_boost/ascend_native/__init__.py +22 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +209 -0
- mindspore/experimental/llm_boost/ascend_native/llm_boost.py +52 -0
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/llm_boost/atb/llama_boost.py +6 -1
- mindspore/experimental/llm_boost/register.py +1 -0
- mindspore/experimental/map_parameter.py +4 -4
- mindspore/experimental/optim/adadelta.py +6 -6
- mindspore/experimental/optim/adagrad.py +4 -4
- mindspore/experimental/optim/adam.py +7 -0
- mindspore/experimental/optim/adamax.py +4 -4
- mindspore/experimental/optim/adamw.py +4 -0
- mindspore/experimental/optim/asgd.py +1 -1
- mindspore/experimental/optim/lr_scheduler.py +73 -46
- mindspore/experimental/optim/radam.py +34 -31
- mindspore/experimental/optim/rprop.py +1 -1
- mindspore/experimental/optim/sgd.py +1 -1
- mindspore/hal/contiguous_tensors_handle.py +6 -10
- mindspore/hal/device.py +55 -53
- mindspore/hal/event.py +52 -52
- mindspore/hal/memory.py +179 -120
- mindspore/hal/stream.py +150 -109
- mindspore/include/api/context.h +0 -1
- mindspore/include/dataset/constants.h +7 -4
- mindspore/include/dataset/execute.h +2 -2
- mindspore/jpeg62.dll +0 -0
- mindspore/log.py +50 -0
- mindspore/mindrecord/__init__.py +21 -8
- mindspore/mindrecord/config.py +17 -316
- mindspore/mindrecord/filereader.py +1 -9
- mindspore/mindrecord/filewriter.py +5 -15
- mindspore/mindrecord/mindpage.py +1 -9
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/{mindspore_backend.dll → mindspore_ops_host.dll} +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +798 -761
- mindspore/mint/distributed/__init__.py +70 -4
- mindspore/mint/distributed/distributed.py +2679 -44
- mindspore/mint/linalg/__init__.py +8 -0
- mindspore/mint/nn/__init__.py +743 -22
- mindspore/mint/nn/functional.py +716 -23
- mindspore/mint/nn/layer/__init__.py +21 -4
- mindspore/mint/nn/layer/_functions.py +334 -0
- mindspore/mint/nn/layer/activation.py +276 -1
- mindspore/mint/nn/layer/basic.py +123 -0
- mindspore/mint/nn/layer/conv.py +933 -0
- mindspore/mint/nn/layer/normalization.py +223 -28
- mindspore/mint/nn/layer/padding.py +797 -0
- mindspore/mint/nn/layer/pooling.py +235 -0
- mindspore/mint/optim/__init__.py +3 -1
- mindspore/mint/optim/adam.py +223 -0
- mindspore/mint/optim/adamw.py +26 -19
- mindspore/mint/optim/sgd.py +171 -0
- mindspore/mint/special/__init__.py +2 -1
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/multiprocessing/__init__.py +5 -0
- mindspore/nn/__init__.py +4 -1
- mindspore/nn/cell.py +1373 -192
- mindspore/nn/dynamic_lr.py +2 -1
- mindspore/nn/layer/activation.py +29 -27
- mindspore/nn/layer/basic.py +51 -35
- mindspore/nn/layer/channel_shuffle.py +3 -3
- mindspore/nn/layer/container.py +1 -1
- mindspore/nn/layer/conv.py +53 -42
- mindspore/nn/layer/embedding.py +12 -11
- mindspore/nn/layer/normalization.py +56 -49
- mindspore/nn/layer/padding.py +4 -3
- mindspore/nn/layer/pooling.py +120 -42
- mindspore/nn/layer/rnn_cells.py +1 -1
- mindspore/nn/layer/rnns.py +2 -1
- mindspore/nn/layer/timedistributed.py +5 -5
- mindspore/nn/layer/transformer.py +59 -36
- mindspore/nn/learning_rate_schedule.py +8 -4
- mindspore/nn/loss/loss.py +58 -55
- mindspore/nn/optim/ada_grad.py +7 -5
- mindspore/nn/optim/adadelta.py +11 -9
- mindspore/nn/optim/adafactor.py +1 -1
- mindspore/nn/optim/adam.py +19 -15
- mindspore/nn/optim/adamax.py +8 -7
- mindspore/nn/optim/adasum.py +5 -5
- mindspore/nn/optim/asgd.py +3 -1
- mindspore/nn/optim/ftrl.py +11 -9
- mindspore/nn/optim/lamb.py +1 -1
- mindspore/nn/optim/lars.py +1 -4
- mindspore/nn/optim/lazyadam.py +12 -10
- mindspore/nn/optim/momentum.py +7 -6
- mindspore/nn/optim/optimizer.py +3 -3
- mindspore/nn/optim/proximal_ada_grad.py +12 -10
- mindspore/nn/optim/rmsprop.py +13 -12
- mindspore/nn/optim/rprop.py +11 -9
- mindspore/nn/optim/sgd.py +9 -6
- mindspore/nn/optim/tft_wrapper.py +5 -2
- mindspore/nn/optim/thor.py +2 -1
- mindspore/nn/probability/bijector/bijector.py +17 -11
- mindspore/nn/probability/bijector/gumbel_cdf.py +5 -5
- mindspore/nn/probability/bijector/invert.py +2 -2
- mindspore/nn/probability/bijector/scalar_affine.py +3 -3
- mindspore/nn/probability/bijector/softplus.py +3 -2
- mindspore/nn/probability/distribution/beta.py +3 -3
- mindspore/nn/probability/distribution/categorical.py +1 -1
- mindspore/nn/probability/distribution/cauchy.py +4 -2
- mindspore/nn/probability/distribution/exponential.py +6 -7
- mindspore/nn/probability/distribution/gamma.py +2 -2
- mindspore/nn/probability/distribution/gumbel.py +2 -2
- mindspore/nn/probability/distribution/half_normal.py +5 -3
- mindspore/nn/probability/distribution/logistic.py +5 -3
- mindspore/nn/probability/distribution/poisson.py +1 -1
- mindspore/nn/probability/distribution/uniform.py +5 -3
- mindspore/nn/reinforcement/_tensors_queue.py +1 -1
- mindspore/nn/reinforcement/tensor_array.py +1 -1
- mindspore/nn/utils/init.py +13 -11
- mindspore/nn/wrap/__init__.py +6 -6
- mindspore/nn/wrap/cell_wrapper.py +181 -122
- mindspore/nn/wrap/grad_reducer.py +45 -36
- mindspore/nn/wrap/loss_scale.py +6 -7
- mindspore/numpy/array_creations.py +63 -65
- mindspore/numpy/array_ops.py +149 -144
- mindspore/numpy/logic_ops.py +41 -42
- mindspore/numpy/math_ops.py +361 -359
- mindspore/numpy/utils.py +17 -18
- mindspore/numpy/utils_const.py +5 -6
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/__init__.py +5 -3
- mindspore/ops/_grad_experimental/grad_comm_ops.py +112 -16
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -2
- mindspore/ops/_grad_experimental/grad_inner_ops.py +9 -0
- mindspore/ops/_grad_experimental/grad_math_ops.py +2 -1
- mindspore/ops/_grad_experimental/taylor_rule.py +29 -0
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/ops/_op_impl/cpu/raise_op.py +28 -0
- mindspore/ops/_register_for_op.py +0 -11
- mindspore/{ops_generate → ops/_utils}/arg_dtype_cast.py +123 -4
- mindspore/{ops_generate → ops/_utils}/arg_handler.py +3 -65
- mindspore/ops/_vmap/vmap_array_ops.py +52 -25
- mindspore/ops/_vmap/vmap_base.py +0 -2
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +21 -14
- mindspore/ops/_vmap/vmap_math_ops.py +15 -16
- mindspore/ops/_vmap/vmap_nn_ops.py +29 -42
- mindspore/ops/auto_generate/__init__.py +4 -3
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +258 -46
- mindspore/ops/auto_generate/gen_extend_func.py +757 -185
- mindspore/ops/auto_generate/gen_ops_def.py +4197 -2243
- mindspore/ops/auto_generate/gen_ops_prim.py +16976 -6055
- mindspore/ops/auto_generate/pyboost_inner_prim.py +221 -87
- mindspore/ops/composite/__init__.py +2 -1
- mindspore/ops/composite/base.py +20 -25
- mindspore/ops/composite/math_ops.py +6 -16
- mindspore/ops/composite/multitype_ops/__init__.py +5 -2
- mindspore/ops/composite/multitype_ops/_compile_utils.py +228 -30
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -2
- mindspore/ops/composite/multitype_ops/add_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/div_impl.py +6 -4
- mindspore/ops/composite/multitype_ops/equal_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/getitem_impl.py +3 -2
- mindspore/ops/composite/multitype_ops/greater_equal_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/greater_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/in_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/invert_impl.py +50 -0
- mindspore/ops/composite/multitype_ops/left_shift_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/less_equal_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/less_impl.py +4 -3
- mindspore/ops/composite/multitype_ops/logic_not_impl.py +3 -2
- mindspore/ops/composite/multitype_ops/logical_and_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/logical_or_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/mod_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/mul_impl.py +3 -2
- mindspore/ops/composite/multitype_ops/negative_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/not_equal_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/ones_like_impl.py +18 -0
- mindspore/ops/composite/multitype_ops/pow_impl.py +2 -30
- mindspore/ops/composite/multitype_ops/right_shift_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/setitem_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/sub_impl.py +2 -1
- mindspore/ops/function/__init__.py +40 -2
- mindspore/ops/function/_add_attr_func.py +58 -0
- mindspore/ops/function/array_func.py +2089 -2403
- mindspore/ops/function/clip_func.py +80 -23
- mindspore/ops/function/debug_func.py +57 -57
- mindspore/ops/function/grad/__init__.py +1 -0
- mindspore/ops/function/grad/grad_func.py +104 -71
- mindspore/ops/function/image_func.py +2 -2
- mindspore/ops/function/linalg_func.py +47 -78
- mindspore/ops/function/math_func.py +4351 -3813
- mindspore/ops/function/nn_func.py +1712 -637
- mindspore/ops/function/other_func.py +159 -1
- mindspore/ops/function/parameter_func.py +18 -84
- mindspore/ops/function/random_func.py +452 -387
- mindspore/ops/function/reshard_func.py +4 -70
- mindspore/ops/function/sparse_func.py +3 -3
- mindspore/ops/function/sparse_unary_func.py +6 -6
- mindspore/ops/function/spectral_func.py +25 -58
- mindspore/ops/function/vmap_func.py +26 -18
- mindspore/ops/functional.py +23 -7
- mindspore/ops/functional_overload.py +1548 -0
- mindspore/ops/op_info_register.py +32 -244
- mindspore/ops/operations/__init__.py +23 -15
- mindspore/ops/operations/_custom_ops_utils.py +235 -0
- mindspore/ops/operations/_embedding_cache_ops.py +4 -4
- mindspore/ops/operations/_grad_ops.py +2 -43
- mindspore/ops/operations/_infer_ops.py +2 -1
- mindspore/ops/operations/_inner_ops.py +43 -84
- mindspore/ops/operations/_ms_kernel.py +4 -10
- mindspore/ops/operations/_rl_inner_ops.py +1 -1
- mindspore/ops/operations/_scalar_ops.py +3 -2
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/_tensor_array.py +1 -1
- mindspore/ops/operations/array_ops.py +81 -324
- mindspore/ops/operations/comm_ops.py +154 -108
- mindspore/ops/operations/custom_ops.py +298 -87
- mindspore/ops/operations/debug_ops.py +157 -59
- mindspore/ops/operations/inner_ops.py +7 -5
- mindspore/ops/operations/linalg_ops.py +1 -57
- mindspore/ops/operations/manually_defined/_inner.py +1 -1
- mindspore/ops/operations/manually_defined/ops_def.py +928 -180
- mindspore/ops/operations/math_ops.py +32 -234
- mindspore/ops/operations/nn_ops.py +212 -531
- mindspore/ops/operations/other_ops.py +62 -9
- mindspore/ops/operations/random_ops.py +13 -7
- mindspore/ops/operations/reshard_ops.py +1 -1
- mindspore/ops/operations/sparse_ops.py +2 -2
- mindspore/ops/primitive.py +66 -53
- mindspore/ops/tensor_method.py +1895 -0
- mindspore/ops_generate/__init__.py +0 -5
- mindspore/ops_generate/aclnn/__init__.py +0 -0
- mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +135 -0
- mindspore/ops_generate/aclnn/gen_aclnn_implement.py +257 -0
- mindspore/ops_generate/api/__init__.py +0 -0
- mindspore/ops_generate/api/add_tensor_docs_generator.py +56 -0
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +105 -0
- mindspore/ops_generate/api/functional_map_cpp_generator.py +504 -0
- mindspore/ops_generate/api/functional_overload_py_generator.py +112 -0
- mindspore/ops_generate/api/functions_cc_generator.py +237 -0
- mindspore/ops_generate/api/gen_api.py +103 -0
- mindspore/ops_generate/api/op_api_proto.py +235 -0
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +461 -0
- mindspore/ops_generate/common/__init__.py +0 -0
- mindspore/ops_generate/common/base_generator.py +11 -0
- mindspore/ops_generate/common/gen_constants.py +91 -0
- mindspore/ops_generate/common/gen_utils.py +348 -0
- mindspore/ops_generate/common/op_proto.py +473 -0
- mindspore/ops_generate/common/template.py +523 -0
- mindspore/ops_generate/gen_ops.py +22 -1069
- mindspore/ops_generate/op_def/__init__.py +0 -0
- mindspore/ops_generate/op_def/gen_op_def.py +90 -0
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +191 -0
- mindspore/ops_generate/op_def/ops_def_cc_generator.py +296 -0
- mindspore/ops_generate/op_def/ops_def_h_generator.py +74 -0
- mindspore/ops_generate/op_def/ops_name_h_generator.py +83 -0
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +125 -0
- mindspore/ops_generate/op_def_py/__init__.py +0 -0
- mindspore/ops_generate/op_def_py/gen_op_def_py.py +47 -0
- mindspore/ops_generate/op_def_py/op_def_py_generator.py +132 -0
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +489 -0
- mindspore/ops_generate/pyboost/__init__.py +0 -0
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +139 -0
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +93 -0
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +175 -0
- mindspore/ops_generate/pyboost/op_template_parser.py +517 -0
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +407 -0
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +100 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +148 -0
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +155 -0
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +132 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +272 -0
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +938 -0
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +357 -0
- mindspore/ops_generate/{pyboost_utils.py → pyboost/pyboost_utils.py} +179 -36
- mindspore/ops_generate/resources/__init__.py +0 -0
- mindspore/ops_generate/resources/resource_list.py +30 -0
- mindspore/ops_generate/resources/resource_loader.py +36 -0
- mindspore/ops_generate/resources/resource_manager.py +64 -0
- mindspore/ops_generate/resources/yaml_loader.py +88 -0
- mindspore/ops_generate/tensor_py_cc_generator.py +122 -0
- mindspore/parallel/__init__.py +7 -3
- mindspore/parallel/_auto_parallel_context.py +159 -40
- mindspore/parallel/_cell_wrapper.py +132 -15
- mindspore/parallel/_parallel_serialization.py +107 -5
- mindspore/parallel/_ps_context.py +1 -1
- mindspore/parallel/_recovery_context.py +7 -2
- mindspore/parallel/_tensor.py +142 -18
- mindspore/parallel/_utils.py +199 -23
- mindspore/parallel/algo_parameter_config.py +4 -4
- mindspore/parallel/auto_parallel.py +732 -0
- mindspore/parallel/checkpoint_convert.py +159 -0
- mindspore/parallel/checkpoint_transform.py +700 -35
- mindspore/parallel/cluster/process_entity/_api.py +276 -50
- mindspore/parallel/cluster/process_entity/_utils.py +41 -6
- mindspore/parallel/cluster/run.py +21 -4
- mindspore/parallel/function/__init__.py +24 -0
- mindspore/parallel/function/reshard_func.py +258 -0
- mindspore/parallel/nn/__init__.py +25 -0
- mindspore/parallel/nn/parallel_cell_wrapper.py +263 -0
- mindspore/parallel/nn/parallel_grad_reducer.py +169 -0
- mindspore/parallel/parameter_broadcast.py +25 -14
- mindspore/parallel/shard.py +137 -59
- mindspore/parallel/transform_safetensors.py +364 -305
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +22 -5
- mindspore/profiler/analysis/__init__.py +0 -0
- mindspore/profiler/analysis/parser/__init__.py +0 -0
- mindspore/profiler/analysis/parser/ascend_cann_parser.py +170 -0
- mindspore/profiler/analysis/parser/base_parser.py +158 -0
- mindspore/profiler/analysis/parser/framework_cann_relation_parser.py +45 -0
- mindspore/profiler/analysis/parser/ms_framework_parser.py +142 -0
- mindspore/profiler/analysis/parser/ms_minddata_parser.py +145 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/__init__.py +0 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +264 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +40 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +109 -0
- mindspore/profiler/analysis/parser/timeline_creator/__init__.py +0 -0
- mindspore/profiler/analysis/parser/timeline_creator/base_timeline_creator.py +44 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +90 -0
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +76 -0
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +103 -0
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +134 -0
- mindspore/profiler/analysis/parser/timeline_event/__init__.py +0 -0
- mindspore/profiler/analysis/parser/timeline_event/base_event.py +233 -0
- mindspore/profiler/analysis/parser/timeline_event/cpu_op_event.py +47 -0
- mindspore/profiler/analysis/parser/timeline_event/flow_event.py +36 -0
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +415 -0
- mindspore/profiler/analysis/parser/timeline_event/msprof_event.py +73 -0
- mindspore/profiler/analysis/parser/timeline_event/scope_layer_event.py +53 -0
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +146 -0
- mindspore/profiler/analysis/task_manager.py +131 -0
- mindspore/profiler/analysis/time_converter.py +84 -0
- mindspore/profiler/analysis/viewer/__init__.py +0 -0
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +372 -0
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +87 -0
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +250 -0
- mindspore/profiler/analysis/viewer/ascend_memory_viewer.py +320 -0
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +327 -0
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +376 -0
- mindspore/profiler/analysis/viewer/ascend_timeline_viewer.py +58 -0
- mindspore/profiler/analysis/viewer/base_viewer.py +26 -0
- mindspore/profiler/analysis/viewer/ms_dataset_viewer.py +96 -0
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +581 -0
- mindspore/profiler/analysis/work_flow.py +73 -0
- mindspore/profiler/common/ascend_msprof_exporter.py +139 -0
- mindspore/profiler/common/command_executor.py +90 -0
- mindspore/profiler/common/constant.py +186 -3
- mindspore/profiler/common/file_manager.py +208 -0
- mindspore/profiler/common/log.py +130 -0
- mindspore/profiler/common/msprof_cmd_tool.py +221 -0
- mindspore/profiler/common/path_manager.py +395 -0
- mindspore/profiler/common/process_bar.py +168 -0
- mindspore/profiler/common/process_pool.py +9 -3
- mindspore/profiler/common/profiler_context.py +500 -0
- mindspore/profiler/common/profiler_info.py +304 -0
- mindspore/profiler/common/profiler_meta_data.py +74 -0
- mindspore/profiler/common/profiler_output_path.py +284 -0
- mindspore/profiler/common/profiler_parameters.py +251 -0
- mindspore/profiler/common/profiler_path_manager.py +179 -0
- mindspore/profiler/common/record_function.py +76 -0
- mindspore/profiler/common/tlv_decoder.py +76 -0
- mindspore/profiler/common/util.py +75 -2
- mindspore/profiler/dynamic_profiler.py +341 -75
- mindspore/profiler/envprofiler.py +163 -0
- mindspore/profiler/experimental_config.py +197 -0
- mindspore/profiler/mstx.py +242 -0
- mindspore/profiler/platform/__init__.py +21 -0
- mindspore/profiler/platform/base_profiler.py +40 -0
- mindspore/profiler/platform/cpu_profiler.py +124 -0
- mindspore/profiler/platform/gpu_profiler.py +74 -0
- mindspore/profiler/platform/npu_profiler.py +335 -0
- mindspore/profiler/profiler.py +1073 -90
- mindspore/profiler/profiler_action_controller.py +187 -0
- mindspore/profiler/profiler_interface.py +118 -0
- mindspore/profiler/schedule.py +243 -0
- mindspore/rewrite/api/node.py +15 -13
- mindspore/rewrite/api/symbol_tree.py +2 -3
- mindspore/run_check/_check_version.py +27 -20
- mindspore/run_check/run_check.py +1 -1
- mindspore/runtime/__init__.py +37 -0
- mindspore/runtime/device.py +27 -0
- mindspore/runtime/event.py +209 -0
- mindspore/runtime/executor.py +177 -0
- mindspore/runtime/memory.py +416 -0
- mindspore/runtime/stream.py +460 -0
- mindspore/runtime/thread_bind_core.py +401 -0
- mindspore/safeguard/rewrite_obfuscation.py +12 -9
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/__init__.py +8 -8
- mindspore/train/_utils.py +96 -27
- mindspore/train/amp.py +9 -5
- mindspore/train/callback/__init__.py +2 -2
- mindspore/train/callback/_callback.py +2 -16
- mindspore/train/callback/_checkpoint.py +53 -55
- mindspore/train/callback/_cluster_monitor.py +14 -18
- mindspore/train/callback/_early_stop.py +1 -1
- mindspore/train/callback/_flops_collector.py +103 -68
- mindspore/train/callback/_history.py +8 -5
- mindspore/train/callback/_lambda_callback.py +2 -2
- mindspore/train/callback/_landscape.py +0 -3
- mindspore/train/callback/_loss_monitor.py +2 -1
- mindspore/train/callback/_on_request_exit.py +6 -5
- mindspore/train/callback/_reduce_lr_on_plateau.py +11 -6
- mindspore/train/callback/_summary_collector.py +52 -19
- mindspore/train/callback/_time_monitor.py +2 -1
- mindspore/train/callback/{_tft_register.py → _train_fault_tolerance.py} +228 -108
- mindspore/train/data_sink.py +25 -2
- mindspore/train/dataset_helper.py +15 -16
- mindspore/train/loss_scale_manager.py +8 -7
- mindspore/train/metrics/accuracy.py +3 -3
- mindspore/train/metrics/confusion_matrix.py +9 -9
- mindspore/train/metrics/error.py +3 -3
- mindspore/train/metrics/hausdorff_distance.py +4 -4
- mindspore/train/metrics/mean_surface_distance.py +3 -3
- mindspore/train/metrics/metric.py +0 -12
- mindspore/train/metrics/occlusion_sensitivity.py +4 -2
- mindspore/train/metrics/precision.py +11 -10
- mindspore/train/metrics/recall.py +9 -9
- mindspore/train/metrics/root_mean_square_surface_distance.py +2 -2
- mindspore/train/mind_ir_pb2.py +174 -46
- mindspore/train/model.py +269 -136
- mindspore/train/serialization.py +622 -978
- mindspore/train/summary/_summary_adapter.py +2 -2
- mindspore/train/summary/summary_record.py +2 -3
- mindspore/train/train_thor/model_thor.py +1 -1
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +6 -3
- mindspore/utils/dryrun.py +140 -0
- mindspore/utils/hooks.py +81 -0
- mindspore/utils/runtime_execution_order_check.py +552 -0
- mindspore/utils/utils.py +138 -4
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/METADATA +3 -3
- {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/RECORD +587 -418
- {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/entry_points.txt +1 -1
- mindspore/_install_custom.py +0 -43
- mindspore/common/_register_for_adapter.py +0 -74
- mindspore/common/_tensor_overload.py +0 -139
- mindspore/mindspore_np_dtype.dll +0 -0
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +0 -252
- mindspore/ops/auto_generate/gen_arg_handler.py +0 -197
- mindspore/ops/operations/_opaque_predicate_registry.py +0 -41
- mindspore/ops_generate/gen_aclnn_implement.py +0 -263
- mindspore/ops_generate/gen_ops_inner_prim.py +0 -131
- mindspore/ops_generate/gen_pyboost_func.py +0 -1052
- mindspore/ops_generate/gen_utils.py +0 -209
- mindspore/ops_generate/op_proto.py +0 -145
- mindspore/ops_generate/template.py +0 -261
- mindspore/profiler/envprofiling.py +0 -254
- mindspore/profiler/profiling.py +0 -1926
- {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/WHEEL +0 -0
- {mindspore-2.4.10.dist-info → mindspore-2.6.0.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2021-
|
|
1
|
+
# Copyright 2021-2025 Huawei Technologies Co., Ltd
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -21,6 +21,7 @@ import re
|
|
|
21
21
|
import ast
|
|
22
22
|
import hashlib
|
|
23
23
|
import stat
|
|
24
|
+
import copy
|
|
24
25
|
import inspect
|
|
25
26
|
import importlib
|
|
26
27
|
import platform
|
|
@@ -29,7 +30,6 @@ import numpy as np
|
|
|
29
30
|
import mindspore as ms
|
|
30
31
|
from mindspore._c_expression import Oplib, typing
|
|
31
32
|
from mindspore._c_expression import pyboost_custom_ext
|
|
32
|
-
from mindspore.common._stub_tensor import _convert_stub
|
|
33
33
|
from mindspore import context
|
|
34
34
|
from mindspore.common import Tensor
|
|
35
35
|
from mindspore.common import dtype as mstype
|
|
@@ -40,6 +40,7 @@ from mindspore.communication.management import get_rank, GlobalComm
|
|
|
40
40
|
from ._ms_kernel import determine_variable_usage
|
|
41
41
|
from ._custom_grad import autodiff_bprop
|
|
42
42
|
from ._pyfunc_registry import add_pyfunc
|
|
43
|
+
from ._custom_ops_utils import ExtensionBuilder
|
|
43
44
|
|
|
44
45
|
if platform.system() != "Windows":
|
|
45
46
|
import fcntl
|
|
@@ -109,12 +110,19 @@ def _compile_aot(file):
|
|
|
109
110
|
func_path = cache_path + file_name + ".so"
|
|
110
111
|
include_file = "{} -I{}".format(include_file, file[:file.rindex('/')])
|
|
111
112
|
|
|
113
|
+
if context.get_context("device_target") == "Ascend":
|
|
114
|
+
ascend_cann_path = os.getenv("ASCEND_OPP_PATH").split('opp')[0]
|
|
115
|
+
ascend_include = os.path.join(ascend_cann_path, "include")
|
|
116
|
+
include_file = "{} -I{}".format(include_file, ascend_include)
|
|
117
|
+
|
|
118
|
+
include_file = include_file.split(" ")
|
|
112
119
|
if func_path not in Custom.compiled_bin:
|
|
113
120
|
Custom.compiled_bin.append(func_path)
|
|
114
121
|
|
|
115
122
|
if file.endswith("cpp") or file.endswith("cc"):
|
|
116
123
|
cmd = ["g++", "-std=c++17", "--shared", "-fPIC", "-D_GLIBCXX_USE_CXX11_ABI=0"]
|
|
117
|
-
cmd +=
|
|
124
|
+
cmd += include_file
|
|
125
|
+
cmd += ["-o", func_path, file]
|
|
118
126
|
elif file.endswith("cu"):
|
|
119
127
|
cmd = ["nvcc"]
|
|
120
128
|
cmd += ["--shared", "-Xcompiler", "-fPIC", "-O3", "-gencode", "arch=compute_70, code=sm_70"]
|
|
@@ -141,12 +149,13 @@ def _compile_aot(file):
|
|
|
141
149
|
logger.warning("The current version of nvcc, V{}.{}.{}, might have unfixed issues with std string, "
|
|
142
150
|
"which will lead to errors in aot custom op with attrs."
|
|
143
151
|
"The version higher than V10.1.168 is recommended".format(v_major, v_mid, v_minor))
|
|
144
|
-
cmd +=
|
|
152
|
+
cmd += include_file
|
|
153
|
+
cmd += ["-o", func_path, file]
|
|
145
154
|
else:
|
|
146
155
|
raise ValueError("The source file must be a cc/cpp/cu file, but get: {}".format(file))
|
|
147
156
|
|
|
148
157
|
proc = subprocess.Popen(
|
|
149
|
-
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
158
|
+
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
|
|
150
159
|
|
|
151
160
|
(out, _) = proc.communicate(timeout=30)
|
|
152
161
|
|
|
@@ -183,10 +192,16 @@ class _CustomExt(ops.PrimitiveWithInfer):
|
|
|
183
192
|
|
|
184
193
|
infer_value = None
|
|
185
194
|
if infer_shape is None:
|
|
186
|
-
logger.
|
|
187
|
-
|
|
188
|
-
|
|
195
|
+
logger.debug("'out_shape' is None. Add a placeholder instead. "
|
|
196
|
+
"A CPP version of infer shape function is required "
|
|
197
|
+
"in this case.")
|
|
189
198
|
infer_shape = (1,)
|
|
199
|
+
if infer_dtype is None:
|
|
200
|
+
logger.debug("'out_dtype' is None. Add a placeholder instead. "
|
|
201
|
+
"A CPP version of infer type function is required "
|
|
202
|
+
"in this case.")
|
|
203
|
+
infer_dtype = ms.float16
|
|
204
|
+
|
|
190
205
|
# after all automatic infer information fulfillment, throw error if infer_shape/infer_dtype is still None
|
|
191
206
|
if not isinstance(infer_shape, (tuple, list)):
|
|
192
207
|
raise TypeError("'out_shape' must be one of [tuple, list, function], but got {}".format(type(infer_shape)))
|
|
@@ -215,7 +230,7 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
215
230
|
function if needed. Then these `Custom` objects can be directly used in neural networks.
|
|
216
231
|
Detailed description and introduction of user-defined operators, including correct writing of parameters,
|
|
217
232
|
please refer to `Custom Operators Tutorial
|
|
218
|
-
<https://www.mindspore.cn/
|
|
233
|
+
<https://www.mindspore.cn/tutorials/en/master/custom_program/op_custom.html>`_ .
|
|
219
234
|
|
|
220
235
|
.. warning::
|
|
221
236
|
- This is an experimental API that is subject to change.
|
|
@@ -223,8 +238,6 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
223
238
|
.. note::
|
|
224
239
|
The supported platforms are determined by the input `func_type`. The supported platforms are as follows:
|
|
225
240
|
|
|
226
|
-
- "hybrid": supports ["GPU", "CPU"].
|
|
227
|
-
- "akg": supports ["GPU", "CPU"].
|
|
228
241
|
- "aot": supports ["GPU", "CPU", "Ascend"].
|
|
229
242
|
- "pyfunc": supports ["CPU"].
|
|
230
243
|
- "julia": supports ["CPU"].
|
|
@@ -233,11 +246,7 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
233
246
|
func (Union[function, str]):
|
|
234
247
|
|
|
235
248
|
- function: If func is of function type, then func should be a Python function which describes the
|
|
236
|
-
computation logic of a user defined operator.
|
|
237
|
-
|
|
238
|
-
1. A AKG operator implementation function, which can use ir builder/tvm compute/hybrid grammar.
|
|
239
|
-
2. A pure python function
|
|
240
|
-
3. An kernel decorated function written by the Hybrid DSL.
|
|
249
|
+
computation logic of a user defined operator.
|
|
241
250
|
|
|
242
251
|
- str: If func is of str type, then str should be a path of file along with a function name.
|
|
243
252
|
This could be used when func_type is "aot" or "julia".
|
|
@@ -251,13 +260,11 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
251
260
|
|
|
252
261
|
- "xxx.so" file generation:
|
|
253
262
|
|
|
254
|
-
1) GPU Platform: Given user defined "xxx.cu" file (ex. "{path}/add.cu"),
|
|
255
|
-
|
|
256
|
-
it.(ex. :code:`nvcc --shared -Xcompiler -fPIC -o add.so add.cu`)
|
|
263
|
+
1) GPU Platform: Given user defined "xxx.cu" file (ex. "{path}/add.cu"), use nvcc command to compile
|
|
264
|
+
it.(ex. "nvcc --shared -Xcompiler -fPIC -o add.so add.cu")
|
|
257
265
|
|
|
258
|
-
2) CPU Platform: Given user defined "xxx.cc" file (ex. "{path}/add.cc"),
|
|
259
|
-
|
|
260
|
-
compile it.(ex. :code:`g++ --shared -fPIC -o add.so add.cc`)
|
|
266
|
+
2) CPU Platform: Given user defined "xxx.cc" file (ex. "{path}/add.cc"), use g++/gcc command to
|
|
267
|
+
compile it.(ex. "g++ --shared -fPIC -o add.so add.cc")
|
|
261
268
|
|
|
262
269
|
- Define a "xxx.cc"/"xxx.cu" file:
|
|
263
270
|
|
|
@@ -305,14 +312,17 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
305
312
|
b) Ascend platform.
|
|
306
313
|
Before using Custom operators on the Ascend platform, users must first develop custom operators
|
|
307
314
|
based on Ascend C and compile them. The complete development and usage process can refer to the
|
|
308
|
-
tutorial `AOT-Type Custom Operators(Ascend)
|
|
315
|
+
tutorial `AOT-Type Custom Operators(Ascend)
|
|
316
|
+
<https://www.mindspore.cn/tutorials/en/master/custom_program/operation/op_custom_ascendc.html>`_.
|
|
309
317
|
By passing the name of the operator through the input parameter `func`, there are two usage methods
|
|
310
|
-
based on the implementation of the infer
|
|
311
|
-
|
|
312
|
-
- Python infer: If the operator's infer
|
|
313
|
-
function is passed through the `out_shape` parameter,
|
|
314
|
-
|
|
315
|
-
|
|
318
|
+
based on the implementation of the infer function:
|
|
319
|
+
|
|
320
|
+
- Python infer: If the operator's infer function is implemented in Python, that is, the infer shape
|
|
321
|
+
function is passed through the `out_shape` parameter, and the infer type is passed throuht the
|
|
322
|
+
`out_dtype`, then the `func` should be specified as the operator name, for example,
|
|
323
|
+
`func="CustomName"`.
|
|
324
|
+
- C++ infer: If the operator's infer function is implemented through C++, then pass the path of the
|
|
325
|
+
infer function implementation file in `func` and separate the operator name with `:`,
|
|
316
326
|
for example: `func="add_custom_infer.cc:AddCustom"` .
|
|
317
327
|
|
|
318
328
|
2. for "julia":
|
|
@@ -356,7 +366,7 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
356
366
|
|
|
357
367
|
func_type (str): The implementation type of `func`, should be one of
|
|
358
368
|
|
|
359
|
-
[ ``"
|
|
369
|
+
[ ``"aot"`` , ``"pyfunc"`` , ``"julia"`` ].
|
|
360
370
|
|
|
361
371
|
bprop (function): The back propagation function of `func`. Default: ``None`` .
|
|
362
372
|
reg_info (Union[str, dict, list, tuple]): Represents the registration information(reg info) of `func` with
|
|
@@ -400,50 +410,14 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
400
410
|
>>> input_x = Tensor(np.ones([16, 16]).astype(np.float32))
|
|
401
411
|
>>> input_y = Tensor(np.ones([16, 16]).astype(np.float32))
|
|
402
412
|
>>>
|
|
403
|
-
>>> # Example, func_type = "hybrid"
|
|
404
|
-
>>> # This is the default func_type in Custom,
|
|
405
|
-
>>> # and both out_shape and out_dtype can be None(default value).
|
|
406
|
-
>>> # In this case, the input func must be a function written in the Hybrid DSL
|
|
407
|
-
>>> # and decorated by @kernel.
|
|
408
|
-
>>> @kernel
|
|
409
|
-
... def add_script(a, b):
|
|
410
|
-
... c = output_tensor(a.shape, a.dtype)
|
|
411
|
-
... for i0 in range(a.shape[0]):
|
|
412
|
-
... for i1 in range(a.shape[1]):
|
|
413
|
-
... c[i0, i1] = a[i0, i1] + b[i0, i1]
|
|
414
|
-
... return c
|
|
415
|
-
>>>
|
|
416
|
-
>>> test_op_hybrid = ops.Custom(add_script)
|
|
417
|
-
>>> output = test_op_hybrid(input_x, input_y)
|
|
418
|
-
>>> # the result will be a 16 * 16 tensor with all elements 2
|
|
419
|
-
>>> print(output.shape)
|
|
420
|
-
(16, 16)
|
|
421
|
-
>>> # Example, func_type = "aot"
|
|
422
|
-
>>> def test_aot(x, y, out_shapes, out_types):
|
|
423
|
-
... program = ops.Custom("./reorganize.so:CustomReorganize", out_shapes, out_types, "aot")
|
|
424
|
-
... out = program(x, y)
|
|
425
|
-
... return out
|
|
426
|
-
>>>
|
|
427
413
|
>>> # Example, func_type = "pyfunc"
|
|
428
|
-
>>> def
|
|
429
|
-
... return
|
|
414
|
+
>>> def func_pyfunc(x1, x2):
|
|
415
|
+
... return x1 + x2
|
|
430
416
|
>>>
|
|
431
|
-
>>> test_pyfunc = ops.Custom(
|
|
417
|
+
>>> test_pyfunc = ops.Custom(func_pyfunc, lambda x, _: x, lambda x, _: x, "pyfunc")
|
|
432
418
|
>>> output = test_pyfunc(input_x, input_y)
|
|
433
|
-
>>>
|
|
434
|
-
|
|
435
|
-
>>> # julia code:
|
|
436
|
-
>>> # add.jl
|
|
437
|
-
>>> # module Add
|
|
438
|
-
>>> # function add(x, y, z)
|
|
439
|
-
>>> # z .= x + y
|
|
440
|
-
>>> # return z
|
|
441
|
-
>>> # end
|
|
442
|
-
>>> # end
|
|
443
|
-
>>> def test_julia(x, y, out_shapes, out_types):
|
|
444
|
-
... program = ops.Custom("./add.jl:Add:add", out_shapes, out_types, "julia")
|
|
445
|
-
... out = program(x, y)
|
|
446
|
-
... return out
|
|
419
|
+
>>> print(output.shape)
|
|
420
|
+
(16, 16)
|
|
447
421
|
"""
|
|
448
422
|
|
|
449
423
|
registered_func = {}
|
|
@@ -469,6 +443,8 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
469
443
|
self._func_compile_attrs = {}
|
|
470
444
|
self._is_ms_kernel = False
|
|
471
445
|
self.out_shape = out_shape
|
|
446
|
+
self.out_dtype = out_dtype
|
|
447
|
+
self.is_ascend_c = context.get_context("device_target") == "Ascend" and self.func_type == "aot"
|
|
472
448
|
|
|
473
449
|
self._check_platform()
|
|
474
450
|
self._check_func()
|
|
@@ -484,15 +460,17 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
484
460
|
add_pyfunc(func_id, self.func)
|
|
485
461
|
self.add_prim_attr("fn_id", func_id)
|
|
486
462
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
self.
|
|
463
|
+
self.set_infer_flag()
|
|
464
|
+
|
|
465
|
+
self.multi_output = (reg_info is not None and (len(reg_info.get("outputs", [])) > 1))
|
|
466
|
+
self.add_prim_attr("multi_output", self.multi_output)
|
|
467
|
+
|
|
490
468
|
self.bprop = bprop
|
|
491
469
|
self.fake_output = False
|
|
492
470
|
self.single_scalar_output = False
|
|
493
|
-
if not self.out_dtype:
|
|
471
|
+
if not self.out_dtype and not self.func_type == "pyfunc":
|
|
494
472
|
self.fake_output = True
|
|
495
|
-
elif not self.out_shape:
|
|
473
|
+
elif not self.out_shape and self.func_type == "pyfunc":
|
|
496
474
|
self.single_scalar_output = True
|
|
497
475
|
self.add_prim_attr("fake_output", self.fake_output)
|
|
498
476
|
self.add_prim_attr("single_scalar_output", self.single_scalar_output)
|
|
@@ -508,13 +486,28 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
508
486
|
|
|
509
487
|
self.add_prim_attr("func_type", self.func_type)
|
|
510
488
|
self._update_attr()
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
self.
|
|
489
|
+
|
|
490
|
+
if self.is_ascend_c:
|
|
491
|
+
self.set_inputs_type(reg_info)
|
|
492
|
+
self.custom_pyboost = _CustomExt(self.func, self.out_shape, self.out_dtype, self.bprop)
|
|
515
493
|
for key, value in super().get_attr_dict().items():
|
|
516
494
|
self.custom_pyboost.add_prim_attr(key, value)
|
|
517
495
|
|
|
496
|
+
def set_infer_flag(self):
|
|
497
|
+
"""set cpp infer attr"""
|
|
498
|
+
if self.out_shape is None and self.func_type == "aot":
|
|
499
|
+
self.add_prim_attr("cpp_infer_shape", True)
|
|
500
|
+
if self.out_dtype is None and self.func_type == "aot":
|
|
501
|
+
self.add_prim_attr("cpp_infer_type", True)
|
|
502
|
+
|
|
503
|
+
def set_inputs_type(self, reg_info):
|
|
504
|
+
"""set custom_inputs_type attr"""
|
|
505
|
+
if not self.is_ascend_c or not reg_info.get('attr'):
|
|
506
|
+
return
|
|
507
|
+
inputs_type = ["tensor"] * len(reg_info.get("inputs", [])) + \
|
|
508
|
+
[attr.get("type") for attr in reg_info.get("attr", [])]
|
|
509
|
+
self.add_prim_attr("custom_inputs_type", inputs_type)
|
|
510
|
+
|
|
518
511
|
def __infer__(self, *args):
|
|
519
512
|
if callable(self.out_shape):
|
|
520
513
|
infer_shape = self.out_shape(*(x["shape"] for x in args))
|
|
@@ -554,10 +547,15 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
554
547
|
infer_dtype = mstype.int32
|
|
555
548
|
if self.func_type == "aot":
|
|
556
549
|
if infer_shape is None:
|
|
557
|
-
logger.
|
|
558
|
-
|
|
559
|
-
|
|
550
|
+
logger.debug("{}, 'out_shape' is None. Add a placeholder instead. "
|
|
551
|
+
"A CPP version of infer shape function is required "
|
|
552
|
+
"in this case.".format(self.log_prefix))
|
|
560
553
|
infer_shape = (1,)
|
|
554
|
+
if infer_dtype is None:
|
|
555
|
+
logger.debug("{}, 'out_dtype' is None. Add a placeholder instead. "
|
|
556
|
+
"A CPP version of infer type function is required "
|
|
557
|
+
"in this case.".format(self.log_prefix))
|
|
558
|
+
infer_dtype = ms.float16
|
|
561
559
|
# after all automatic infer information fulfillment, throw error if infer_shape/infer_dtype is still None
|
|
562
560
|
if not isinstance(infer_shape, (tuple, list)):
|
|
563
561
|
raise TypeError("{}, 'out_shape' must be one of [tuple, list, function], but got {}"
|
|
@@ -801,6 +799,26 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
801
799
|
if isinstance(item, dict) and item.get("value") is not None:
|
|
802
800
|
self.add_prim_attr(item[KEY_NAME], item["value"])
|
|
803
801
|
|
|
802
|
+
def _convert_attr_to_input(self, ori_reg_info):
|
|
803
|
+
"""convert attr to input"""
|
|
804
|
+
if not self.is_ascend_c or not ori_reg_info.get("attr"):
|
|
805
|
+
return ori_reg_info
|
|
806
|
+
|
|
807
|
+
reg_info = copy.deepcopy(ori_reg_info)
|
|
808
|
+
start_index = len(reg_info.get("inputs", []))
|
|
809
|
+
for i, attr_item in enumerate(reg_info.get("attr", [])):
|
|
810
|
+
new_input = {
|
|
811
|
+
'index': start_index + i,
|
|
812
|
+
'name': attr_item['name'],
|
|
813
|
+
'paramType': attr_item['paramType']}
|
|
814
|
+
reg_info['inputs'].append(new_input)
|
|
815
|
+
for dtype_format_item in reg_info.get("dtype_format", []):
|
|
816
|
+
new_dtype_format_item = list(dtype_format_item)
|
|
817
|
+
new_dtype_format_item.insert(start_index + i, DataType.None_None)
|
|
818
|
+
reg_info['dtype_format'][reg_info['dtype_format'].index(dtype_format_item)] = new_dtype_format_item
|
|
819
|
+
reg_info['attr'] = []
|
|
820
|
+
return reg_info
|
|
821
|
+
|
|
804
822
|
def _register_info(self, info):
|
|
805
823
|
"""Register reg_info."""
|
|
806
824
|
reg_info = info
|
|
@@ -831,14 +849,15 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
831
849
|
continue
|
|
832
850
|
# Register
|
|
833
851
|
reg_info = self._reformat_reg_info(reg_info, target)
|
|
834
|
-
|
|
852
|
+
new_reg_info = self._convert_attr_to_input(reg_info)
|
|
853
|
+
reg_info_str = json.dumps(new_reg_info)
|
|
835
854
|
op_lib = Oplib()
|
|
836
855
|
if not op_lib.reg_op(reg_info_str, self.imply_path):
|
|
837
856
|
raise ValueError("{}, the registration information is registered failed. Use 'CustomRegOp' to "
|
|
838
857
|
"generate the registration information, then pass it to 'reg_info' or use "
|
|
839
858
|
"'custom_info_register' to bind it to 'func' if 'func' is a function."
|
|
840
859
|
.format(self.log_prefix))
|
|
841
|
-
self._save_attr(
|
|
860
|
+
self._save_attr(new_reg_info)
|
|
842
861
|
self._save_register_status(target)
|
|
843
862
|
|
|
844
863
|
def _get_expanded_list(self, data):
|
|
@@ -1122,10 +1141,202 @@ class Custom(ops.PrimitiveWithInfer):
|
|
|
1122
1141
|
return infer_shape, infer_dtype, infer_value
|
|
1123
1142
|
|
|
1124
1143
|
def __call__(self, *args):
|
|
1125
|
-
if self.
|
|
1126
|
-
|
|
1144
|
+
if self.is_ascend_c:
|
|
1145
|
+
res = pyboost_custom_ext(self.custom_pyboost, [args])
|
|
1146
|
+
return res if self.multi_output else res[0]
|
|
1127
1147
|
should_elim, output = self.check_elim(*args)
|
|
1128
1148
|
if should_elim:
|
|
1129
1149
|
return output
|
|
1130
1150
|
# pylint: disable=protected-access
|
|
1131
1151
|
return ops.primitive._run_op(self, self.name, args)
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
class CustomOpBuilder:
|
|
1155
|
+
r"""
|
|
1156
|
+
CustomOpBuilder is used to initialize and configure custom operators for MindSpore.
|
|
1157
|
+
Users can define and load custom operator modules through this class and apply them to the network.
|
|
1158
|
+
|
|
1159
|
+
In most cases, users only need to provide the source files and additional compilation options in the constructor
|
|
1160
|
+
and call the `load` method to complete the compilation and loading of the operator.
|
|
1161
|
+
If users have specific customization requirements, they can inherit this class and override certain methods.
|
|
1162
|
+
It is important to note that if methods are overridden, some parameters passed to the constructor may be ignored.
|
|
1163
|
+
|
|
1164
|
+
.. warning::
|
|
1165
|
+
This is an experimental API that is subject to change.
|
|
1166
|
+
|
|
1167
|
+
Args:
|
|
1168
|
+
name (str): The unique name of the custom operator module, used to identify the operator.
|
|
1169
|
+
sources (Union[str, list[str]]): The source file(s) of the custom operator. It can be a single file path or
|
|
1170
|
+
a list of file paths.
|
|
1171
|
+
backend (str, optional): The target backend for the operator, such as "CPU" or "Ascend". Default: ``None``.
|
|
1172
|
+
include_paths (list[str], optional): Additionally included paths needed during compilation. Default: ``None``.
|
|
1173
|
+
cflags (str, optional): Extra C++ compiler flags to be used during compilation. Default: ``None``.
|
|
1174
|
+
ldflags (str, optional): Extra linker flags to be used during linking. Default: ``None``.
|
|
1175
|
+
kwargs (dict, optional): Additional keyword arguments for future extensions or specific custom requirements.
|
|
1176
|
+
|
|
1177
|
+
.. note::
|
|
1178
|
+
- If the `backend` argument is provided, additional default flags will be automatically added to
|
|
1179
|
+
the compilation and linking steps to support the operator's target backend. The default options
|
|
1180
|
+
can be referenced in the implementation of the `get_cflags` and `get_ldflags` methods in the `CustomOpBuilder
|
|
1181
|
+
<https://gitee.com/mindspore/mindspore/blob/master/mindspore/python/mindspore/ops/operations/custom_ops.py>`_.
|
|
1182
|
+
- The `sources` argument must point to valid source files for the custom operator.
|
|
1183
|
+
|
|
1184
|
+
Supported Platforms:
|
|
1185
|
+
``Ascend`` ``CPU``
|
|
1186
|
+
|
|
1187
|
+
Examples:
|
|
1188
|
+
>>> from mindspore import ops
|
|
1189
|
+
>>> builder = ops.CustomOpBuilder(
|
|
1190
|
+
... name="custom_op_cpu",
|
|
1191
|
+
... sources="custom_ops_impl/pybind_op_cpu.cpp",
|
|
1192
|
+
... backend="CPU"
|
|
1193
|
+
... )
|
|
1194
|
+
>>> my_ops = builder.load()
|
|
1195
|
+
"""
|
|
1196
|
+
_mindspore_path = None
|
|
1197
|
+
_loaded_ops = {}
|
|
1198
|
+
_ms_code_base = None
|
|
1199
|
+
|
|
1200
|
+
def __init__(self, name, sources, backend=None, include_paths=None, cflags=None, ldflags=None, **kwargs):
|
|
1201
|
+
self.name = name
|
|
1202
|
+
self.source = sources
|
|
1203
|
+
self.backend = backend
|
|
1204
|
+
self.include_paths = include_paths
|
|
1205
|
+
self.cflags = cflags
|
|
1206
|
+
self.ldflags = ldflags
|
|
1207
|
+
self.build_dir = kwargs.get("build_dir")
|
|
1208
|
+
if CustomOpBuilder._mindspore_path is None:
|
|
1209
|
+
CustomOpBuilder._mindspore_path = os.path.dirname(os.path.abspath(ms.__file__))
|
|
1210
|
+
CustomOpBuilder._ms_code_base = os.path.join(CustomOpBuilder._mindspore_path, "include")
|
|
1211
|
+
if self.backend == "Ascend":
|
|
1212
|
+
self.ascend_cann_path = os.getenv("ASCEND_OPP_PATH").split('opp')[0]
|
|
1213
|
+
|
|
1214
|
+
def get_sources(self):
|
|
1215
|
+
"""
|
|
1216
|
+
Get the source files for the custom operator.
|
|
1217
|
+
|
|
1218
|
+
Returns:
|
|
1219
|
+
str or list[str], The source file(s) for the operator.
|
|
1220
|
+
"""
|
|
1221
|
+
return self.source
|
|
1222
|
+
|
|
1223
|
+
def get_include_paths(self):
|
|
1224
|
+
"""
|
|
1225
|
+
Get the include paths required for compiling the custom operator.
|
|
1226
|
+
|
|
1227
|
+
Returns:
|
|
1228
|
+
list[str], A list of include paths.
|
|
1229
|
+
"""
|
|
1230
|
+
include_list = self.include_paths if self.include_paths is not None else []
|
|
1231
|
+
include_list.append(CustomOpBuilder._mindspore_path)
|
|
1232
|
+
include_list.append(os.path.join(CustomOpBuilder._mindspore_path, "include"))
|
|
1233
|
+
include_list.append(os.path.join(CustomOpBuilder._mindspore_path, "include/third_party"))
|
|
1234
|
+
include_list.append(os.path.join(CustomOpBuilder._mindspore_path, "include/third_party/robin_hood_hashing"))
|
|
1235
|
+
include_list.append(os.path.join(CustomOpBuilder._mindspore_path, "include/third_party/securec/include"))
|
|
1236
|
+
|
|
1237
|
+
if self.backend == "Ascend":
|
|
1238
|
+
include_list.append(os.path.join(self.ascend_cann_path, "include"))
|
|
1239
|
+
include_list += self._get_ms_inner_includes()
|
|
1240
|
+
return include_list
|
|
1241
|
+
|
|
1242
|
+
def _get_ms_inner_includes(self):
|
|
1243
|
+
"""include paths for inner module interface."""
|
|
1244
|
+
ms_inner_code_base = os.path.join(CustomOpBuilder._mindspore_path, "include", "mindspore")
|
|
1245
|
+
include_list = []
|
|
1246
|
+
include_list.append(ms_inner_code_base + "/core/include")
|
|
1247
|
+
include_list.append(ms_inner_code_base + "/core/mindrt/include")
|
|
1248
|
+
include_list.append(ms_inner_code_base + "/core/mindrt")
|
|
1249
|
+
include_list.append(ms_inner_code_base + "/ops")
|
|
1250
|
+
include_list.append(ms_inner_code_base + "/ops/kernel/include")
|
|
1251
|
+
include_list.append(ms_inner_code_base + "/ccsrc")
|
|
1252
|
+
include_list.append(ms_inner_code_base + "/ccsrc/include")
|
|
1253
|
+
include_list.append(ms_inner_code_base + "/ccsrc/minddata/mindrecord/include")
|
|
1254
|
+
return include_list
|
|
1255
|
+
|
|
1256
|
+
def get_cflags(self):
|
|
1257
|
+
"""
|
|
1258
|
+
Get the C++ compiler flags for building the custom operator.
|
|
1259
|
+
|
|
1260
|
+
Returns:
|
|
1261
|
+
list[str], A list of C++ compiler flags.
|
|
1262
|
+
"""
|
|
1263
|
+
flags = ['-fstack-protector-all', '-fPIC', '-pie']
|
|
1264
|
+
flags += ['-DENABLE_FAST_HASH_TABLE=1']
|
|
1265
|
+
if self.backend == "Ascend":
|
|
1266
|
+
flags.append('-DCUSTOM_ASCEND_OP')
|
|
1267
|
+
if self.cflags is not None:
|
|
1268
|
+
flags.append(self.cflags)
|
|
1269
|
+
return flags
|
|
1270
|
+
|
|
1271
|
+
def get_ldflags(self):
|
|
1272
|
+
"""
|
|
1273
|
+
Get the linker flags for building the custom operator.
|
|
1274
|
+
|
|
1275
|
+
Returns:
|
|
1276
|
+
list[str], A list of linker flags.
|
|
1277
|
+
"""
|
|
1278
|
+
flags = ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wl,--disable-new-dtags,--rpath', '-s']
|
|
1279
|
+
flags += [
|
|
1280
|
+
'-L' + os.path.abspath(os.path.join(CustomOpBuilder._mindspore_path, 'lib')),
|
|
1281
|
+
'-lmindspore_core',
|
|
1282
|
+
'-lmindspore_ms_backend',
|
|
1283
|
+
'-lmindspore_pynative'
|
|
1284
|
+
]
|
|
1285
|
+
if self.backend == "Ascend":
|
|
1286
|
+
flags.append('-L' + os.path.abspath(os.path.join(CustomOpBuilder._mindspore_path, 'lib/plugin')))
|
|
1287
|
+
flags.append('-L' + os.path.abspath(os.path.join(self.ascend_cann_path, "lib64")))
|
|
1288
|
+
flags.append('-lascendcl')
|
|
1289
|
+
flags.append('-l:libmindspore_ascend.so.2')
|
|
1290
|
+
if self.ldflags is not None:
|
|
1291
|
+
flags.append(self.ldflags)
|
|
1292
|
+
return flags
|
|
1293
|
+
|
|
1294
|
+
def build(self):
|
|
1295
|
+
"""
|
|
1296
|
+
Build the custom operator module.
|
|
1297
|
+
|
|
1298
|
+
This method generates a dynamic library file for the custom operator based on the provided source files,
|
|
1299
|
+
include paths, compilation flags, and link flags.
|
|
1300
|
+
|
|
1301
|
+
Returns:
|
|
1302
|
+
str, The path to the compiled module.
|
|
1303
|
+
"""
|
|
1304
|
+
return ExtensionBuilder(self._get_build_directory()).build(
|
|
1305
|
+
module_name=self.name,
|
|
1306
|
+
sources=self.get_sources(),
|
|
1307
|
+
extra_include_paths=self.get_include_paths(),
|
|
1308
|
+
extra_cflags=self.get_cflags(),
|
|
1309
|
+
extra_ldflags=self.get_ldflags())
|
|
1310
|
+
|
|
1311
|
+
def load(self):
|
|
1312
|
+
"""
|
|
1313
|
+
Build and load the custom operator module.
|
|
1314
|
+
|
|
1315
|
+
Returns:
|
|
1316
|
+
Module, The loaded custom operator module.
|
|
1317
|
+
"""
|
|
1318
|
+
if self.name in CustomOpBuilder._loaded_ops:
|
|
1319
|
+
return CustomOpBuilder._loaded_ops[self.name]
|
|
1320
|
+
module_path = self.build()
|
|
1321
|
+
mod = self._import_module(module_path)
|
|
1322
|
+
CustomOpBuilder._loaded_ops[self.name] = mod
|
|
1323
|
+
return mod
|
|
1324
|
+
|
|
1325
|
+
def _import_module(self, module_path):
|
|
1326
|
+
"""Import module from library."""
|
|
1327
|
+
spec = importlib.util.spec_from_file_location(self.name, module_path)
|
|
1328
|
+
module = importlib.util.module_from_spec(spec)
|
|
1329
|
+
spec.loader.exec_module(module)
|
|
1330
|
+
return module
|
|
1331
|
+
|
|
1332
|
+
def _get_build_directory(self):
|
|
1333
|
+
"""Get build directory."""
|
|
1334
|
+
if self.build_dir is None:
|
|
1335
|
+
build_root = os.path.realpath(os.getenv('MS_COMPILER_CACHE_PATH', "./kernel_meta"))
|
|
1336
|
+
self.build_dir = os.path.join(build_root, self.name)
|
|
1337
|
+
else:
|
|
1338
|
+
self.build_dir = os.path.realpath(self.build_dir)
|
|
1339
|
+
logger.info(f'Build {self.name} in directory {self.build_dir}')
|
|
1340
|
+
if not os.path.exists(self.build_dir):
|
|
1341
|
+
os.makedirs(self.build_dir, exist_ok=True)
|
|
1342
|
+
return self.build_dir
|