mindspore 2.4.0__cp311-cp311-macosx_11_0_arm64.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 -0
- mindspore/__init__.py +53 -0
- mindspore/_c_dataengine.cpython-311-darwin.so +0 -0
- mindspore/_c_expression.cpython-311-darwin.so +0 -0
- mindspore/_c_mindrecord.cpython-311-darwin.so +0 -0
- mindspore/_check_jit_forbidden_api.py +106 -0
- mindspore/_checkparam.py +1419 -0
- mindspore/_extends/__init__.py +23 -0
- mindspore/_extends/builtin_operations.py +224 -0
- mindspore/_extends/graph_kernel/__init__.py +17 -0
- mindspore/_extends/graph_kernel/model/__init__.py +19 -0
- mindspore/_extends/graph_kernel/model/graph_parallel.py +311 -0
- mindspore/_extends/graph_kernel/model/graph_split.py +1348 -0
- mindspore/_extends/graph_kernel/model/model.py +553 -0
- mindspore/_extends/graph_kernel/model/model_builder.py +216 -0
- mindspore/_extends/graph_kernel/parallel_estimate.py +60 -0
- mindspore/_extends/graph_kernel/splitter.py +140 -0
- mindspore/_extends/graph_kernel/utils.py +28 -0
- mindspore/_extends/parallel_compile/__init__.py +19 -0
- mindspore/_extends/parallel_compile/akg_compiler/__init__.py +19 -0
- mindspore/_extends/parallel_compile/akg_compiler/akg_process.py +269 -0
- mindspore/_extends/parallel_compile/akg_compiler/build_tbe_kernel.py +529 -0
- mindspore/_extends/parallel_compile/akg_compiler/compiler.py +56 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/get_file_path.py +36 -0
- mindspore/_extends/parallel_compile/akg_compiler/tbe_topi.py +556 -0
- mindspore/_extends/parallel_compile/akg_compiler/util.py +159 -0
- mindspore/_extends/parse/__init__.py +49 -0
- mindspore/_extends/parse/compile_config.py +299 -0
- mindspore/_extends/parse/namespace.py +136 -0
- mindspore/_extends/parse/parser.py +1448 -0
- mindspore/_extends/parse/resources.py +213 -0
- mindspore/_extends/parse/standard_method.py +4475 -0
- mindspore/_extends/parse/trope.py +97 -0
- mindspore/_extends/pijit/__init__.py +23 -0
- mindspore/_extends/pijit/pijit_func_white_list.py +669 -0
- mindspore/_extends/remote/__init__.py +19 -0
- mindspore/_extends/remote/kernel_build_server.py +199 -0
- mindspore/_extends/remote/kernel_build_server_akg.py +55 -0
- mindspore/_extends/remote/kernel_build_server_akg_v2.py +55 -0
- mindspore/_extends/remote/kernel_build_server_ascend.py +75 -0
- mindspore/_extends/utils.py +68 -0
- mindspore/_install_custom.py +43 -0
- mindspore/_profiler.py +30 -0
- mindspore/amp.py +433 -0
- mindspore/boost/__init__.py +42 -0
- mindspore/boost/adasum.py +319 -0
- mindspore/boost/base.py +535 -0
- mindspore/boost/boost.py +400 -0
- mindspore/boost/boost_cell_wrapper.py +790 -0
- mindspore/boost/dim_reduce.py +323 -0
- mindspore/boost/grad_accumulation.py +79 -0
- mindspore/boost/grad_freeze.py +382 -0
- mindspore/boost/group_loss_scale_manager.py +166 -0
- mindspore/boost/less_batch_normalization.py +174 -0
- mindspore/common/__init__.py +86 -0
- mindspore/common/_auto_dynamic.py +68 -0
- mindspore/common/_decorator.py +50 -0
- mindspore/common/_jit_fallback_utils.py +110 -0
- mindspore/common/_monad.py +25 -0
- mindspore/common/_pijit_context.py +190 -0
- mindspore/common/_register_for_adapter.py +74 -0
- mindspore/common/_register_for_recompute.py +48 -0
- mindspore/common/_register_for_tensor.py +46 -0
- mindspore/common/_stub_tensor.py +210 -0
- mindspore/common/_tensor_overload.py +139 -0
- mindspore/common/_utils.py +122 -0
- mindspore/common/api.py +2064 -0
- mindspore/common/auto_dynamic_shape.py +507 -0
- mindspore/common/dtype.py +422 -0
- mindspore/common/dump.py +130 -0
- mindspore/common/file_system.py +48 -0
- mindspore/common/generator.py +254 -0
- mindspore/common/hook_handle.py +143 -0
- mindspore/common/initializer.py +880 -0
- mindspore/common/jit_config.py +98 -0
- mindspore/common/lazy_inline.py +240 -0
- mindspore/common/mindir_util.py +111 -0
- mindspore/common/mutable.py +234 -0
- mindspore/common/no_inline.py +54 -0
- mindspore/common/np_dtype.py +25 -0
- mindspore/common/parameter.py +1081 -0
- mindspore/common/recompute.py +292 -0
- mindspore/common/seed.py +260 -0
- mindspore/common/sparse_tensor.py +1175 -0
- mindspore/common/symbol.py +122 -0
- mindspore/common/tensor.py +5039 -0
- mindspore/communication/__init__.py +37 -0
- mindspore/communication/_comm_helper.py +501 -0
- mindspore/communication/_hccl_management.py +297 -0
- mindspore/communication/comm_func.py +1395 -0
- mindspore/communication/management.py +673 -0
- mindspore/config/op_info.config +533 -0
- mindspore/context.py +2077 -0
- mindspore/dataset/__init__.py +90 -0
- mindspore/dataset/audio/__init__.py +61 -0
- mindspore/dataset/audio/transforms.py +3690 -0
- mindspore/dataset/audio/utils.py +386 -0
- mindspore/dataset/audio/validators.py +1172 -0
- mindspore/dataset/callback/__init__.py +20 -0
- mindspore/dataset/callback/ds_callback.py +368 -0
- mindspore/dataset/callback/validators.py +32 -0
- mindspore/dataset/core/__init__.py +13 -0
- mindspore/dataset/core/config.py +1095 -0
- mindspore/dataset/core/datatypes.py +101 -0
- mindspore/dataset/core/py_util_helpers.py +65 -0
- mindspore/dataset/core/validator_helpers.py +781 -0
- mindspore/dataset/debug/__init__.py +21 -0
- mindspore/dataset/debug/debug_hook.py +97 -0
- mindspore/dataset/debug/pre_defined_hook.py +67 -0
- mindspore/dataset/engine/__init__.py +124 -0
- mindspore/dataset/engine/cache_admin.py +47 -0
- mindspore/dataset/engine/cache_client.py +129 -0
- mindspore/dataset/engine/datasets.py +4582 -0
- mindspore/dataset/engine/datasets_audio.py +911 -0
- mindspore/dataset/engine/datasets_standard_format.py +543 -0
- mindspore/dataset/engine/datasets_text.py +2161 -0
- mindspore/dataset/engine/datasets_user_defined.py +1184 -0
- mindspore/dataset/engine/datasets_vision.py +4816 -0
- mindspore/dataset/engine/iterators.py +371 -0
- mindspore/dataset/engine/obs/__init__.py +23 -0
- mindspore/dataset/engine/obs/config_loader.py +68 -0
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +508 -0
- mindspore/dataset/engine/obs/util.py +482 -0
- mindspore/dataset/engine/offload.py +596 -0
- mindspore/dataset/engine/queue.py +304 -0
- mindspore/dataset/engine/samplers.py +895 -0
- mindspore/dataset/engine/serializer_deserializer.py +159 -0
- mindspore/dataset/engine/validators.py +2895 -0
- mindspore/dataset/text/__init__.py +51 -0
- mindspore/dataset/text/transforms.py +1703 -0
- mindspore/dataset/text/utils.py +715 -0
- mindspore/dataset/text/validators.py +642 -0
- mindspore/dataset/transforms/__init__.py +45 -0
- mindspore/dataset/transforms/c_transforms.py +638 -0
- mindspore/dataset/transforms/py_transforms.py +393 -0
- mindspore/dataset/transforms/py_transforms_util.py +255 -0
- mindspore/dataset/transforms/transforms.py +1260 -0
- mindspore/dataset/transforms/validators.py +410 -0
- mindspore/dataset/utils/__init__.py +19 -0
- mindspore/dataset/utils/browse_dataset.py +190 -0
- mindspore/dataset/utils/line_reader.py +126 -0
- mindspore/dataset/vision/__init__.py +65 -0
- mindspore/dataset/vision/c_transforms.py +2641 -0
- mindspore/dataset/vision/py_transforms.py +2120 -0
- mindspore/dataset/vision/py_transforms_util.py +1660 -0
- mindspore/dataset/vision/transforms.py +7295 -0
- mindspore/dataset/vision/utils.py +863 -0
- mindspore/dataset/vision/validators.py +1483 -0
- mindspore/default_config.py +2 -0
- mindspore/experimental/__init__.py +20 -0
- mindspore/experimental/es/__init__.py +22 -0
- mindspore/experimental/es/embedding_service.py +883 -0
- mindspore/experimental/es/embedding_service_layer.py +581 -0
- mindspore/experimental/llm_boost/__init__.py +21 -0
- mindspore/experimental/llm_boost/atb/__init__.py +23 -0
- mindspore/experimental/llm_boost/atb/boost_base.py +211 -0
- mindspore/experimental/llm_boost/atb/llama_boost.py +115 -0
- mindspore/experimental/llm_boost/atb/qwen_boost.py +101 -0
- mindspore/experimental/llm_boost/register.py +129 -0
- mindspore/experimental/llm_boost/utils.py +31 -0
- mindspore/experimental/map_parameter.py +309 -0
- mindspore/experimental/optim/__init__.py +40 -0
- mindspore/experimental/optim/adadelta.py +161 -0
- mindspore/experimental/optim/adagrad.py +168 -0
- mindspore/experimental/optim/adam.py +193 -0
- mindspore/experimental/optim/adamax.py +170 -0
- mindspore/experimental/optim/adamw.py +290 -0
- mindspore/experimental/optim/asgd.py +153 -0
- mindspore/experimental/optim/lr_scheduler.py +1371 -0
- mindspore/experimental/optim/nadam.py +157 -0
- mindspore/experimental/optim/optimizer.py +262 -0
- mindspore/experimental/optim/radam.py +194 -0
- mindspore/experimental/optim/rmsprop.py +154 -0
- mindspore/experimental/optim/rprop.py +164 -0
- mindspore/experimental/optim/sgd.py +156 -0
- mindspore/hal/__init__.py +40 -0
- mindspore/hal/_ascend.py +57 -0
- mindspore/hal/_base.py +57 -0
- mindspore/hal/_cpu.py +56 -0
- mindspore/hal/_gpu.py +57 -0
- mindspore/hal/contiguous_tensors_handle.py +175 -0
- mindspore/hal/device.py +356 -0
- mindspore/hal/event.py +179 -0
- mindspore/hal/memory.py +326 -0
- mindspore/hal/stream.py +357 -0
- mindspore/include/OWNERS +7 -0
- mindspore/include/api/allocator.h +97 -0
- mindspore/include/api/callback/callback.h +93 -0
- mindspore/include/api/callback/ckpt_saver.h +41 -0
- mindspore/include/api/callback/loss_monitor.h +33 -0
- mindspore/include/api/callback/lr_scheduler.h +51 -0
- mindspore/include/api/callback/time_monitor.h +34 -0
- mindspore/include/api/callback/train_accuracy.h +37 -0
- mindspore/include/api/cell.h +90 -0
- mindspore/include/api/cfg.h +82 -0
- mindspore/include/api/context.h +602 -0
- mindspore/include/api/data_type.h +47 -0
- mindspore/include/api/delegate.h +178 -0
- mindspore/include/api/delegate_api.h +75 -0
- mindspore/include/api/dual_abi_helper.h +208 -0
- mindspore/include/api/format.h +28 -0
- mindspore/include/api/graph.h +46 -0
- mindspore/include/api/kernel.h +58 -0
- mindspore/include/api/kernel_api.h +168 -0
- mindspore/include/api/metrics/accuracy.h +36 -0
- mindspore/include/api/metrics/metrics.h +41 -0
- mindspore/include/api/model.h +438 -0
- mindspore/include/api/model_group.h +91 -0
- mindspore/include/api/model_parallel_runner.h +168 -0
- mindspore/include/api/serialization.h +185 -0
- mindspore/include/api/status.h +192 -0
- mindspore/include/api/types.h +431 -0
- mindspore/include/api/visible.h +41 -0
- mindspore/include/c_api/context_c.h +179 -0
- mindspore/include/c_api/data_type_c.h +52 -0
- mindspore/include/c_api/format_c.h +46 -0
- mindspore/include/c_api/model_c.h +347 -0
- mindspore/include/c_api/status_c.h +79 -0
- mindspore/include/c_api/tensor_c.h +146 -0
- mindspore/include/c_api/types_c.h +67 -0
- mindspore/include/dataset/config.h +163 -0
- mindspore/include/dataset/constants.h +363 -0
- mindspore/include/dataset/execute.h +196 -0
- mindspore/include/dataset/text.h +1092 -0
- mindspore/include/dataset/transforms.h +638 -0
- mindspore/include/dataset/vision.h +2129 -0
- mindspore/include/dataset/vision_ascend.h +206 -0
- mindspore/include/dataset/vision_lite.h +625 -0
- mindspore/lib/libavcodec.59.dylib +0 -0
- mindspore/lib/libavdevice.59.dylib +0 -0
- mindspore/lib/libavfilter.8.dylib +0 -0
- mindspore/lib/libavformat.59.dylib +0 -0
- mindspore/lib/libavutil.57.dylib +0 -0
- mindspore/lib/libdnnl.2.dylib +0 -0
- mindspore/lib/libicudata.69.dylib +0 -0
- mindspore/lib/libicui18n.69.dylib +0 -0
- mindspore/lib/libicuuc.69.dylib +0 -0
- mindspore/lib/libmindspore_address_sorting.15.dylib +0 -0
- mindspore/lib/libmindspore_backend.dylib +0 -0
- mindspore/lib/libmindspore_common.dylib +0 -0
- mindspore/lib/libmindspore_core.dylib +0 -0
- mindspore/lib/libmindspore_glog.0.dylib +0 -0
- mindspore/lib/libmindspore_gpr.15.dylib +0 -0
- mindspore/lib/libmindspore_grpc++.1.dylib +0 -0
- mindspore/lib/libmindspore_grpc.15.dylib +0 -0
- mindspore/lib/libmindspore_np_dtype.dylib +0 -0
- mindspore/lib/libmindspore_ops.dylib +0 -0
- mindspore/lib/libmindspore_upb.15.dylib +0 -0
- mindspore/lib/libnnacl.dylib +0 -0
- mindspore/lib/libopencv_core.4.5.dylib +0 -0
- mindspore/lib/libopencv_imgcodecs.4.5.dylib +0 -0
- mindspore/lib/libopencv_imgproc.4.5.dylib +0 -0
- mindspore/lib/libps_cache.dylib +0 -0
- mindspore/lib/libswresample.4.dylib +0 -0
- mindspore/lib/libswscale.6.dylib +0 -0
- mindspore/lib/libtinyxml2.8.dylib +0 -0
- mindspore/log.py +633 -0
- mindspore/mindrecord/__init__.py +43 -0
- mindspore/mindrecord/common/__init__.py +17 -0
- mindspore/mindrecord/common/constant.py +20 -0
- mindspore/mindrecord/common/enums.py +44 -0
- mindspore/mindrecord/common/exceptions.py +311 -0
- mindspore/mindrecord/config.py +809 -0
- mindspore/mindrecord/filereader.py +174 -0
- mindspore/mindrecord/filewriter.py +722 -0
- mindspore/mindrecord/mindpage.py +210 -0
- mindspore/mindrecord/shardheader.py +141 -0
- mindspore/mindrecord/shardindexgenerator.py +74 -0
- mindspore/mindrecord/shardreader.py +117 -0
- mindspore/mindrecord/shardsegment.py +128 -0
- mindspore/mindrecord/shardutils.py +185 -0
- mindspore/mindrecord/shardwriter.py +237 -0
- mindspore/mindrecord/tools/__init__.py +17 -0
- mindspore/mindrecord/tools/cifar10.py +140 -0
- mindspore/mindrecord/tools/cifar100.py +153 -0
- mindspore/mindrecord/tools/cifar100_to_mr.py +185 -0
- mindspore/mindrecord/tools/cifar10_to_mr.py +177 -0
- mindspore/mindrecord/tools/csv_to_mr.py +200 -0
- mindspore/mindrecord/tools/imagenet_to_mr.py +206 -0
- mindspore/mindrecord/tools/mnist_to_mr.py +259 -0
- mindspore/mindrecord/tools/tfrecord_to_mr.py +360 -0
- mindspore/mint/__init__.py +1586 -0
- mindspore/mint/distributed/__init__.py +31 -0
- mindspore/mint/distributed/distributed.py +254 -0
- mindspore/mint/linalg/__init__.py +22 -0
- mindspore/mint/nn/__init__.py +757 -0
- mindspore/mint/nn/functional.py +679 -0
- mindspore/mint/nn/layer/__init__.py +39 -0
- mindspore/mint/nn/layer/activation.py +133 -0
- mindspore/mint/nn/layer/normalization.py +477 -0
- mindspore/mint/nn/layer/pooling.py +110 -0
- mindspore/mint/optim/__init__.py +24 -0
- mindspore/mint/optim/adamw.py +206 -0
- mindspore/mint/special/__init__.py +63 -0
- mindspore/multiprocessing/__init__.py +73 -0
- mindspore/nn/__init__.py +47 -0
- mindspore/nn/cell.py +2787 -0
- mindspore/nn/dynamic_lr.py +482 -0
- mindspore/nn/grad/__init__.py +21 -0
- mindspore/nn/grad/cell_grad.py +196 -0
- mindspore/nn/layer/__init__.py +63 -0
- mindspore/nn/layer/activation.py +1822 -0
- mindspore/nn/layer/basic.py +1629 -0
- mindspore/nn/layer/channel_shuffle.py +90 -0
- mindspore/nn/layer/combined.py +248 -0
- mindspore/nn/layer/container.py +734 -0
- mindspore/nn/layer/conv.py +1505 -0
- mindspore/nn/layer/dense.py +204 -0
- mindspore/nn/layer/embedding.py +869 -0
- mindspore/nn/layer/image.py +661 -0
- mindspore/nn/layer/math.py +1069 -0
- mindspore/nn/layer/normalization.py +1273 -0
- mindspore/nn/layer/padding.py +880 -0
- mindspore/nn/layer/pooling.py +2302 -0
- mindspore/nn/layer/rnn_cells.py +388 -0
- mindspore/nn/layer/rnns.py +849 -0
- mindspore/nn/layer/thor_layer.py +963 -0
- mindspore/nn/layer/timedistributed.py +155 -0
- mindspore/nn/layer/transformer.py +823 -0
- mindspore/nn/learning_rate_schedule.py +512 -0
- mindspore/nn/loss/__init__.py +36 -0
- mindspore/nn/loss/loss.py +2924 -0
- mindspore/nn/metrics.py +53 -0
- mindspore/nn/optim/__init__.py +45 -0
- mindspore/nn/optim/_dist_optimizer_registry.py +111 -0
- mindspore/nn/optim/ada_grad.py +217 -0
- mindspore/nn/optim/adadelta.py +206 -0
- mindspore/nn/optim/adafactor.py +448 -0
- mindspore/nn/optim/adam.py +1297 -0
- mindspore/nn/optim/adamax.py +220 -0
- mindspore/nn/optim/adasum.py +548 -0
- mindspore/nn/optim/asgd.py +216 -0
- mindspore/nn/optim/ftrl.py +401 -0
- mindspore/nn/optim/lamb.py +296 -0
- mindspore/nn/optim/lars.py +202 -0
- mindspore/nn/optim/lazyadam.py +533 -0
- mindspore/nn/optim/momentum.py +239 -0
- mindspore/nn/optim/optimizer.py +1034 -0
- mindspore/nn/optim/proximal_ada_grad.py +242 -0
- mindspore/nn/optim/rmsprop.py +264 -0
- mindspore/nn/optim/rprop.py +251 -0
- mindspore/nn/optim/sgd.py +237 -0
- mindspore/nn/optim/tft_wrapper.py +127 -0
- mindspore/nn/optim/thor.py +1310 -0
- mindspore/nn/probability/__init__.py +22 -0
- mindspore/nn/probability/bijector/__init__.py +35 -0
- mindspore/nn/probability/bijector/bijector.py +337 -0
- mindspore/nn/probability/bijector/exp.py +65 -0
- mindspore/nn/probability/bijector/gumbel_cdf.py +144 -0
- mindspore/nn/probability/bijector/invert.py +126 -0
- mindspore/nn/probability/bijector/power_transform.py +196 -0
- mindspore/nn/probability/bijector/scalar_affine.py +167 -0
- mindspore/nn/probability/bijector/softplus.py +189 -0
- mindspore/nn/probability/bnn_layers/__init__.py +29 -0
- mindspore/nn/probability/bnn_layers/_util.py +46 -0
- mindspore/nn/probability/bnn_layers/bnn_cell_wrapper.py +112 -0
- mindspore/nn/probability/bnn_layers/conv_variational.py +267 -0
- mindspore/nn/probability/bnn_layers/dense_variational.py +302 -0
- mindspore/nn/probability/bnn_layers/layer_distribution.py +123 -0
- mindspore/nn/probability/distribution/__init__.py +56 -0
- mindspore/nn/probability/distribution/_utils/__init__.py +34 -0
- mindspore/nn/probability/distribution/_utils/custom_ops.py +96 -0
- mindspore/nn/probability/distribution/_utils/utils.py +362 -0
- mindspore/nn/probability/distribution/bernoulli.py +334 -0
- mindspore/nn/probability/distribution/beta.py +391 -0
- mindspore/nn/probability/distribution/categorical.py +435 -0
- mindspore/nn/probability/distribution/cauchy.py +383 -0
- mindspore/nn/probability/distribution/distribution.py +827 -0
- mindspore/nn/probability/distribution/exponential.py +350 -0
- mindspore/nn/probability/distribution/gamma.py +391 -0
- mindspore/nn/probability/distribution/geometric.py +335 -0
- mindspore/nn/probability/distribution/gumbel.py +257 -0
- mindspore/nn/probability/distribution/half_normal.py +133 -0
- mindspore/nn/probability/distribution/laplace.py +128 -0
- mindspore/nn/probability/distribution/log_normal.py +272 -0
- mindspore/nn/probability/distribution/logistic.py +379 -0
- mindspore/nn/probability/distribution/normal.py +336 -0
- mindspore/nn/probability/distribution/poisson.py +288 -0
- mindspore/nn/probability/distribution/student_t.py +149 -0
- mindspore/nn/probability/distribution/transformed_distribution.py +235 -0
- mindspore/nn/probability/distribution/uniform.py +375 -0
- mindspore/nn/reinforcement/__init__.py +24 -0
- mindspore/nn/reinforcement/_batch_read_write.py +142 -0
- mindspore/nn/reinforcement/_tensors_queue.py +152 -0
- mindspore/nn/reinforcement/tensor_array.py +145 -0
- mindspore/nn/sparse/__init__.py +23 -0
- mindspore/nn/sparse/sparse.py +147 -0
- mindspore/nn/wrap/__init__.py +49 -0
- mindspore/nn/wrap/cell_wrapper.py +968 -0
- mindspore/nn/wrap/grad_reducer.py +608 -0
- mindspore/nn/wrap/loss_scale.py +694 -0
- mindspore/numpy/__init__.py +121 -0
- mindspore/numpy/array_creations.py +2731 -0
- mindspore/numpy/array_ops.py +2629 -0
- mindspore/numpy/dtypes.py +185 -0
- mindspore/numpy/fft.py +966 -0
- mindspore/numpy/logic_ops.py +936 -0
- mindspore/numpy/math_ops.py +5911 -0
- mindspore/numpy/utils.py +214 -0
- mindspore/numpy/utils_const.py +565 -0
- mindspore/ops/__init__.py +56 -0
- mindspore/ops/_constants.py +30 -0
- mindspore/ops/_grad_experimental/__init__.py +31 -0
- mindspore/ops/_grad_experimental/grad_array_ops.py +830 -0
- mindspore/ops/_grad_experimental/grad_base.py +143 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +714 -0
- mindspore/ops/_grad_experimental/grad_debug_ops.py +31 -0
- mindspore/ops/_grad_experimental/grad_implementations.py +203 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +79 -0
- mindspore/ops/_grad_experimental/grad_math_ops.py +802 -0
- mindspore/ops/_grad_experimental/grad_nn_ops.py +231 -0
- mindspore/ops/_grad_experimental/grad_quant_ops.py +238 -0
- mindspore/ops/_grad_experimental/grad_sparse.py +342 -0
- mindspore/ops/_grad_experimental/grad_sparse_ops.py +399 -0
- mindspore/ops/_grad_experimental/taylor_rule.py +220 -0
- mindspore/ops/_op_impl/__init__.py +23 -0
- mindspore/ops/_op_impl/_custom_op/__init__.py +39 -0
- mindspore/ops/_op_impl/_custom_op/_basic.py +158 -0
- mindspore/ops/_op_impl/_custom_op/batch_matmul_impl.py +279 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold.py +156 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2.py +109 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad.py +125 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad_reduce.py +105 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold_grad.py +124 -0
- mindspore/ops/_op_impl/_custom_op/cholesky_trsm_impl.py +116 -0
- mindspore/ops/_op_impl/_custom_op/correction_mul.py +89 -0
- mindspore/ops/_op_impl/_custom_op/correction_mul_grad.py +196 -0
- mindspore/ops/_op_impl/_custom_op/dsd_back_impl.py +366 -0
- mindspore/ops/_op_impl/_custom_op/dsd_impl.py +162 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel.py +136 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad.py +206 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad_reduce.py +88 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer.py +128 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer_grad.py +199 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer_grad_reduce.py +88 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perchannel.py +156 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perchannel_grad.py +184 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perlayer.py +143 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perlayer_grad.py +169 -0
- mindspore/ops/_op_impl/_custom_op/fused_abs_max1_impl.py +548 -0
- mindspore/ops/_op_impl/_custom_op/img2col_impl.py +881 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_dense_left_impl.py +278 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_dense_right_impl.py +200 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_fracz_left_cast_impl.py +334 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_fracz_right_mul_impl.py +255 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_impl.py +222 -0
- mindspore/ops/_op_impl/_custom_op/matmul_dds_grad_impl.py +644 -0
- mindspore/ops/_op_impl/_custom_op/matmul_dds_impl.py +488 -0
- mindspore/ops/_op_impl/_custom_op/matrix_combine_impl.py +87 -0
- mindspore/ops/_op_impl/_custom_op/minmax_update_perchannel.py +129 -0
- mindspore/ops/_op_impl/_custom_op/minmax_update_perlayer.py +121 -0
- mindspore/ops/_op_impl/_custom_op/transpose02314_impl.py +352 -0
- mindspore/ops/_op_impl/aicpu/__init__.py +441 -0
- mindspore/ops/_op_impl/aicpu/abs.py +36 -0
- mindspore/ops/_op_impl/aicpu/acos.py +32 -0
- mindspore/ops/_op_impl/aicpu/acos_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/acosh.py +34 -0
- mindspore/ops/_op_impl/aicpu/acosh_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_2d.py +34 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_2d_grad.py +34 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_3d.py +39 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_3d_grad.py +39 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_2d.py +37 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_2d_grad.py +37 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_3d.py +42 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_3d_grad.py +152 -0
- mindspore/ops/_op_impl/aicpu/add.py +43 -0
- mindspore/ops/_op_impl/aicpu/add_n.py +41 -0
- mindspore/ops/_op_impl/aicpu/add_v2.py +40 -0
- mindspore/ops/_op_impl/aicpu/addcdiv.py +41 -0
- mindspore/ops/_op_impl/aicpu/addcmul.py +47 -0
- mindspore/ops/_op_impl/aicpu/adjust_contrastv2.py +32 -0
- mindspore/ops/_op_impl/aicpu/adjust_hue.py +31 -0
- mindspore/ops/_op_impl/aicpu/adjust_saturation.py +32 -0
- mindspore/ops/_op_impl/aicpu/affine_grid.py +33 -0
- mindspore/ops/_op_impl/aicpu/affine_grid_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/angle.py +31 -0
- mindspore/ops/_op_impl/aicpu/arg_max.py +75 -0
- mindspore/ops/_op_impl/aicpu/arg_min.py +75 -0
- mindspore/ops/_op_impl/aicpu/argmax_with_value.py +43 -0
- mindspore/ops/_op_impl/aicpu/argmin_with_value.py +43 -0
- mindspore/ops/_op_impl/aicpu/asin.py +32 -0
- mindspore/ops/_op_impl/aicpu/asin_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/asinh.py +34 -0
- mindspore/ops/_op_impl/aicpu/asinh_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/atanh.py +34 -0
- mindspore/ops/_op_impl/aicpu/avgpool_grad_v1.py +37 -0
- mindspore/ops/_op_impl/aicpu/avgpool_v1.py +36 -0
- mindspore/ops/_op_impl/aicpu/bartlett_window.py +36 -0
- mindspore/ops/_op_impl/aicpu/batch_matmul.py +43 -0
- mindspore/ops/_op_impl/aicpu/batch_norm_grad_grad.py +49 -0
- mindspore/ops/_op_impl/aicpu/bernoulli.py +48 -0
- mindspore/ops/_op_impl/aicpu/bessel_i0.py +31 -0
- mindspore/ops/_op_impl/aicpu/betainc.py +31 -0
- mindspore/ops/_op_impl/aicpu/bias_add.py +44 -0
- mindspore/ops/_op_impl/aicpu/bias_add_grad.py +42 -0
- mindspore/ops/_op_impl/aicpu/bincount.py +33 -0
- mindspore/ops/_op_impl/aicpu/blackman_window.py +36 -0
- mindspore/ops/_op_impl/aicpu/broadcast_to.py +58 -0
- mindspore/ops/_op_impl/aicpu/bucketize.py +34 -0
- mindspore/ops/_op_impl/aicpu/cache_swap_table.py +102 -0
- mindspore/ops/_op_impl/aicpu/cast.py +225 -0
- mindspore/ops/_op_impl/aicpu/cauchy.py +33 -0
- mindspore/ops/_op_impl/aicpu/channel_shuffle.py +40 -0
- mindspore/ops/_op_impl/aicpu/check_numerics.py +33 -0
- mindspore/ops/_op_impl/aicpu/cholesky.py +32 -0
- mindspore/ops/_op_impl/aicpu/cholesky_inverse.py +31 -0
- mindspore/ops/_op_impl/aicpu/cholesky_solve.py +33 -0
- mindspore/ops/_op_impl/aicpu/choleskygrad.py +32 -0
- mindspore/ops/_op_impl/aicpu/coalesce.py +37 -0
- mindspore/ops/_op_impl/aicpu/col2im.py +38 -0
- mindspore/ops/_op_impl/aicpu/combined_non_max_suppression.py +42 -0
- mindspore/ops/_op_impl/aicpu/compare_and_bitpack.py +37 -0
- mindspore/ops/_op_impl/aicpu/complex.py +32 -0
- mindspore/ops/_op_impl/aicpu/complex_abs.py +31 -0
- mindspore/ops/_op_impl/aicpu/compute_accidental_hits.py +44 -0
- mindspore/ops/_op_impl/aicpu/concat.py +57 -0
- mindspore/ops/_op_impl/aicpu/concat_offset.py +42 -0
- mindspore/ops/_op_impl/aicpu/concat_offset_v1.py +31 -0
- mindspore/ops/_op_impl/aicpu/conj.py +42 -0
- mindspore/ops/_op_impl/aicpu/conjugate_transpose.py +58 -0
- mindspore/ops/_op_impl/aicpu/cos.py +34 -0
- mindspore/ops/_op_impl/aicpu/cosh.py +34 -0
- mindspore/ops/_op_impl/aicpu/count_nonzero.py +43 -0
- mindspore/ops/_op_impl/aicpu/crop_and_resize.py +69 -0
- mindspore/ops/_op_impl/aicpu/crop_and_resize_grad_boxes.py +68 -0
- mindspore/ops/_op_impl/aicpu/crop_and_resize_grad_image.py +38 -0
- mindspore/ops/_op_impl/aicpu/cross.py +42 -0
- mindspore/ops/_op_impl/aicpu/csr_sparse_matrix_to_dense.py +48 -0
- mindspore/ops/_op_impl/aicpu/csr_sparse_matrix_to_sparse_tensor.py +51 -0
- mindspore/ops/_op_impl/aicpu/ctc_greedy_decoder.py +35 -0
- mindspore/ops/_op_impl/aicpu/ctc_loss_v2.py +43 -0
- mindspore/ops/_op_impl/aicpu/ctc_loss_v2_grad.py +45 -0
- mindspore/ops/_op_impl/aicpu/ctcloss.py +38 -0
- mindspore/ops/_op_impl/aicpu/cummax.py +41 -0
- mindspore/ops/_op_impl/aicpu/cumprod.py +58 -0
- mindspore/ops/_op_impl/aicpu/cumsum.py +58 -0
- mindspore/ops/_op_impl/aicpu/cumulative_logsumexp.py +36 -0
- mindspore/ops/_op_impl/aicpu/data_format_vec_permute.py +32 -0
- mindspore/ops/_op_impl/aicpu/deformable_offsets.py +38 -0
- mindspore/ops/_op_impl/aicpu/deformable_offsets_grad.py +43 -0
- mindspore/ops/_op_impl/aicpu/dense_to_csr_sparse_matrix.py +49 -0
- mindspore/ops/_op_impl/aicpu/dense_to_dense_set_operation.py +45 -0
- mindspore/ops/_op_impl/aicpu/dense_to_sparse_set_operation.py +48 -0
- mindspore/ops/_op_impl/aicpu/depth_to_space.py +44 -0
- mindspore/ops/_op_impl/aicpu/diag.py +36 -0
- mindspore/ops/_op_impl/aicpu/diag_part.py +36 -0
- mindspore/ops/_op_impl/aicpu/diagonal.py +35 -0
- mindspore/ops/_op_impl/aicpu/digamma.py +31 -0
- mindspore/ops/_op_impl/aicpu/div.py +41 -0
- mindspore/ops/_op_impl/aicpu/div_no_nan.py +35 -0
- mindspore/ops/_op_impl/aicpu/dropout2d.py +42 -0
- mindspore/ops/_op_impl/aicpu/dropout3d.py +42 -0
- mindspore/ops/_op_impl/aicpu/dropout_genmask.py +41 -0
- mindspore/ops/_op_impl/aicpu/dropout_genmask_v3.py +32 -0
- mindspore/ops/_op_impl/aicpu/dynamic_stitch.py +42 -0
- mindspore/ops/_op_impl/aicpu/edit_distance.py +56 -0
- mindspore/ops/_op_impl/aicpu/eig.py +35 -0
- mindspore/ops/_op_impl/aicpu/embedding_lookup.py +102 -0
- mindspore/ops/_op_impl/aicpu/end_of_sequence.py +30 -0
- mindspore/ops/_op_impl/aicpu/environ_create.py +28 -0
- mindspore/ops/_op_impl/aicpu/environ_destroy_all.py +28 -0
- mindspore/ops/_op_impl/aicpu/environ_get.py +41 -0
- mindspore/ops/_op_impl/aicpu/environ_set.py +40 -0
- mindspore/ops/_op_impl/aicpu/eps.py +32 -0
- mindspore/ops/_op_impl/aicpu/equal.py +41 -0
- mindspore/ops/_op_impl/aicpu/exp.py +37 -0
- mindspore/ops/_op_impl/aicpu/expand.py +45 -0
- mindspore/ops/_op_impl/aicpu/expand_dims.py +42 -0
- mindspore/ops/_op_impl/aicpu/expm1.py +34 -0
- mindspore/ops/_op_impl/aicpu/extract_glimpse.py +35 -0
- mindspore/ops/_op_impl/aicpu/eye.py +44 -0
- mindspore/ops/_op_impl/aicpu/fft_with_size.py +47 -0
- mindspore/ops/_op_impl/aicpu/fill_diagonal.py +39 -0
- mindspore/ops/_op_impl/aicpu/fill_v2.py +58 -0
- mindspore/ops/_op_impl/aicpu/flatten.py +43 -0
- mindspore/ops/_op_impl/aicpu/floor_div.py +38 -0
- mindspore/ops/_op_impl/aicpu/fmax.py +36 -0
- mindspore/ops/_op_impl/aicpu/fmin.py +37 -0
- mindspore/ops/_op_impl/aicpu/fractional_avg_pool.py +41 -0
- mindspore/ops/_op_impl/aicpu/fractional_avg_pool_grad.py +41 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool.py +41 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool3d_grad_with_fixed_ksize.py +43 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool3d_with_fixed_ksize.py +65 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool_grad.py +42 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool_grad_with_fixed_ksize.py +42 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool_with_fixed_ksize.py +49 -0
- mindspore/ops/_op_impl/aicpu/fse_decode.py +43 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_adam.py +46 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_ftrl.py +41 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_lazy_adam.py +46 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_proximal_adagrad.py +39 -0
- mindspore/ops/_op_impl/aicpu/gamma.py +38 -0
- mindspore/ops/_op_impl/aicpu/gather.py +46 -0
- mindspore/ops/_op_impl/aicpu/gather_d.py +79 -0
- mindspore/ops/_op_impl/aicpu/gather_d_grad_v2.py +79 -0
- mindspore/ops/_op_impl/aicpu/gather_grad.py +54 -0
- mindspore/ops/_op_impl/aicpu/gather_nd.py +56 -0
- mindspore/ops/_op_impl/aicpu/gcd.py +32 -0
- mindspore/ops/_op_impl/aicpu/generate_eod_mask.py +38 -0
- mindspore/ops/_op_impl/aicpu/geqrf.py +32 -0
- mindspore/ops/_op_impl/aicpu/get_next.py +39 -0
- mindspore/ops/_op_impl/aicpu/glu.py +33 -0
- mindspore/ops/_op_impl/aicpu/glu_grad.py +34 -0
- mindspore/ops/_op_impl/aicpu/greater.py +41 -0
- mindspore/ops/_op_impl/aicpu/greater_equal.py +41 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_2d.py +35 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_2d_grad.py +38 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_3d.py +34 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_3d_grad.py +38 -0
- mindspore/ops/_op_impl/aicpu/hamming_window.py +57 -0
- mindspore/ops/_op_impl/aicpu/hard_sigmoid.py +32 -0
- mindspore/ops/_op_impl/aicpu/hard_sigmoid_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/heaviside.py +40 -0
- mindspore/ops/_op_impl/aicpu/histogram.py +35 -0
- mindspore/ops/_op_impl/aicpu/hsv_to_rgb.py +32 -0
- mindspore/ops/_op_impl/aicpu/hypot.py +32 -0
- mindspore/ops/_op_impl/aicpu/identity.py +42 -0
- mindspore/ops/_op_impl/aicpu/identity_n.py +41 -0
- mindspore/ops/_op_impl/aicpu/igamma.py +30 -0
- mindspore/ops/_op_impl/aicpu/igammac.py +30 -0
- mindspore/ops/_op_impl/aicpu/igammagrada.py +30 -0
- mindspore/ops/_op_impl/aicpu/im2col.py +43 -0
- mindspore/ops/_op_impl/aicpu/imag.py +31 -0
- mindspore/ops/_op_impl/aicpu/index_fill.py +54 -0
- mindspore/ops/_op_impl/aicpu/index_put.py +50 -0
- mindspore/ops/_op_impl/aicpu/init_data_set_queue.py +27 -0
- mindspore/ops/_op_impl/aicpu/inplace_index_add.py +39 -0
- mindspore/ops/_op_impl/aicpu/instance_norm_v2.py +41 -0
- mindspore/ops/_op_impl/aicpu/instance_norm_v2_grad.py +44 -0
- mindspore/ops/_op_impl/aicpu/is_finite.py +40 -0
- mindspore/ops/_op_impl/aicpu/is_inf.py +31 -0
- mindspore/ops/_op_impl/aicpu/is_nan.py +31 -0
- mindspore/ops/_op_impl/aicpu/kldivloss.py +34 -0
- mindspore/ops/_op_impl/aicpu/kldivlossgrad.py +35 -0
- mindspore/ops/_op_impl/aicpu/layer_norm_grad_grad.py +47 -0
- mindspore/ops/_op_impl/aicpu/lcm.py +32 -0
- mindspore/ops/_op_impl/aicpu/left_shift.py +38 -0
- mindspore/ops/_op_impl/aicpu/less.py +41 -0
- mindspore/ops/_op_impl/aicpu/less_equal.py +41 -0
- mindspore/ops/_op_impl/aicpu/lgamma.py +33 -0
- mindspore/ops/_op_impl/aicpu/linear_sum_assignment.py +57 -0
- mindspore/ops/_op_impl/aicpu/linspace.py +33 -0
- mindspore/ops/_op_impl/aicpu/list_diff.py +50 -0
- mindspore/ops/_op_impl/aicpu/log.py +37 -0
- mindspore/ops/_op_impl/aicpu/log1p.py +34 -0
- mindspore/ops/_op_impl/aicpu/log_matrix_determinant.py +31 -0
- mindspore/ops/_op_impl/aicpu/log_normal_reverse.py +33 -0
- mindspore/ops/_op_impl/aicpu/log_uniform_candidate_sampler.py +37 -0
- mindspore/ops/_op_impl/aicpu/logical_xor.py +30 -0
- mindspore/ops/_op_impl/aicpu/logit.py +33 -0
- mindspore/ops/_op_impl/aicpu/logit_grad.py +34 -0
- mindspore/ops/_op_impl/aicpu/logspace.py +36 -0
- mindspore/ops/_op_impl/aicpu/lower_bound.py +47 -0
- mindspore/ops/_op_impl/aicpu/lstsq.py +34 -0
- mindspore/ops/_op_impl/aicpu/lu.py +39 -0
- mindspore/ops/_op_impl/aicpu/lu_solve.py +32 -0
- mindspore/ops/_op_impl/aicpu/lu_unpack.py +114 -0
- mindspore/ops/_op_impl/aicpu/lu_unpack_grad.py +49 -0
- mindspore/ops/_op_impl/aicpu/masked_fill.py +42 -0
- mindspore/ops/_op_impl/aicpu/masked_scatter.py +40 -0
- mindspore/ops/_op_impl/aicpu/masked_select.py +31 -0
- mindspore/ops/_op_impl/aicpu/masked_select_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/matmul.py +39 -0
- mindspore/ops/_op_impl/aicpu/matrix_band_part.py +59 -0
- mindspore/ops/_op_impl/aicpu/matrix_determinant.py +30 -0
- mindspore/ops/_op_impl/aicpu/matrix_diag_part_v3.py +54 -0
- mindspore/ops/_op_impl/aicpu/matrix_diag_v3.py +56 -0
- mindspore/ops/_op_impl/aicpu/matrix_exp.py +34 -0
- mindspore/ops/_op_impl/aicpu/matrix_inverse.py +31 -0
- mindspore/ops/_op_impl/aicpu/matrix_logarithm.py +31 -0
- mindspore/ops/_op_impl/aicpu/matrix_power.py +37 -0
- mindspore/ops/_op_impl/aicpu/matrix_set_diag_v3.py +54 -0
- mindspore/ops/_op_impl/aicpu/matrix_solve.py +35 -0
- mindspore/ops/_op_impl/aicpu/matrix_solve_ls.py +36 -0
- mindspore/ops/_op_impl/aicpu/matrix_triangular_solve.py +36 -0
- mindspore/ops/_op_impl/aicpu/max_pool3d_grad_with_argmax.py +60 -0
- mindspore/ops/_op_impl/aicpu/max_pool3d_with_argmax.py +59 -0
- mindspore/ops/_op_impl/aicpu/max_unpool2d.py +57 -0
- mindspore/ops/_op_impl/aicpu/max_unpool2d_grad.py +58 -0
- mindspore/ops/_op_impl/aicpu/max_unpool3d.py +57 -0
- mindspore/ops/_op_impl/aicpu/max_unpool3d_grad.py +58 -0
- mindspore/ops/_op_impl/aicpu/maximum_grad_grad.py +40 -0
- mindspore/ops/_op_impl/aicpu/maxpool_grad_v1.py +46 -0
- mindspore/ops/_op_impl/aicpu/maxpool_v1.py +42 -0
- mindspore/ops/_op_impl/aicpu/median.py +39 -0
- mindspore/ops/_op_impl/aicpu/median_grad.py +45 -0
- mindspore/ops/_op_impl/aicpu/meshgrid.py +41 -0
- mindspore/ops/_op_impl/aicpu/minimum_grad_grad.py +40 -0
- mindspore/ops/_op_impl/aicpu/mirror_pad.py +50 -0
- mindspore/ops/_op_impl/aicpu/mirror_pad_grad.py +48 -0
- mindspore/ops/_op_impl/aicpu/mul.py +43 -0
- mindspore/ops/_op_impl/aicpu/mul_no_nan.py +42 -0
- mindspore/ops/_op_impl/aicpu/multi_margin_loss.py +37 -0
- mindspore/ops/_op_impl/aicpu/multi_margin_loss_grad.py +41 -0
- mindspore/ops/_op_impl/aicpu/multilabel_margin_loss_grad.py +37 -0
- mindspore/ops/_op_impl/aicpu/multinomial.py +47 -0
- mindspore/ops/_op_impl/aicpu/multinomial_with_replacement.py +35 -0
- mindspore/ops/_op_impl/aicpu/mvlgamma.py +32 -0
- mindspore/ops/_op_impl/aicpu/mvlgamma_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/nan_to_num.py +34 -0
- mindspore/ops/_op_impl/aicpu/neg.py +36 -0
- mindspore/ops/_op_impl/aicpu/nextafter.py +32 -0
- mindspore/ops/_op_impl/aicpu/nllloss.py +38 -0
- mindspore/ops/_op_impl/aicpu/nllloss_grad.py +39 -0
- mindspore/ops/_op_impl/aicpu/no_repeat_ngram.py +34 -0
- mindspore/ops/_op_impl/aicpu/non_deterministic_ints.py +33 -0
- mindspore/ops/_op_impl/aicpu/non_max_suppression.py +36 -0
- mindspore/ops/_op_impl/aicpu/non_max_suppression_with_overlaps.py +35 -0
- mindspore/ops/_op_impl/aicpu/non_zero.py +43 -0
- mindspore/ops/_op_impl/aicpu/not_equal.py +39 -0
- mindspore/ops/_op_impl/aicpu/nth_element.py +39 -0
- mindspore/ops/_op_impl/aicpu/nuclear_norm.py +33 -0
- mindspore/ops/_op_impl/aicpu/one_hot.py +116 -0
- mindspore/ops/_op_impl/aicpu/ones_like.py +39 -0
- mindspore/ops/_op_impl/aicpu/orgqr.py +34 -0
- mindspore/ops/_op_impl/aicpu/pad_and_shift.py +33 -0
- mindspore/ops/_op_impl/aicpu/pad_v3.py +61 -0
- mindspore/ops/_op_impl/aicpu/pad_v3_grad.py +59 -0
- mindspore/ops/_op_impl/aicpu/padding.py +41 -0
- mindspore/ops/_op_impl/aicpu/parameterized_truncated_normal.py +54 -0
- mindspore/ops/_op_impl/aicpu/pdist_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/poisson.py +37 -0
- mindspore/ops/_op_impl/aicpu/polar.py +32 -0
- mindspore/ops/_op_impl/aicpu/polygamma.py +34 -0
- mindspore/ops/_op_impl/aicpu/pow.py +39 -0
- mindspore/ops/_op_impl/aicpu/print_tensor.py +39 -0
- mindspore/ops/_op_impl/aicpu/priority_replay_buffer.py +113 -0
- mindspore/ops/_op_impl/aicpu/qr.py +36 -0
- mindspore/ops/_op_impl/aicpu/quant_dtype_cast.py +40 -0
- mindspore/ops/_op_impl/aicpu/quantile.py +35 -0
- mindspore/ops/_op_impl/aicpu/ragged_range.py +49 -0
- mindspore/ops/_op_impl/aicpu/ragged_tensor_to_sparse.py +73 -0
- mindspore/ops/_op_impl/aicpu/ragged_tensor_to_tensor.py +74 -0
- mindspore/ops/_op_impl/aicpu/random_categorical.py +68 -0
- mindspore/ops/_op_impl/aicpu/random_choice_with_mask.py +36 -0
- mindspore/ops/_op_impl/aicpu/random_gamma.py +38 -0
- mindspore/ops/_op_impl/aicpu/random_poisson.py +134 -0
- mindspore/ops/_op_impl/aicpu/random_shuffle.py +47 -0
- mindspore/ops/_op_impl/aicpu/randperm.py +38 -0
- mindspore/ops/_op_impl/aicpu/randperm_v2.py +41 -0
- mindspore/ops/_op_impl/aicpu/range.py +36 -0
- mindspore/ops/_op_impl/aicpu/range_v2.py +35 -0
- mindspore/ops/_op_impl/aicpu/real.py +31 -0
- mindspore/ops/_op_impl/aicpu/real_div.py +40 -0
- mindspore/ops/_op_impl/aicpu/reciprocal.py +34 -0
- mindspore/ops/_op_impl/aicpu/reciprocal_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/reduce_mean.py +57 -0
- mindspore/ops/_op_impl/aicpu/reduce_prod.py +57 -0
- mindspore/ops/_op_impl/aicpu/reduce_sum.py +57 -0
- mindspore/ops/_op_impl/aicpu/relu_grad_v3.py +41 -0
- mindspore/ops/_op_impl/aicpu/relu_v3.py +38 -0
- mindspore/ops/_op_impl/aicpu/reservoir_replay_buffer.py +96 -0
- mindspore/ops/_op_impl/aicpu/reshape.py +42 -0
- mindspore/ops/_op_impl/aicpu/resize_area.py +40 -0
- mindspore/ops/_op_impl/aicpu/resize_bicubic.py +20 -0
- mindspore/ops/_op_impl/aicpu/resize_bicubic_grad.py +19 -0
- mindspore/ops/_op_impl/aicpu/resize_bilinear.py +32 -0
- mindspore/ops/_op_impl/aicpu/resize_bilinear_grad.py +32 -0
- mindspore/ops/_op_impl/aicpu/resize_nearest_neighbor_v2.py +36 -0
- mindspore/ops/_op_impl/aicpu/resize_nearest_neighbor_v2_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/resize_v2.py +68 -0
- mindspore/ops/_op_impl/aicpu/resize_v2_grad.py +68 -0
- mindspore/ops/_op_impl/aicpu/reverse_sequence.py +55 -0
- mindspore/ops/_op_impl/aicpu/reversev2.py +54 -0
- mindspore/ops/_op_impl/aicpu/rgb_to_hsv.py +32 -0
- mindspore/ops/_op_impl/aicpu/right_shift.py +38 -0
- mindspore/ops/_op_impl/aicpu/rnnt_loss.py +35 -0
- mindspore/ops/_op_impl/aicpu/round.py +34 -0
- mindspore/ops/_op_impl/aicpu/rsqrt.py +33 -0
- mindspore/ops/_op_impl/aicpu/rsqrt_grad.py +36 -0
- mindspore/ops/_op_impl/aicpu/sample_distorted_bounding_box_v2.py +49 -0
- mindspore/ops/_op_impl/aicpu/scale_and_translate.py +52 -0
- mindspore/ops/_op_impl/aicpu/scale_and_translate_grad.py +36 -0
- mindspore/ops/_op_impl/aicpu/scatter.py +79 -0
- mindspore/ops/_op_impl/aicpu/scatter_add_with_axis.py +53 -0
- mindspore/ops/_op_impl/aicpu/scatter_elements.py +39 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd.py +59 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd_max.py +54 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd_min.py +54 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd_update.py +59 -0
- mindspore/ops/_op_impl/aicpu/search_sorted.py +44 -0
- mindspore/ops/_op_impl/aicpu/segment_max.py +52 -0
- mindspore/ops/_op_impl/aicpu/segment_mean.py +56 -0
- mindspore/ops/_op_impl/aicpu/segment_min.py +52 -0
- mindspore/ops/_op_impl/aicpu/segment_prod.py +56 -0
- mindspore/ops/_op_impl/aicpu/segment_sum.py +56 -0
- mindspore/ops/_op_impl/aicpu/select.py +45 -0
- mindspore/ops/_op_impl/aicpu/self_adjoint_eig.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_add.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_add_offset.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_addn.py +38 -0
- mindspore/ops/_op_impl/aicpu/sequence_concat.py +40 -0
- mindspore/ops/_op_impl/aicpu/sequence_stack.py +40 -0
- mindspore/ops/_op_impl/aicpu/set_size.py +38 -0
- mindspore/ops/_op_impl/aicpu/sign.py +36 -0
- mindspore/ops/_op_impl/aicpu/sin.py +34 -0
- mindspore/ops/_op_impl/aicpu/sinc.py +43 -0
- mindspore/ops/_op_impl/aicpu/sinh.py +34 -0
- mindspore/ops/_op_impl/aicpu/slice.py +59 -0
- mindspore/ops/_op_impl/aicpu/slice_grad.py +76 -0
- mindspore/ops/_op_impl/aicpu/smooth_l1_loss.py +35 -0
- mindspore/ops/_op_impl/aicpu/smooth_l1_loss_grad.py +37 -0
- mindspore/ops/_op_impl/aicpu/sort.py +39 -0
- mindspore/ops/_op_impl/aicpu/space_to_depth.py +44 -0
- mindspore/ops/_op_impl/aicpu/sparse_addmm.py +87 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_adagrad_da.py +80 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_centered_rms_prop.py +105 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_momentum.py +80 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_proximal_gradient_descent.py +79 -0
- mindspore/ops/_op_impl/aicpu/sparse_concat.py +59 -0
- mindspore/ops/_op_impl/aicpu/sparse_cross.py +42 -0
- mindspore/ops/_op_impl/aicpu/sparse_dense_cwise_add.py +58 -0
- mindspore/ops/_op_impl/aicpu/sparse_dense_cwise_div.py +58 -0
- mindspore/ops/_op_impl/aicpu/sparse_dense_cwise_mul.py +58 -0
- mindspore/ops/_op_impl/aicpu/sparse_fill_empty_rows.py +63 -0
- mindspore/ops/_op_impl/aicpu/sparse_fill_empty_rows_grad.py +45 -0
- mindspore/ops/_op_impl/aicpu/sparse_matrix_mat_mul.py +56 -0
- mindspore/ops/_op_impl/aicpu/sparse_matrix_nnz.py +81 -0
- mindspore/ops/_op_impl/aicpu/sparse_matrix_transpose.py +116 -0
- mindspore/ops/_op_impl/aicpu/sparse_reorder.py +56 -0
- mindspore/ops/_op_impl/aicpu/sparse_reshape.py +34 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_mean_grad.py +36 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_mean_with_num_segments.py +44 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sqrt_n.py +43 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sqrt_n_grad.py +38 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sqrt_n_with_num_segments.py +44 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sum.py +49 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sum_with_num_segments.py +68 -0
- mindspore/ops/_op_impl/aicpu/sparse_slice.py +63 -0
- mindspore/ops/_op_impl/aicpu/sparse_slice_grad.py +61 -0
- mindspore/ops/_op_impl/aicpu/sparse_softmax.py +33 -0
- mindspore/ops/_op_impl/aicpu/sparse_softmax_cross_entropy_with_logits_v2.py +35 -0
- mindspore/ops/_op_impl/aicpu/sparse_sparse_maximum.py +53 -0
- mindspore/ops/_op_impl/aicpu/sparse_sparse_minimum.py +53 -0
- mindspore/ops/_op_impl/aicpu/sparse_tensor_dense_add.py +84 -0
- mindspore/ops/_op_impl/aicpu/sparse_tensor_dense_mat_mul.py +190 -0
- mindspore/ops/_op_impl/aicpu/sparse_tensor_to_csr_sparse_matrix.py +51 -0
- mindspore/ops/_op_impl/aicpu/sparse_to_dense_v2.py +73 -0
- mindspore/ops/_op_impl/aicpu/split.py +45 -0
- mindspore/ops/_op_impl/aicpu/sqrt.py +34 -0
- mindspore/ops/_op_impl/aicpu/sqrt_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/square.py +35 -0
- mindspore/ops/_op_impl/aicpu/squared_difference.py +37 -0
- mindspore/ops/_op_impl/aicpu/squeeze.py +42 -0
- mindspore/ops/_op_impl/aicpu/sspaddmm.py +97 -0
- mindspore/ops/_op_impl/aicpu/stack.py +45 -0
- mindspore/ops/_op_impl/aicpu/stack_push_pop.py +87 -0
- mindspore/ops/_op_impl/aicpu/standard_laplace.py +34 -0
- mindspore/ops/_op_impl/aicpu/standard_normal.py +34 -0
- mindspore/ops/_op_impl/aicpu/stateless_dropout_genmask.py +37 -0
- mindspore/ops/_op_impl/aicpu/stft.py +70 -0
- mindspore/ops/_op_impl/aicpu/strided_slice.py +43 -0
- mindspore/ops/_op_impl/aicpu/strided_slice_grad.py +50 -0
- mindspore/ops/_op_impl/aicpu/sub.py +41 -0
- mindspore/ops/_op_impl/aicpu/sub_and_filter.py +36 -0
- mindspore/ops/_op_impl/aicpu/tan.py +34 -0
- mindspore/ops/_op_impl/aicpu/tanh.py +34 -0
- mindspore/ops/_op_impl/aicpu/tanh_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/tensor_scatter_update.py +59 -0
- mindspore/ops/_op_impl/aicpu/tile.py +56 -0
- mindspore/ops/_op_impl/aicpu/topk.py +34 -0
- mindspore/ops/_op_impl/aicpu/trace.py +40 -0
- mindspore/ops/_op_impl/aicpu/tracegrad.py +41 -0
- mindspore/ops/_op_impl/aicpu/trans_data.py +35 -0
- mindspore/ops/_op_impl/aicpu/transpose.py +58 -0
- mindspore/ops/_op_impl/aicpu/tridiagonal_matmul.py +42 -0
- mindspore/ops/_op_impl/aicpu/tridiagonal_solve.py +35 -0
- mindspore/ops/_op_impl/aicpu/tril.py +42 -0
- mindspore/ops/_op_impl/aicpu/tril_indices.py +34 -0
- mindspore/ops/_op_impl/aicpu/triplet_margin_loss.py +62 -0
- mindspore/ops/_op_impl/aicpu/triu.py +43 -0
- mindspore/ops/_op_impl/aicpu/triu_indices.py +34 -0
- mindspore/ops/_op_impl/aicpu/truncated_normal.py +39 -0
- mindspore/ops/_op_impl/aicpu/uniform.py +36 -0
- mindspore/ops/_op_impl/aicpu/uniform_candidate_sampler.py +41 -0
- mindspore/ops/_op_impl/aicpu/uniform_int.py +36 -0
- mindspore/ops/_op_impl/aicpu/uniform_real.py +33 -0
- mindspore/ops/_op_impl/aicpu/unique.py +31 -0
- mindspore/ops/_op_impl/aicpu/unique_consecutive.py +47 -0
- mindspore/ops/_op_impl/aicpu/unique_with_pad.py +32 -0
- mindspore/ops/_op_impl/aicpu/unravel_index.py +32 -0
- mindspore/ops/_op_impl/aicpu/unsorted_segment_prod.py +53 -0
- mindspore/ops/_op_impl/aicpu/unsorted_segment_sum.py +57 -0
- mindspore/ops/_op_impl/aicpu/unstack.py +45 -0
- mindspore/ops/_op_impl/aicpu/update_cache.py +44 -0
- mindspore/ops/_op_impl/aicpu/upper_bound.py +47 -0
- mindspore/ops/_op_impl/aicpu/upsample_nearest_3d.py +42 -0
- mindspore/ops/_op_impl/aicpu/upsample_nearest_3d_grad.py +49 -0
- mindspore/ops/_op_impl/aicpu/upsample_trilinear_3d.py +40 -0
- mindspore/ops/_op_impl/aicpu/upsample_trilinear_3d_grad.py +50 -0
- mindspore/ops/_op_impl/aicpu/xdivy.py +35 -0
- mindspore/ops/_op_impl/aicpu/xlogy.py +33 -0
- mindspore/ops/_op_impl/aicpu/zeros_like.py +42 -0
- mindspore/ops/_op_impl/aicpu/zeta.py +31 -0
- mindspore/ops/_op_impl/akg/__init__.py +19 -0
- mindspore/ops/_op_impl/akg/ascend/__init__.py +48 -0
- mindspore/ops/_op_impl/akg/ascend/abs.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/add.py +42 -0
- mindspore/ops/_op_impl/akg/ascend/add_n.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/batchmatmul.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/cast.py +46 -0
- mindspore/ops/_op_impl/akg/ascend/equal.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/exp.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/expand_dims.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/greater.py +34 -0
- mindspore/ops/_op_impl/akg/ascend/greater_equal.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/less.py +31 -0
- mindspore/ops/_op_impl/akg/ascend/less_equal.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/load_im2col.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/log.py +34 -0
- mindspore/ops/_op_impl/akg/ascend/maximum.py +36 -0
- mindspore/ops/_op_impl/akg/ascend/minimum.py +39 -0
- mindspore/ops/_op_impl/akg/ascend/mul.py +41 -0
- mindspore/ops/_op_impl/akg/ascend/neg.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/pow.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/prod_force_se_a.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/real_div.py +36 -0
- mindspore/ops/_op_impl/akg/ascend/reciprocal.py +32 -0
- mindspore/ops/_op_impl/akg/ascend/reduce_max.py +32 -0
- mindspore/ops/_op_impl/akg/ascend/reduce_min.py +32 -0
- mindspore/ops/_op_impl/akg/ascend/reduce_sum.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/rsqrt.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/select.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/sqrt.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/square.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/sub.py +42 -0
- mindspore/ops/_op_impl/akg/cpu/__init__.py +23 -0
- mindspore/ops/_op_impl/akg/cpu/coo2csr.py +29 -0
- mindspore/ops/_op_impl/akg/cpu/csr2coo.py +29 -0
- mindspore/ops/_op_impl/akg/cpu/csr_gather.py +33 -0
- mindspore/ops/_op_impl/akg/cpu/csr_mm.py +34 -0
- mindspore/ops/_op_impl/akg/cpu/csr_mul.py +33 -0
- mindspore/ops/_op_impl/akg/cpu/csr_mv.py +33 -0
- mindspore/ops/_op_impl/akg/cpu/csr_reduce_sum.py +31 -0
- mindspore/ops/_op_impl/akg/gpu/__init__.py +24 -0
- mindspore/ops/_op_impl/akg/gpu/coo2csr.py +29 -0
- mindspore/ops/_op_impl/akg/gpu/csr2coo.py +29 -0
- mindspore/ops/_op_impl/akg/gpu/csr_div.py +36 -0
- mindspore/ops/_op_impl/akg/gpu/csr_gather.py +33 -0
- mindspore/ops/_op_impl/akg/gpu/csr_mm.py +37 -0
- mindspore/ops/_op_impl/akg/gpu/csr_mul.py +36 -0
- mindspore/ops/_op_impl/akg/gpu/csr_mv.py +36 -0
- mindspore/ops/_op_impl/akg/gpu/csr_reduce_sum.py +33 -0
- mindspore/ops/_op_impl/cpu/__init__.py +78 -0
- mindspore/ops/_op_impl/cpu/adam.py +49 -0
- mindspore/ops/_op_impl/cpu/adam_weight_decay.py +47 -0
- mindspore/ops/_op_impl/cpu/arg_max.py +30 -0
- mindspore/ops/_op_impl/cpu/arg_max_with_value.py +31 -0
- mindspore/ops/_op_impl/cpu/arg_min_with_value.py +31 -0
- mindspore/ops/_op_impl/cpu/buffer_append.py +28 -0
- mindspore/ops/_op_impl/cpu/buffer_get.py +28 -0
- mindspore/ops/_op_impl/cpu/buffer_sample.py +28 -0
- mindspore/ops/_op_impl/cpu/cast.py +171 -0
- mindspore/ops/_op_impl/cpu/concat_offset.py +38 -0
- mindspore/ops/_op_impl/cpu/conv2d.py +30 -0
- mindspore/ops/_op_impl/cpu/conv3d.py +30 -0
- mindspore/ops/_op_impl/cpu/div.py +32 -0
- mindspore/ops/_op_impl/cpu/dropout.py +31 -0
- mindspore/ops/_op_impl/cpu/dropout_grad.py +30 -0
- mindspore/ops/_op_impl/cpu/dynamic_shape.py +42 -0
- mindspore/ops/_op_impl/cpu/dynamic_stitch.py +41 -0
- mindspore/ops/_op_impl/cpu/equal_count.py +30 -0
- mindspore/ops/_op_impl/cpu/gather_d.py +49 -0
- mindspore/ops/_op_impl/cpu/gather_d_grad.py +38 -0
- mindspore/ops/_op_impl/cpu/gather_d_grad_v2.py +40 -0
- mindspore/ops/_op_impl/cpu/gather_v2.py +40 -0
- mindspore/ops/_op_impl/cpu/hsigmoid.py +33 -0
- mindspore/ops/_op_impl/cpu/hsigmoid_grad.py +34 -0
- mindspore/ops/_op_impl/cpu/hswish.py +32 -0
- mindspore/ops/_op_impl/cpu/hswish_grad.py +33 -0
- mindspore/ops/_op_impl/cpu/identity_n.py +40 -0
- mindspore/ops/_op_impl/cpu/is_finite.py +39 -0
- mindspore/ops/_op_impl/cpu/l2loss.py +30 -0
- mindspore/ops/_op_impl/cpu/layer_norm.py +36 -0
- mindspore/ops/_op_impl/cpu/layer_norm_grad.py +38 -0
- mindspore/ops/_op_impl/cpu/maximum.py +35 -0
- mindspore/ops/_op_impl/cpu/maximum_grad.py +47 -0
- mindspore/ops/_op_impl/cpu/minimum.py +40 -0
- mindspore/ops/_op_impl/cpu/minimum_grad.py +51 -0
- mindspore/ops/_op_impl/cpu/mirror_pad.py +36 -0
- mindspore/ops/_op_impl/cpu/mirror_pad_grad.py +36 -0
- mindspore/ops/_op_impl/cpu/mul.py +32 -0
- mindspore/ops/_op_impl/cpu/one_hot.py +31 -0
- mindspore/ops/_op_impl/cpu/pad.py +32 -0
- mindspore/ops/_op_impl/cpu/pow.py +32 -0
- mindspore/ops/_op_impl/cpu/priority_replay_buffer.py +42 -0
- mindspore/ops/_op_impl/cpu/pyexecute.py +29 -0
- mindspore/ops/_op_impl/cpu/pyfunc.py +29 -0
- mindspore/ops/_op_impl/cpu/range.py +34 -0
- mindspore/ops/_op_impl/cpu/real_div.py +33 -0
- mindspore/ops/_op_impl/cpu/reduce_all.py +29 -0
- mindspore/ops/_op_impl/cpu/reduce_any.py +29 -0
- mindspore/ops/_op_impl/cpu/reduce_max.py +32 -0
- mindspore/ops/_op_impl/cpu/reduce_mean.py +40 -0
- mindspore/ops/_op_impl/cpu/reduce_min.py +32 -0
- mindspore/ops/_op_impl/cpu/reduce_prod.py +40 -0
- mindspore/ops/_op_impl/cpu/reduce_std.py +31 -0
- mindspore/ops/_op_impl/cpu/reduce_sum.py +41 -0
- mindspore/ops/_op_impl/cpu/space_to_batch_nd.py +38 -0
- mindspore/ops/_op_impl/cpu/sparse_slice.py +62 -0
- mindspore/ops/_op_impl/cpu/sparse_slice_grad.py +60 -0
- mindspore/ops/_op_impl/cpu/split.py +34 -0
- mindspore/ops/_op_impl/cpu/sspaddmm.py +95 -0
- mindspore/ops/_op_impl/cpu/stack.py +38 -0
- mindspore/ops/_op_impl/cpu/sub.py +32 -0
- mindspore/ops/_op_impl/cpu/tensor_copy_slices.py +41 -0
- mindspore/ops/_op_impl/cpu/tile.py +37 -0
- mindspore/ops/_op_impl/cpu/top_k.py +31 -0
- mindspore/ops/_op_impl/cpu/transpose.py +39 -0
- mindspore/ops/_primitive_cache.py +90 -0
- mindspore/ops/_register_for_op.py +73 -0
- mindspore/ops/_utils/__init__.py +20 -0
- mindspore/ops/_utils/utils.py +147 -0
- mindspore/ops/_vmap/__init__.py +25 -0
- mindspore/ops/_vmap/vmap_array_ops.py +2149 -0
- mindspore/ops/_vmap/vmap_base.py +533 -0
- mindspore/ops/_vmap/vmap_convolution_ops.py +441 -0
- mindspore/ops/_vmap/vmap_debug_ops.py +50 -0
- mindspore/ops/_vmap/vmap_grad_math_ops.py +274 -0
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +806 -0
- mindspore/ops/_vmap/vmap_image_ops.py +194 -0
- mindspore/ops/_vmap/vmap_math_ops.py +993 -0
- mindspore/ops/_vmap/vmap_nn_ops.py +2250 -0
- mindspore/ops/_vmap/vmap_other_ops.py +105 -0
- mindspore/ops/_vmap/vmap_random_ops.py +122 -0
- mindspore/ops/_vmap/vmap_sparse_ops.py +89 -0
- mindspore/ops/auto_generate/__init__.py +31 -0
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +309 -0
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +252 -0
- mindspore/ops/auto_generate/gen_arg_handler.py +197 -0
- mindspore/ops/auto_generate/gen_extend_func.py +1701 -0
- mindspore/ops/auto_generate/gen_ops_def.py +8482 -0
- mindspore/ops/auto_generate/gen_ops_prim.py +16704 -0
- mindspore/ops/auto_generate/pyboost_inner_prim.py +549 -0
- mindspore/ops/composite/__init__.py +71 -0
- mindspore/ops/composite/base.py +1318 -0
- mindspore/ops/composite/env_ops.py +41 -0
- mindspore/ops/composite/math_ops.py +125 -0
- mindspore/ops/composite/multitype_ops/__init__.py +77 -0
- mindspore/ops/composite/multitype_ops/_compile_utils.py +1459 -0
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +897 -0
- mindspore/ops/composite/multitype_ops/add_impl.py +606 -0
- mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +56 -0
- mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +56 -0
- mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +56 -0
- mindspore/ops/composite/multitype_ops/div_impl.py +189 -0
- mindspore/ops/composite/multitype_ops/equal_impl.py +335 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +88 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +400 -0
- mindspore/ops/composite/multitype_ops/greater_equal_impl.py +109 -0
- mindspore/ops/composite/multitype_ops/greater_impl.py +110 -0
- mindspore/ops/composite/multitype_ops/in_impl.py +196 -0
- mindspore/ops/composite/multitype_ops/left_shift_impl.py +37 -0
- mindspore/ops/composite/multitype_ops/less_equal_impl.py +111 -0
- mindspore/ops/composite/multitype_ops/less_impl.py +112 -0
- mindspore/ops/composite/multitype_ops/logic_not_impl.py +113 -0
- mindspore/ops/composite/multitype_ops/logical_and_impl.py +60 -0
- mindspore/ops/composite/multitype_ops/logical_or_impl.py +61 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +86 -0
- mindspore/ops/composite/multitype_ops/mul_impl.py +294 -0
- mindspore/ops/composite/multitype_ops/negative_impl.py +79 -0
- mindspore/ops/composite/multitype_ops/not_equal_impl.py +290 -0
- mindspore/ops/composite/multitype_ops/not_in_impl.py +196 -0
- mindspore/ops/composite/multitype_ops/ones_like_impl.py +96 -0
- mindspore/ops/composite/multitype_ops/pow_impl.py +87 -0
- mindspore/ops/composite/multitype_ops/right_shift_impl.py +37 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +884 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +116 -0
- mindspore/ops/composite/multitype_ops/uadd_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +228 -0
- mindspore/ops/deprecated.py +315 -0
- mindspore/ops/function/__init__.py +782 -0
- mindspore/ops/function/array_func.py +7226 -0
- mindspore/ops/function/clip_func.py +384 -0
- mindspore/ops/function/debug_func.py +181 -0
- mindspore/ops/function/fft_func.py +44 -0
- mindspore/ops/function/grad/__init__.py +34 -0
- mindspore/ops/function/grad/grad_func.py +1425 -0
- mindspore/ops/function/image_func.py +292 -0
- mindspore/ops/function/linalg_func.py +416 -0
- mindspore/ops/function/math_func.py +12228 -0
- mindspore/ops/function/nn_func.py +8609 -0
- mindspore/ops/function/other_func.py +115 -0
- mindspore/ops/function/parameter_func.py +134 -0
- mindspore/ops/function/random_func.py +1715 -0
- mindspore/ops/function/reshard_func.py +104 -0
- mindspore/ops/function/sparse_func.py +884 -0
- mindspore/ops/function/sparse_unary_func.py +2422 -0
- mindspore/ops/function/spectral_func.py +150 -0
- mindspore/ops/function/vmap_func.py +117 -0
- mindspore/ops/functional.py +464 -0
- mindspore/ops/op_info_register.py +1572 -0
- mindspore/ops/operations/__init__.py +722 -0
- mindspore/ops/operations/_csr_ops.py +403 -0
- mindspore/ops/operations/_custom_grad.py +181 -0
- mindspore/ops/operations/_embedding_cache_ops.py +307 -0
- mindspore/ops/operations/_grad_ops.py +2978 -0
- mindspore/ops/operations/_infer_ops.py +19 -0
- mindspore/ops/operations/_inner_ops.py +2544 -0
- mindspore/ops/operations/_map_tensor_ops.py +112 -0
- mindspore/ops/operations/_ms_kernel.py +601 -0
- mindspore/ops/operations/_ocr_ops.py +379 -0
- mindspore/ops/operations/_opaque_predicate_registry.py +41 -0
- mindspore/ops/operations/_pyfunc_registry.py +58 -0
- mindspore/ops/operations/_quant_ops.py +1844 -0
- mindspore/ops/operations/_rl_inner_ops.py +1231 -0
- mindspore/ops/operations/_scalar_ops.py +106 -0
- mindspore/ops/operations/_sequence_ops.py +1155 -0
- mindspore/ops/operations/_sparse_grad_ops.py +56 -0
- mindspore/ops/operations/_tensor_array.py +359 -0
- mindspore/ops/operations/_thor_ops.py +807 -0
- mindspore/ops/operations/array_ops.py +6124 -0
- mindspore/ops/operations/comm_ops.py +1985 -0
- mindspore/ops/operations/control_ops.py +127 -0
- mindspore/ops/operations/custom_ops.py +1129 -0
- mindspore/ops/operations/debug_ops.py +678 -0
- mindspore/ops/operations/image_ops.py +1041 -0
- mindspore/ops/operations/inner_ops.py +697 -0
- mindspore/ops/operations/linalg_ops.py +95 -0
- mindspore/ops/operations/manually_defined/__init__.py +24 -0
- mindspore/ops/operations/manually_defined/_inner.py +73 -0
- mindspore/ops/operations/manually_defined/ops_def.py +2271 -0
- mindspore/ops/operations/math_ops.py +5095 -0
- mindspore/ops/operations/nn_ops.py +9575 -0
- mindspore/ops/operations/other_ops.py +874 -0
- mindspore/ops/operations/random_ops.py +1288 -0
- mindspore/ops/operations/reshard_ops.py +53 -0
- mindspore/ops/operations/rl_ops.py +288 -0
- mindspore/ops/operations/sparse_ops.py +2753 -0
- mindspore/ops/operations/spectral_ops.py +111 -0
- mindspore/ops/primitive.py +1046 -0
- mindspore/ops/signature.py +54 -0
- mindspore/ops/vm_impl_registry.py +91 -0
- mindspore/ops_generate/__init__.py +27 -0
- mindspore/ops_generate/arg_dtype_cast.py +252 -0
- mindspore/ops_generate/arg_handler.py +197 -0
- mindspore/ops_generate/gen_aclnn_implement.py +263 -0
- mindspore/ops_generate/gen_constants.py +36 -0
- mindspore/ops_generate/gen_ops.py +1099 -0
- mindspore/ops_generate/gen_ops_inner_prim.py +131 -0
- mindspore/ops_generate/gen_pyboost_func.py +1052 -0
- mindspore/ops_generate/gen_utils.py +209 -0
- mindspore/ops_generate/op_proto.py +145 -0
- mindspore/ops_generate/pyboost_utils.py +367 -0
- mindspore/ops_generate/template.py +261 -0
- mindspore/parallel/__init__.py +30 -0
- mindspore/parallel/_auto_parallel_context.py +1486 -0
- mindspore/parallel/_cell_wrapper.py +174 -0
- mindspore/parallel/_cost_model_context.py +700 -0
- mindspore/parallel/_dp_allreduce_fusion.py +159 -0
- mindspore/parallel/_offload_context.py +275 -0
- mindspore/parallel/_parallel_serialization.py +561 -0
- mindspore/parallel/_ps_context.py +242 -0
- mindspore/parallel/_recovery_context.py +110 -0
- mindspore/parallel/_tensor.py +730 -0
- mindspore/parallel/_transformer/__init__.py +35 -0
- mindspore/parallel/_transformer/layers.py +765 -0
- mindspore/parallel/_transformer/loss.py +251 -0
- mindspore/parallel/_transformer/moe.py +693 -0
- mindspore/parallel/_transformer/op_parallel_config.py +222 -0
- mindspore/parallel/_transformer/transformer.py +3119 -0
- mindspore/parallel/_utils.py +612 -0
- mindspore/parallel/algo_parameter_config.py +400 -0
- mindspore/parallel/checkpoint_transform.py +650 -0
- mindspore/parallel/cluster/__init__.py +15 -0
- mindspore/parallel/cluster/process_entity/__init__.py +18 -0
- mindspore/parallel/cluster/process_entity/_api.py +352 -0
- mindspore/parallel/cluster/process_entity/_utils.py +101 -0
- mindspore/parallel/cluster/run.py +136 -0
- mindspore/parallel/mpi/__init__.py +14 -0
- mindspore/parallel/mpi/_mpi_config.py +116 -0
- mindspore/parallel/parameter_broadcast.py +151 -0
- mindspore/parallel/shard.py +481 -0
- mindspore/parallel/transform_safetensors.py +993 -0
- mindspore/profiler/__init__.py +28 -0
- mindspore/profiler/common/__init__.py +14 -0
- mindspore/profiler/common/constant.py +29 -0
- mindspore/profiler/common/exceptions/__init__.py +14 -0
- mindspore/profiler/common/exceptions/error_code.py +83 -0
- mindspore/profiler/common/exceptions/exceptions.py +286 -0
- mindspore/profiler/common/process_pool.py +41 -0
- mindspore/profiler/common/registry.py +47 -0
- mindspore/profiler/common/singleton.py +28 -0
- mindspore/profiler/common/struct_type.py +118 -0
- mindspore/profiler/common/util.py +472 -0
- mindspore/profiler/common/validator/__init__.py +14 -0
- mindspore/profiler/common/validator/validate_path.py +84 -0
- mindspore/profiler/dynamic_profiler.py +694 -0
- mindspore/profiler/envprofiling.py +254 -0
- mindspore/profiler/parser/__init__.py +14 -0
- mindspore/profiler/parser/aicpu_data_parser.py +272 -0
- mindspore/profiler/parser/ascend_analysis/__init__.py +14 -0
- mindspore/profiler/parser/ascend_analysis/constant.py +71 -0
- mindspore/profiler/parser/ascend_analysis/file_manager.py +180 -0
- mindspore/profiler/parser/ascend_analysis/function_event.py +185 -0
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +136 -0
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +131 -0
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +104 -0
- mindspore/profiler/parser/ascend_analysis/path_manager.py +313 -0
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +123 -0
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +86 -0
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +75 -0
- mindspore/profiler/parser/ascend_cluster_generator.py +116 -0
- mindspore/profiler/parser/ascend_communicate_generator.py +314 -0
- mindspore/profiler/parser/ascend_flops_generator.py +116 -0
- mindspore/profiler/parser/ascend_fpbp_generator.py +82 -0
- mindspore/profiler/parser/ascend_hccl_generator.py +271 -0
- mindspore/profiler/parser/ascend_integrate_generator.py +42 -0
- mindspore/profiler/parser/ascend_memory_generator.py +185 -0
- mindspore/profiler/parser/ascend_msprof_exporter.py +282 -0
- mindspore/profiler/parser/ascend_msprof_generator.py +187 -0
- mindspore/profiler/parser/ascend_op_generator.py +334 -0
- mindspore/profiler/parser/ascend_steptrace_generator.py +94 -0
- mindspore/profiler/parser/ascend_timeline_generator.py +545 -0
- mindspore/profiler/parser/base_timeline_generator.py +483 -0
- mindspore/profiler/parser/container.py +229 -0
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +697 -0
- mindspore/profiler/parser/flops_parser.py +531 -0
- mindspore/profiler/parser/framework_enum.py +111 -0
- mindspore/profiler/parser/framework_parser.py +464 -0
- mindspore/profiler/parser/framework_struct.py +61 -0
- mindspore/profiler/parser/gpu_analysis/__init__.py +14 -0
- mindspore/profiler/parser/gpu_analysis/function_event.py +44 -0
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +89 -0
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +72 -0
- mindspore/profiler/parser/hccl_parser.py +573 -0
- mindspore/profiler/parser/hwts_log_parser.py +122 -0
- mindspore/profiler/parser/integrator.py +526 -0
- mindspore/profiler/parser/memory_usage_parser.py +277 -0
- mindspore/profiler/parser/minddata_analyzer.py +800 -0
- mindspore/profiler/parser/minddata_parser.py +186 -0
- mindspore/profiler/parser/minddata_pipeline_parser.py +299 -0
- mindspore/profiler/parser/op_intermediate_parser.py +149 -0
- mindspore/profiler/parser/optime_parser.py +250 -0
- mindspore/profiler/parser/profiler_info.py +213 -0
- mindspore/profiler/parser/step_trace_parser.py +666 -0
- mindspore/profiler/profiler.py +153 -0
- mindspore/profiler/profiling.py +1922 -0
- mindspore/rewrite/__init__.py +28 -0
- mindspore/rewrite/api/__init__.py +17 -0
- mindspore/rewrite/api/node.py +519 -0
- mindspore/rewrite/api/node_type.py +53 -0
- mindspore/rewrite/api/pattern_engine.py +490 -0
- mindspore/rewrite/api/scoped_value.py +181 -0
- mindspore/rewrite/api/symbol_tree.py +497 -0
- mindspore/rewrite/ast_helpers/__init__.py +25 -0
- mindspore/rewrite/ast_helpers/ast_converter.py +143 -0
- mindspore/rewrite/ast_helpers/ast_finder.py +404 -0
- mindspore/rewrite/ast_helpers/ast_flattener.py +268 -0
- mindspore/rewrite/ast_helpers/ast_modifier.py +605 -0
- mindspore/rewrite/ast_helpers/ast_replacer.py +79 -0
- mindspore/rewrite/common/__init__.py +19 -0
- mindspore/rewrite/common/config.py +24 -0
- mindspore/rewrite/common/error_log.py +39 -0
- mindspore/rewrite/common/event.py +28 -0
- mindspore/rewrite/common/namer.py +271 -0
- mindspore/rewrite/common/namespace.py +118 -0
- mindspore/rewrite/common/observable.py +44 -0
- mindspore/rewrite/common/observer.py +54 -0
- mindspore/rewrite/node/__init__.py +22 -0
- mindspore/rewrite/node/call_function.py +95 -0
- mindspore/rewrite/node/cell_container.py +139 -0
- mindspore/rewrite/node/control_flow.py +113 -0
- mindspore/rewrite/node/node.py +1428 -0
- mindspore/rewrite/node/node_manager.py +283 -0
- mindspore/rewrite/node/node_topological_manager.py +223 -0
- mindspore/rewrite/parsers/__init__.py +29 -0
- mindspore/rewrite/parsers/arguments_parser.py +63 -0
- mindspore/rewrite/parsers/assign_parser.py +852 -0
- mindspore/rewrite/parsers/attribute_parser.py +57 -0
- mindspore/rewrite/parsers/class_def_parser.py +289 -0
- mindspore/rewrite/parsers/constant_parser.py +104 -0
- mindspore/rewrite/parsers/container_parser.py +88 -0
- mindspore/rewrite/parsers/expr_parser.py +55 -0
- mindspore/rewrite/parsers/for_parser.py +61 -0
- mindspore/rewrite/parsers/function_def_parser.py +84 -0
- mindspore/rewrite/parsers/if_parser.py +85 -0
- mindspore/rewrite/parsers/module_parser.py +117 -0
- mindspore/rewrite/parsers/parser.py +43 -0
- mindspore/rewrite/parsers/parser_register.py +86 -0
- mindspore/rewrite/parsers/return_parser.py +37 -0
- mindspore/rewrite/parsers/while_parser.py +59 -0
- mindspore/rewrite/sparsify/__init__.py +0 -0
- mindspore/rewrite/sparsify/sparse_transformer.py +457 -0
- mindspore/rewrite/sparsify/sparsify.py +112 -0
- mindspore/rewrite/sparsify/utils.py +179 -0
- mindspore/rewrite/symbol_tree/__init__.py +20 -0
- mindspore/rewrite/symbol_tree/symbol_tree.py +1819 -0
- mindspore/rewrite/symbol_tree/symbol_tree_builder.py +76 -0
- mindspore/rewrite/symbol_tree/symbol_tree_dumper.py +142 -0
- mindspore/run_check/__init__.py +20 -0
- mindspore/run_check/_check_version.py +507 -0
- mindspore/run_check/run_check.py +66 -0
- mindspore/safeguard/__init__.py +18 -0
- mindspore/safeguard/rewrite_obfuscation.py +875 -0
- mindspore/scipy/__init__.py +18 -0
- mindspore/scipy/fft.py +264 -0
- mindspore/scipy/linalg.py +919 -0
- mindspore/scipy/ops.py +165 -0
- mindspore/scipy/ops_grad.py +115 -0
- mindspore/scipy/ops_wrapper.py +74 -0
- mindspore/scipy/optimize/__init__.py +20 -0
- mindspore/scipy/optimize/_bfgs.py +230 -0
- mindspore/scipy/optimize/_lagrange.py +201 -0
- mindspore/scipy/optimize/_lbfgs.py +146 -0
- mindspore/scipy/optimize/gradient_optimization_algorithm.py +168 -0
- mindspore/scipy/optimize/line_search.py +370 -0
- mindspore/scipy/optimize/linear_sum_assignment.py +78 -0
- mindspore/scipy/optimize/minimize.py +200 -0
- mindspore/scipy/utils.py +156 -0
- mindspore/scipy/utils_const.py +246 -0
- mindspore/train/__init__.py +48 -0
- mindspore/train/_utils.py +465 -0
- mindspore/train/amp.py +935 -0
- mindspore/train/anf_ir_pb2.py +1517 -0
- mindspore/train/callback/__init__.py +44 -0
- mindspore/train/callback/_backup_and_restore.py +117 -0
- mindspore/train/callback/_callback.py +613 -0
- mindspore/train/callback/_checkpoint.py +814 -0
- mindspore/train/callback/_cluster_monitor.py +201 -0
- mindspore/train/callback/_dataset_graph.py +150 -0
- mindspore/train/callback/_early_stop.py +239 -0
- mindspore/train/callback/_flops_collector.py +239 -0
- mindspore/train/callback/_history.py +92 -0
- mindspore/train/callback/_lambda_callback.py +80 -0
- mindspore/train/callback/_landscape.py +1049 -0
- mindspore/train/callback/_loss_monitor.py +107 -0
- mindspore/train/callback/_lr_scheduler_callback.py +76 -0
- mindspore/train/callback/_on_request_exit.py +298 -0
- mindspore/train/callback/_reduce_lr_on_plateau.py +226 -0
- mindspore/train/callback/_summary_collector.py +1184 -0
- mindspore/train/callback/_tft_register.py +352 -0
- mindspore/train/callback/_time_monitor.py +141 -0
- mindspore/train/checkpoint_pb2.py +233 -0
- mindspore/train/data_sink.py +219 -0
- mindspore/train/dataset_helper.py +692 -0
- mindspore/train/lineage_pb2.py +1260 -0
- mindspore/train/loss_scale_manager.py +213 -0
- mindspore/train/memory_profiling_pb2.py +298 -0
- mindspore/train/metrics/__init__.py +175 -0
- mindspore/train/metrics/accuracy.py +133 -0
- mindspore/train/metrics/auc.py +129 -0
- mindspore/train/metrics/bleu_score.py +170 -0
- mindspore/train/metrics/confusion_matrix.py +700 -0
- mindspore/train/metrics/cosine_similarity.py +109 -0
- mindspore/train/metrics/dice.py +116 -0
- mindspore/train/metrics/error.py +175 -0
- mindspore/train/metrics/fbeta.py +167 -0
- mindspore/train/metrics/hausdorff_distance.py +333 -0
- mindspore/train/metrics/loss.py +97 -0
- mindspore/train/metrics/mean_surface_distance.py +189 -0
- mindspore/train/metrics/metric.py +373 -0
- mindspore/train/metrics/occlusion_sensitivity.py +225 -0
- mindspore/train/metrics/perplexity.py +133 -0
- mindspore/train/metrics/precision.py +160 -0
- mindspore/train/metrics/recall.py +159 -0
- mindspore/train/metrics/roc.py +223 -0
- mindspore/train/metrics/root_mean_square_surface_distance.py +191 -0
- mindspore/train/metrics/topk.py +167 -0
- mindspore/train/mind_ir_pb2.py +1908 -0
- mindspore/train/model.py +2252 -0
- mindspore/train/node_strategy_pb2.py +653 -0
- mindspore/train/print_pb2.py +184 -0
- mindspore/train/profiling_parallel_pb2.py +151 -0
- mindspore/train/serialization.py +3325 -0
- mindspore/train/summary/__init__.py +23 -0
- mindspore/train/summary/_lineage_adapter.py +41 -0
- mindspore/train/summary/_summary_adapter.py +496 -0
- mindspore/train/summary/_writer_pool.py +207 -0
- mindspore/train/summary/enums.py +56 -0
- mindspore/train/summary/summary_record.py +581 -0
- mindspore/train/summary/writer.py +167 -0
- mindspore/train/summary_pb2.py +1165 -0
- mindspore/train/train_thor/__init__.py +20 -0
- mindspore/train/train_thor/convert_utils.py +268 -0
- mindspore/train/train_thor/dataset_helper.py +192 -0
- mindspore/train/train_thor/model_thor.py +257 -0
- mindspore/utils/__init__.py +21 -0
- mindspore/utils/utils.py +60 -0
- mindspore/version.py +1 -0
- mindspore-2.4.0.dist-info/METADATA +352 -0
- mindspore-2.4.0.dist-info/RECORD +1387 -0
- mindspore-2.4.0.dist-info/WHEEL +5 -0
- mindspore-2.4.0.dist-info/entry_points.txt +3 -0
- mindspore-2.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2422 @@
|
|
|
1
|
+
# Copyright 2022 Huawei Technologies Co., Ltd
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ============================================================================
|
|
15
|
+
|
|
16
|
+
"""sparse unary function api"""
|
|
17
|
+
|
|
18
|
+
from mindspore.common import CSRTensor, COOTensor
|
|
19
|
+
from mindspore.ops.composite.multitype_ops._constexpr_utils import raise_type_error
|
|
20
|
+
from mindspore.ops.function import math_func, nn_func
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def csr_cos(x: CSRTensor) -> CSRTensor:
|
|
24
|
+
r"""
|
|
25
|
+
Computes cosine of input element-wise.
|
|
26
|
+
|
|
27
|
+
.. math::
|
|
28
|
+
out_i = \cos(x_i)
|
|
29
|
+
|
|
30
|
+
.. warning::
|
|
31
|
+
Currently support data types float16 and float32. If use float64, there may be a problem of missing precision.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
x (CSRTensor): Input CSRTensor.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
CSRTensor, has the same shape and dtype as `x`.
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
TypeError: If `x` is not a CSRTensor.
|
|
41
|
+
TypeError: If dtype of `x` is not float16, float32 or float64, complex64,
|
|
42
|
+
complex128.
|
|
43
|
+
|
|
44
|
+
Supported Platforms:
|
|
45
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
46
|
+
|
|
47
|
+
Examples:
|
|
48
|
+
>>> from mindspore import dtype as mstype
|
|
49
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
50
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
51
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
52
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
53
|
+
>>> shape = (3, 4)
|
|
54
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
55
|
+
>>> output = ops.csr_cos(x)
|
|
56
|
+
>>> print(output.values)
|
|
57
|
+
[ 0.5403023 -0.41614684]
|
|
58
|
+
"""
|
|
59
|
+
if not isinstance(x, CSRTensor):
|
|
60
|
+
raise_type_error('Expects CSRTensor for csr_cos')
|
|
61
|
+
return CSRTensor(x.indptr, x.indices, math_func.cos(x.values), x.shape)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def coo_cos(x: COOTensor) -> COOTensor:
|
|
65
|
+
r"""
|
|
66
|
+
Computes cosine of input element-wise.
|
|
67
|
+
|
|
68
|
+
.. math::
|
|
69
|
+
out_i = \cos(x_i)
|
|
70
|
+
|
|
71
|
+
.. warning::
|
|
72
|
+
If use float64, there may be a problem of missing precision.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
x (COOTensor): Input COOTensor.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
COOTensor, has the same shape and dtype as `x`.
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
TypeError: If `x` is not a COOTensor.
|
|
82
|
+
TypeError: If dtype of `x` is not float16, float32 or float64, complex64,
|
|
83
|
+
complex128.
|
|
84
|
+
|
|
85
|
+
Supported Platforms:
|
|
86
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
87
|
+
|
|
88
|
+
Examples:
|
|
89
|
+
>>> from mindspore import dtype as mstype
|
|
90
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
91
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
92
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
93
|
+
>>> shape = (3, 4)
|
|
94
|
+
>>> x = COOTensor(indices, values, shape)
|
|
95
|
+
>>> output = ops.coo_cos(x)
|
|
96
|
+
>>> print(output.values)
|
|
97
|
+
[ 0.5403023 -0.41614684]
|
|
98
|
+
"""
|
|
99
|
+
if not isinstance(x, COOTensor):
|
|
100
|
+
raise_type_error('Expects COOTensor for coo_cos')
|
|
101
|
+
return COOTensor(x.indices, math_func.cos(x.values), x.shape)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def csr_tan(x: CSRTensor) -> CSRTensor:
|
|
105
|
+
r"""
|
|
106
|
+
Computes tangent of `x` element-wise.
|
|
107
|
+
|
|
108
|
+
.. math::
|
|
109
|
+
|
|
110
|
+
out_i = \tan(x_i)
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
x (CSRTensor): The input CSRTensor.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
CSRTensor, has the same shape as `x`.
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
TypeError: If `x` is not a CSRTensor.
|
|
120
|
+
|
|
121
|
+
Supported Platforms:
|
|
122
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
123
|
+
|
|
124
|
+
Examples:
|
|
125
|
+
>>> from mindspore import dtype as mstype
|
|
126
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
127
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
128
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
129
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
130
|
+
>>> shape = (3, 4)
|
|
131
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
132
|
+
>>> output = ops.csr_tan(x)
|
|
133
|
+
>>> print(output.values)
|
|
134
|
+
[-1.5574077 -2.1850398]
|
|
135
|
+
"""
|
|
136
|
+
if not isinstance(x, CSRTensor):
|
|
137
|
+
raise_type_error('Expects CSRTensor for csr_tan')
|
|
138
|
+
return CSRTensor(x.indptr, x.indices, math_func.tan(x.values), x.shape)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def coo_tan(x: COOTensor) -> COOTensor:
|
|
142
|
+
r"""
|
|
143
|
+
Computes tangent of `x` element-wise.
|
|
144
|
+
|
|
145
|
+
.. math::
|
|
146
|
+
|
|
147
|
+
out_i = \tan(x_i)
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
x (COOTensor): The input COOTensor.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
COOTensor, has the same shape as `x`.
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
TypeError: If `x` is not a COOTensor.
|
|
157
|
+
|
|
158
|
+
Supported Platforms:
|
|
159
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
160
|
+
|
|
161
|
+
Examples:
|
|
162
|
+
>>> from mindspore import dtype as mstype
|
|
163
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
164
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
165
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
166
|
+
>>> shape = (3, 4)
|
|
167
|
+
>>> x = COOTensor(indices, values, shape)
|
|
168
|
+
>>> output = ops.coo_tan(x)
|
|
169
|
+
>>> print(output.values)
|
|
170
|
+
[-1.5574077 -2.1850398]
|
|
171
|
+
"""
|
|
172
|
+
if not isinstance(x, COOTensor):
|
|
173
|
+
raise_type_error('Expects COOTensor for coo_tan')
|
|
174
|
+
return COOTensor(x.indices, math_func.tan(x.values), x.shape)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def csr_exp(x: CSRTensor) -> CSRTensor:
|
|
178
|
+
"""
|
|
179
|
+
Returns csr_exponential of a CSRTensor element-wise.
|
|
180
|
+
|
|
181
|
+
.. math::
|
|
182
|
+
|
|
183
|
+
out_i = e^{x_i}
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
x (CSRTensor): The input CSRTensor.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
CSRTensor, has the same shape and dtype as the `x`.
|
|
190
|
+
|
|
191
|
+
Raises:
|
|
192
|
+
TypeError: If `x` is not a CSRTensor.
|
|
193
|
+
|
|
194
|
+
Supported Platforms:
|
|
195
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
196
|
+
|
|
197
|
+
Examples:
|
|
198
|
+
>>> from mindspore import dtype as mstype
|
|
199
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
200
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
201
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
202
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
203
|
+
>>> shape = (3, 4)
|
|
204
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
205
|
+
>>> output = ops.csr_exp(x)
|
|
206
|
+
>>> print(output.values)
|
|
207
|
+
[0.36787948 7.3890557 ]
|
|
208
|
+
"""
|
|
209
|
+
if not isinstance(x, CSRTensor):
|
|
210
|
+
raise_type_error('Expects CSRTensor for csr_exp')
|
|
211
|
+
return CSRTensor(x.indptr, x.indices, math_func.exp(x.values), x.shape)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def coo_exp(x: COOTensor) -> COOTensor:
|
|
215
|
+
"""
|
|
216
|
+
Returns the element-wise exponential of a COOTensor.
|
|
217
|
+
|
|
218
|
+
.. math::
|
|
219
|
+
|
|
220
|
+
out_i = e^{x_i}
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
x (COOTensor): The input COOTensor.
|
|
224
|
+
|
|
225
|
+
Returns:
|
|
226
|
+
COOTensor, has the same shape and dtype as the `x`.
|
|
227
|
+
|
|
228
|
+
Raises:
|
|
229
|
+
TypeError: If `x` is not a COOTensor.
|
|
230
|
+
|
|
231
|
+
Supported Platforms:
|
|
232
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
233
|
+
|
|
234
|
+
Examples:
|
|
235
|
+
>>> from mindspore import dtype as mstype
|
|
236
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
237
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
238
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
239
|
+
>>> shape = (3, 4)
|
|
240
|
+
>>> x = COOTensor(indices, values, shape)
|
|
241
|
+
>>> output = ops.coo_exp(x)
|
|
242
|
+
>>> print(output.values)
|
|
243
|
+
[0.36787948 7.3890557 ]
|
|
244
|
+
"""
|
|
245
|
+
if not isinstance(x, COOTensor):
|
|
246
|
+
raise_type_error('Expects COOTensor for coo_exp')
|
|
247
|
+
return COOTensor(x.indices, math_func.exp(x.values), x.shape)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def csr_inv(x: CSRTensor) -> CSRTensor:
|
|
251
|
+
r"""
|
|
252
|
+
Computes Reciprocal of input CSRTensor element-wise.
|
|
253
|
+
|
|
254
|
+
.. math::
|
|
255
|
+
out_i = \frac{1}{x_{i} }
|
|
256
|
+
|
|
257
|
+
Args:
|
|
258
|
+
x (CSRTensor): Input CSRTensor. Must be one of the following types: float16, float32 or int32.
|
|
259
|
+
|
|
260
|
+
Returns:
|
|
261
|
+
CSRTensor, has the same type and shape as input shape value.
|
|
262
|
+
|
|
263
|
+
Raises:
|
|
264
|
+
TypeError: If `x` is not a CSRTensor.
|
|
265
|
+
TypeError: If dtype of `x` is not one of float16, float32, int32.
|
|
266
|
+
|
|
267
|
+
Supported Platforms:
|
|
268
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
269
|
+
|
|
270
|
+
Examples:
|
|
271
|
+
>>> from mindspore import dtype as mstype
|
|
272
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
273
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
274
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
275
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
276
|
+
>>> shape = (3, 4)
|
|
277
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
278
|
+
>>> output = ops.csr_inv(x)
|
|
279
|
+
>>> print(output.values)
|
|
280
|
+
[-1. 0.5]
|
|
281
|
+
"""
|
|
282
|
+
if not isinstance(x, CSRTensor):
|
|
283
|
+
raise_type_error('Expects CSRTensor for csr_inv')
|
|
284
|
+
return CSRTensor(x.indptr, x.indices, math_func.inv(x.values), x.shape)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def coo_inv(x: COOTensor) -> COOTensor:
|
|
288
|
+
r"""
|
|
289
|
+
Computes Reciprocal of input COOTensor element-wise.
|
|
290
|
+
|
|
291
|
+
.. math::
|
|
292
|
+
out_i = \frac{1}{x_{i} }
|
|
293
|
+
|
|
294
|
+
Args:
|
|
295
|
+
x (COOTensor): Input COOTensor. Must be one of the following types: float16, float32 or int32.
|
|
296
|
+
|
|
297
|
+
Returns:
|
|
298
|
+
COOTensor, has the same type and shape as input shape value.
|
|
299
|
+
|
|
300
|
+
Raises:
|
|
301
|
+
TypeError: If `x` is not a COOTensor.
|
|
302
|
+
TypeError: If dtype of `x` is not one of float16, float32, int32.
|
|
303
|
+
|
|
304
|
+
Supported Platforms:
|
|
305
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
306
|
+
|
|
307
|
+
Examples:
|
|
308
|
+
>>> from mindspore import dtype as mstype
|
|
309
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
310
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
311
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
312
|
+
>>> shape = (3, 4)
|
|
313
|
+
>>> x = COOTensor(indices, values, shape)
|
|
314
|
+
>>> output = ops.coo_inv(x)
|
|
315
|
+
>>> print(output.values)
|
|
316
|
+
[-1. 0.5]
|
|
317
|
+
"""
|
|
318
|
+
if not isinstance(x, COOTensor):
|
|
319
|
+
raise_type_error('Expects COOTensor for coo_inv')
|
|
320
|
+
return COOTensor(x.indices, math_func.inv(x.values), x.shape)
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def csr_relu(x: CSRTensor) -> CSRTensor:
|
|
324
|
+
r"""
|
|
325
|
+
Computes ReLU (Rectified Linear Unit activation function) of input csr_tensors element-wise.
|
|
326
|
+
|
|
327
|
+
It returns max(x, 0) element-wise. Specially, the neurons with the negative output
|
|
328
|
+
will be suppressed and the active neurons will stay the same.
|
|
329
|
+
|
|
330
|
+
.. math::
|
|
331
|
+
|
|
332
|
+
ReLU(x) = (x)^+ = \max(0, x)
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
x (CSRTensor): Input CSRTensor.
|
|
336
|
+
|
|
337
|
+
Returns:
|
|
338
|
+
CSRTensor, with the same dtype and shape as the `x`.
|
|
339
|
+
|
|
340
|
+
Raises:
|
|
341
|
+
TypeError: If dtype of `x` is not a number.
|
|
342
|
+
TypeError: If `x` is not a CSRTensor.
|
|
343
|
+
|
|
344
|
+
Supported Platforms:
|
|
345
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
346
|
+
|
|
347
|
+
Examples:
|
|
348
|
+
>>> from mindspore import dtype as mstype
|
|
349
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
350
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
351
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
352
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
353
|
+
>>> shape = (3, 4)
|
|
354
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
355
|
+
>>> output = ops.csr_relu(x)
|
|
356
|
+
>>> print(output.values)
|
|
357
|
+
[0. 2.]
|
|
358
|
+
"""
|
|
359
|
+
if not isinstance(x, CSRTensor):
|
|
360
|
+
raise_type_error('Expects CSRTensor for csr_relu')
|
|
361
|
+
return CSRTensor(x.indptr, x.indices, nn_func.relu(x.values), x.shape)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def coo_relu(x: COOTensor) -> COOTensor:
|
|
365
|
+
r"""
|
|
366
|
+
Computes ReLU (Rectified Linear Unit activation function) of input coo_tensors element-wise.
|
|
367
|
+
|
|
368
|
+
It returns :math:`\max(x,\ 0)` element-wise. Specially, the neurons with the negative output
|
|
369
|
+
will be suppressed and the active neurons will stay the same.
|
|
370
|
+
|
|
371
|
+
.. math::
|
|
372
|
+
|
|
373
|
+
ReLU(x) = (x)^+ = \max(0, x)
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
x (COOTensor): Input COOTensor with shape :math:`(N, *)`, where :math:`*`
|
|
377
|
+
means any number of additional dimensions. Its dtype is
|
|
378
|
+
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
379
|
+
|
|
380
|
+
Returns:
|
|
381
|
+
COOTensor, has the same shape and dtype as the `x`.
|
|
382
|
+
|
|
383
|
+
Raises:
|
|
384
|
+
TypeError: If dtype of `x` is not a number.
|
|
385
|
+
TypeError: If `x` is not a COOTensor.
|
|
386
|
+
|
|
387
|
+
Supported Platforms:
|
|
388
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
389
|
+
|
|
390
|
+
Examples:
|
|
391
|
+
>>> from mindspore import dtype as mstype
|
|
392
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
393
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
394
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
395
|
+
>>> shape = (3, 4)
|
|
396
|
+
>>> x = COOTensor(indices, values, shape)
|
|
397
|
+
>>> output = ops.coo_relu(x)
|
|
398
|
+
>>> print(output.values)
|
|
399
|
+
[0. 2.]
|
|
400
|
+
"""
|
|
401
|
+
if not isinstance(x, COOTensor):
|
|
402
|
+
raise_type_error('Expects COOTensor for coo_relu')
|
|
403
|
+
return COOTensor(x.indices, nn_func.relu(x.values), x.shape)
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def csr_expm1(x: CSRTensor) -> CSRTensor:
|
|
407
|
+
"""
|
|
408
|
+
Returns exponential then minus 1 of a CSRTensor element-wise.
|
|
409
|
+
|
|
410
|
+
.. math::
|
|
411
|
+
|
|
412
|
+
out_i = e^{x_i} - 1
|
|
413
|
+
|
|
414
|
+
Args:
|
|
415
|
+
x (CSRTensor): The input CSRTensor with a dtype of float16 or float32.
|
|
416
|
+
|
|
417
|
+
Returns:
|
|
418
|
+
CSRTensor, has the same shape as the `x`.
|
|
419
|
+
|
|
420
|
+
Raises:
|
|
421
|
+
TypeError: If `x` is not a CSRTensor.
|
|
422
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
423
|
+
|
|
424
|
+
Supported Platforms:
|
|
425
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
426
|
+
|
|
427
|
+
Examples:
|
|
428
|
+
>>> from mindspore import dtype as mstype
|
|
429
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
430
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
431
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
432
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
433
|
+
>>> shape = (3, 4)
|
|
434
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
435
|
+
>>> output = ops.csr_expm1(x)
|
|
436
|
+
>>> print(output.values)
|
|
437
|
+
[-0.63212055 6.389056 ]
|
|
438
|
+
"""
|
|
439
|
+
if not isinstance(x, CSRTensor):
|
|
440
|
+
raise_type_error('Expects CSRTensor for csr_expm1')
|
|
441
|
+
return CSRTensor(x.indptr, x.indices, math_func.expm1(x.values), x.shape)
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def coo_expm1(x: COOTensor) -> COOTensor:
|
|
445
|
+
"""
|
|
446
|
+
Returns exponential then minus 1 of a COOTensor element-wise.
|
|
447
|
+
|
|
448
|
+
.. math::
|
|
449
|
+
|
|
450
|
+
out_i = e^{x_i} - 1
|
|
451
|
+
|
|
452
|
+
Args:
|
|
453
|
+
x (COOTensor): The input COOTensor with a dtype of float16 or float32.
|
|
454
|
+
|
|
455
|
+
Returns:
|
|
456
|
+
COOTensor, has the same shape as the `x`.
|
|
457
|
+
|
|
458
|
+
Raises:
|
|
459
|
+
TypeError: If `x` is not a COOTensor.
|
|
460
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
461
|
+
|
|
462
|
+
Supported Platforms:
|
|
463
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
464
|
+
|
|
465
|
+
Examples:
|
|
466
|
+
>>> from mindspore import dtype as mstype
|
|
467
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
468
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
469
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
470
|
+
>>> shape = (3, 4)
|
|
471
|
+
>>> x = COOTensor(indices, values, shape)
|
|
472
|
+
>>> output = ops.coo_expm1(x)
|
|
473
|
+
>>> print(output.values)
|
|
474
|
+
[-0.63212055 6.389056 ]
|
|
475
|
+
"""
|
|
476
|
+
if not isinstance(x, COOTensor):
|
|
477
|
+
raise_type_error('Expects COOTensor for coo_expm1')
|
|
478
|
+
return COOTensor(x.indices, math_func.expm1(x.values), x.shape)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
def csr_isfinite(x: CSRTensor) -> CSRTensor:
|
|
482
|
+
r"""
|
|
483
|
+
Determines which elements are finite for each position.
|
|
484
|
+
|
|
485
|
+
.. math::
|
|
486
|
+
|
|
487
|
+
out_i = \begin{cases}
|
|
488
|
+
& \text{ if } x_{i} = \text{Finite},\ \ True \\
|
|
489
|
+
& \text{ if } x_{i} \ne \text{Finite},\ \ False
|
|
490
|
+
\end{cases}
|
|
491
|
+
|
|
492
|
+
Args:
|
|
493
|
+
x (CSRTensor): The input CSRTensor.
|
|
494
|
+
|
|
495
|
+
Returns:
|
|
496
|
+
CSRTensor, has the same shape of input, and the dtype is bool.
|
|
497
|
+
|
|
498
|
+
Raises:
|
|
499
|
+
TypeError: If `x` is not a CSRTensor.
|
|
500
|
+
|
|
501
|
+
Supported Platforms:
|
|
502
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
503
|
+
|
|
504
|
+
Examples:
|
|
505
|
+
>>> from mindspore import dtype as mstype
|
|
506
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
507
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
508
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
509
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
510
|
+
>>> shape = (3, 4)
|
|
511
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
512
|
+
>>> output = ops.csr_isfinite(x)
|
|
513
|
+
>>> print(output.values)
|
|
514
|
+
[ True True]
|
|
515
|
+
"""
|
|
516
|
+
if not isinstance(x, CSRTensor):
|
|
517
|
+
raise_type_error('Expects CSRTensor for csr_isfinite')
|
|
518
|
+
return CSRTensor(x.indptr, x.indices, math_func.isfinite(x.values), x.shape)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
def coo_isfinite(x: COOTensor) -> COOTensor:
|
|
522
|
+
r"""
|
|
523
|
+
Determines which elements are finite for each position.
|
|
524
|
+
|
|
525
|
+
.. math::
|
|
526
|
+
|
|
527
|
+
out_i = \begin{cases}
|
|
528
|
+
& \text{ if } x_{i} = \text{Finite},\ \ True\ \\
|
|
529
|
+
& \text{ if } x_{i} \ne \text{Finite},\ \ False
|
|
530
|
+
\end{cases}
|
|
531
|
+
|
|
532
|
+
Args:
|
|
533
|
+
x (COOTensor): The input COOTensor.
|
|
534
|
+
|
|
535
|
+
Returns:
|
|
536
|
+
COOTensor, has the same shape of input, and the dtype is bool.
|
|
537
|
+
|
|
538
|
+
Raises:
|
|
539
|
+
TypeError: If `x` is not a COOTensor.
|
|
540
|
+
|
|
541
|
+
Supported Platforms:
|
|
542
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
543
|
+
|
|
544
|
+
Examples:
|
|
545
|
+
>>> from mindspore import dtype as mstype
|
|
546
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
547
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
548
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
549
|
+
>>> shape = (3, 4)
|
|
550
|
+
>>> x = COOTensor(indices, values, shape)
|
|
551
|
+
>>> output = ops.coo_isfinite(x)
|
|
552
|
+
>>> print(output.values)
|
|
553
|
+
[ True True]
|
|
554
|
+
"""
|
|
555
|
+
if not isinstance(x, COOTensor):
|
|
556
|
+
raise_type_error('Expects COOTensor for coo_isfinite')
|
|
557
|
+
return COOTensor(x.indices, math_func.isfinite(x.values), x.shape)
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def csr_asin(x: CSRTensor) -> CSRTensor:
|
|
561
|
+
r"""
|
|
562
|
+
Computes arcsine of input csr_tensors element-wise.
|
|
563
|
+
|
|
564
|
+
.. math::
|
|
565
|
+
|
|
566
|
+
out_i = \sin^{-1}(x_i)
|
|
567
|
+
|
|
568
|
+
Args:
|
|
569
|
+
x (CSRTensor): Input CSRTensor. The data types should be one of the following types:
|
|
570
|
+
float16, float32, float64.
|
|
571
|
+
|
|
572
|
+
Returns:
|
|
573
|
+
CSRTensor, has the same shape and dtype as `x`.
|
|
574
|
+
|
|
575
|
+
Raises:
|
|
576
|
+
TypeError: If `x` is not a CSRTensor.
|
|
577
|
+
TypeError: If dtype of `x` is not float16, float32, float64.
|
|
578
|
+
|
|
579
|
+
Supported Platforms:
|
|
580
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
581
|
+
|
|
582
|
+
Examples:
|
|
583
|
+
>>> from mindspore import dtype as mstype
|
|
584
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
585
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
586
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
587
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
588
|
+
>>> shape = (3, 4)
|
|
589
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
590
|
+
>>> output = ops.csr_asin(x)
|
|
591
|
+
>>> print(output.values)
|
|
592
|
+
[-1.5707964 nan]
|
|
593
|
+
"""
|
|
594
|
+
if not isinstance(x, CSRTensor):
|
|
595
|
+
raise_type_error('Expects CSRTensor for csr_asin')
|
|
596
|
+
return CSRTensor(x.indptr, x.indices, math_func.asin(x.values), x.shape)
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
def coo_asin(x: COOTensor) -> COOTensor:
|
|
600
|
+
r"""
|
|
601
|
+
Computes arcsine of input coo_tensors element-wise.
|
|
602
|
+
|
|
603
|
+
.. math::
|
|
604
|
+
|
|
605
|
+
out_i = \sin^{-1}(x_i)
|
|
606
|
+
|
|
607
|
+
Args:
|
|
608
|
+
x (COOTensor): Input COOTensor. The shape of COOTensor is :math:`(N,*)` ,
|
|
609
|
+
where :math:`*` means any number of additional dimensions.
|
|
610
|
+
The data type should be one of the following types: float16, float32, float64, complex64, complex128.
|
|
611
|
+
|
|
612
|
+
Returns:
|
|
613
|
+
COOTensor, has the same shape and dtype as `x`.
|
|
614
|
+
|
|
615
|
+
Raises:
|
|
616
|
+
TypeError: If `x` is not a COOTensor.
|
|
617
|
+
TypeError: If dtype of `x` is not float16, float32, float64, complex64, complex128.
|
|
618
|
+
|
|
619
|
+
Supported Platforms:
|
|
620
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
621
|
+
|
|
622
|
+
Examples:
|
|
623
|
+
>>> from mindspore import dtype as mstype
|
|
624
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
625
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
626
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
627
|
+
>>> shape = (3, 4)
|
|
628
|
+
>>> x = COOTensor(indices, values, shape)
|
|
629
|
+
>>> output = ops.coo_asin(x)
|
|
630
|
+
>>> print(output.values)
|
|
631
|
+
[-1.5707964 nan]
|
|
632
|
+
"""
|
|
633
|
+
if not isinstance(x, COOTensor):
|
|
634
|
+
raise_type_error('Expects COOTensor for coo_asin')
|
|
635
|
+
return COOTensor(x.indices, math_func.asin(x.values), x.shape)
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
def csr_sqrt(x: CSRTensor) -> CSRTensor:
|
|
639
|
+
r"""
|
|
640
|
+
Returns sqrt of a CSRTensor element-wise.
|
|
641
|
+
|
|
642
|
+
.. math::
|
|
643
|
+
|
|
644
|
+
out_{i} = \sqrt{x_{i}}
|
|
645
|
+
|
|
646
|
+
Args:
|
|
647
|
+
x (CSRTensor): The input CSRTensor with a dtype of Number.
|
|
648
|
+
|
|
649
|
+
Returns:
|
|
650
|
+
CSRTensor, has the same shape and dtype as the `x`.
|
|
651
|
+
|
|
652
|
+
Raises:
|
|
653
|
+
TypeError: If `x` is not a CSRTensor.
|
|
654
|
+
|
|
655
|
+
Supported Platforms:
|
|
656
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
657
|
+
|
|
658
|
+
Examples:
|
|
659
|
+
>>> from mindspore import dtype as mstype
|
|
660
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
661
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
662
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
663
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
664
|
+
>>> shape = (3, 4)
|
|
665
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
666
|
+
>>> output = ops.csr_sqrt(x)
|
|
667
|
+
>>> print(output.values)
|
|
668
|
+
[ nan 1.4142135]
|
|
669
|
+
"""
|
|
670
|
+
if not isinstance(x, CSRTensor):
|
|
671
|
+
raise_type_error('Expects CSRTensor for csr_sqrt')
|
|
672
|
+
return CSRTensor(x.indptr, x.indices, math_func.sqrt(x.values), x.shape)
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
def coo_sqrt(x: COOTensor) -> COOTensor:
|
|
676
|
+
r"""
|
|
677
|
+
Returns sqrt of a COOTensor element-wise.
|
|
678
|
+
|
|
679
|
+
.. math::
|
|
680
|
+
|
|
681
|
+
out_{i} = \sqrt{x_{i}}
|
|
682
|
+
|
|
683
|
+
Args:
|
|
684
|
+
x (COOTensor): The input COOTensor with a dtype of Number.
|
|
685
|
+
|
|
686
|
+
Returns:
|
|
687
|
+
COOTensor, has the same shape and dtype as the `x`.
|
|
688
|
+
|
|
689
|
+
Raises:
|
|
690
|
+
TypeError: If `x` is not a COOTensor.
|
|
691
|
+
|
|
692
|
+
Supported Platforms:
|
|
693
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
694
|
+
|
|
695
|
+
Examples:
|
|
696
|
+
>>> from mindspore import dtype as mstype
|
|
697
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
698
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
699
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
700
|
+
>>> shape = (3, 4)
|
|
701
|
+
>>> x = COOTensor(indices, values, shape)
|
|
702
|
+
>>> output = ops.coo_sqrt(x)
|
|
703
|
+
>>> print(output.values)
|
|
704
|
+
[ nan 1.4142135]
|
|
705
|
+
"""
|
|
706
|
+
if not isinstance(x, COOTensor):
|
|
707
|
+
raise_type_error('Expects COOTensor for coo_sqrt')
|
|
708
|
+
return COOTensor(x.indices, math_func.sqrt(x.values), x.shape)
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
def csr_log(x: CSRTensor) -> CSRTensor:
|
|
712
|
+
r"""
|
|
713
|
+
Returns the natural logarithm of a CSRTensor element-wise.
|
|
714
|
+
|
|
715
|
+
.. math::
|
|
716
|
+
y_i = \log_e(x_i)
|
|
717
|
+
|
|
718
|
+
.. warning::
|
|
719
|
+
If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may
|
|
720
|
+
be affacted.
|
|
721
|
+
|
|
722
|
+
Args:
|
|
723
|
+
x (CSRTensor): The value must be greater than 0.
|
|
724
|
+
|
|
725
|
+
Returns:
|
|
726
|
+
CSRTensor, has the same shape and dtype as the `x`.
|
|
727
|
+
|
|
728
|
+
Raises:
|
|
729
|
+
TypeError: If `x` is not a CSRTensor.
|
|
730
|
+
TypeError: If dtype of `x` is not float16, float32 or float64 on GPU and CPU.
|
|
731
|
+
TypeError: If dtype of `x` is not float16 or float32 on Ascend.
|
|
732
|
+
|
|
733
|
+
Supported Platforms:
|
|
734
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
735
|
+
|
|
736
|
+
Examples:
|
|
737
|
+
>>> from mindspore import dtype as mstype
|
|
738
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
739
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
740
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
741
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
742
|
+
>>> shape = (3, 4)
|
|
743
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
744
|
+
>>> output = ops.csr_log(x)
|
|
745
|
+
>>> print(output.values)
|
|
746
|
+
[ nan 0.69314575]
|
|
747
|
+
"""
|
|
748
|
+
if not isinstance(x, CSRTensor):
|
|
749
|
+
raise_type_error('Expects CSRTensor for csr_log')
|
|
750
|
+
return CSRTensor(x.indptr, x.indices, math_func.log(x.values), x.shape)
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
def coo_log(x: COOTensor) -> COOTensor:
|
|
754
|
+
r"""
|
|
755
|
+
Returns the natural logarithm of a COOTensor element-wise.
|
|
756
|
+
|
|
757
|
+
.. math::
|
|
758
|
+
y_i = \log_e(x_i)
|
|
759
|
+
|
|
760
|
+
.. warning::
|
|
761
|
+
If the input value of operator Log is within the range (0, 0.01] or [0.95, 1.05], the output accuracy may
|
|
762
|
+
be affacted.
|
|
763
|
+
|
|
764
|
+
Args:
|
|
765
|
+
x (COOTensor): The value must be greater than 0.
|
|
766
|
+
|
|
767
|
+
Returns:
|
|
768
|
+
COOTensor, has the same shape and dtype as the `x`.
|
|
769
|
+
|
|
770
|
+
Raises:
|
|
771
|
+
TypeError: If `x` is not a COOTensor.
|
|
772
|
+
TypeError: If dtype of `x` is not float16, float32 or float64 on GPU and CPU.
|
|
773
|
+
TypeError: If dtype of `x` is not float16 or float32 on Ascend.
|
|
774
|
+
|
|
775
|
+
Supported Platforms:
|
|
776
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
777
|
+
|
|
778
|
+
Examples:
|
|
779
|
+
>>> from mindspore import dtype as mstype
|
|
780
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
781
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
782
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
783
|
+
>>> shape = (3, 4)
|
|
784
|
+
>>> x = COOTensor(indices, values, shape)
|
|
785
|
+
>>> output = ops.coo_log(x)
|
|
786
|
+
>>> print(output.values)
|
|
787
|
+
[ nan 0.69314575]
|
|
788
|
+
"""
|
|
789
|
+
if not isinstance(x, COOTensor):
|
|
790
|
+
raise_type_error('Expects COOTensor for coo_log')
|
|
791
|
+
return COOTensor(x.indices, math_func.log(x.values), x.shape)
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
def csr_isnan(x: CSRTensor) -> CSRTensor:
|
|
795
|
+
r"""
|
|
796
|
+
Determines which elements are NaN for each position.
|
|
797
|
+
|
|
798
|
+
.. math::
|
|
799
|
+
|
|
800
|
+
out_i = \begin{cases}
|
|
801
|
+
& \ True,\ \text{ if } x_{i} = \text{Nan} \\
|
|
802
|
+
& \ False,\ \text{ if } x_{i} \ne \text{Nan}
|
|
803
|
+
\end{cases}
|
|
804
|
+
|
|
805
|
+
where :math:`Nan` means not a number.
|
|
806
|
+
|
|
807
|
+
Args:
|
|
808
|
+
x (CSRTensor): The input CSRTensor.
|
|
809
|
+
|
|
810
|
+
Returns:
|
|
811
|
+
CSRTensor, has the same shape of input, and the dtype is bool.
|
|
812
|
+
|
|
813
|
+
Raises:
|
|
814
|
+
TypeError: If `x` is not a CSRTensor.
|
|
815
|
+
|
|
816
|
+
Supported Platforms:
|
|
817
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
818
|
+
|
|
819
|
+
Examples:
|
|
820
|
+
>>> from mindspore import dtype as mstype
|
|
821
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
822
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
823
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
824
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
825
|
+
>>> shape = (3, 4)
|
|
826
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
827
|
+
>>> output = ops.csr_isnan(x)
|
|
828
|
+
>>> print(output.values)
|
|
829
|
+
[False False]
|
|
830
|
+
"""
|
|
831
|
+
if not isinstance(x, CSRTensor):
|
|
832
|
+
raise_type_error('Expects CSRTensor for csr_isnan')
|
|
833
|
+
return CSRTensor(x.indptr, x.indices, math_func.isnan(x.values), x.shape)
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
def coo_isnan(x: COOTensor) -> COOTensor:
|
|
837
|
+
r"""
|
|
838
|
+
Determines which elements are NaN for each position.
|
|
839
|
+
|
|
840
|
+
.. math::
|
|
841
|
+
|
|
842
|
+
out_i = \begin{cases}
|
|
843
|
+
& \ True,\ \text{ if } x_{i} = \text{Nan} \\
|
|
844
|
+
& \ False,\ \text{ if } x_{i} \ne \text{Nan}
|
|
845
|
+
\end{cases}
|
|
846
|
+
|
|
847
|
+
where :math:`Nan` means not a number.
|
|
848
|
+
|
|
849
|
+
Args:
|
|
850
|
+
x (COOTensor): The input COOTensor.
|
|
851
|
+
|
|
852
|
+
Returns:
|
|
853
|
+
COOTensor, has the same shape of input, and the dtype is bool.
|
|
854
|
+
|
|
855
|
+
Raises:
|
|
856
|
+
TypeError: If `x` is not a COOTensor.
|
|
857
|
+
|
|
858
|
+
Supported Platforms:
|
|
859
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
860
|
+
|
|
861
|
+
Examples:
|
|
862
|
+
>>> from mindspore import dtype as mstype
|
|
863
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
864
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
865
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
866
|
+
>>> shape = (3, 4)
|
|
867
|
+
>>> x = COOTensor(indices, values, shape)
|
|
868
|
+
>>> output = ops.coo_isnan(x)
|
|
869
|
+
>>> print(output.values)
|
|
870
|
+
[False False]
|
|
871
|
+
"""
|
|
872
|
+
if not isinstance(x, COOTensor):
|
|
873
|
+
raise_type_error('Expects COOTensor for coo_isnan')
|
|
874
|
+
return COOTensor(x.indices, math_func.isnan(x.values), x.shape)
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
def csr_acos(x: CSRTensor) -> CSRTensor:
|
|
878
|
+
r"""
|
|
879
|
+
Computes arccosine of input csr_tensors element-wise.
|
|
880
|
+
|
|
881
|
+
.. math::
|
|
882
|
+
|
|
883
|
+
out_i = \cos^{-1}(x_i)
|
|
884
|
+
|
|
885
|
+
Args:
|
|
886
|
+
x (CSRTensor): Input CSRTensor.
|
|
887
|
+
|
|
888
|
+
Returns:
|
|
889
|
+
CSRTensor, has the same shape and dtype as `x`.
|
|
890
|
+
|
|
891
|
+
Raises:
|
|
892
|
+
TypeError: If `x` is not a CSRTensor.
|
|
893
|
+
TypeError: If dtype of `x` is not float16, float32 or float64, complex64,
|
|
894
|
+
complex128.
|
|
895
|
+
|
|
896
|
+
Supported Platforms:
|
|
897
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
898
|
+
|
|
899
|
+
Examples:
|
|
900
|
+
>>> from mindspore import dtype as mstype
|
|
901
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
902
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
903
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
904
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
905
|
+
>>> shape = (3, 4)
|
|
906
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
907
|
+
>>> output = ops.csr_acos(x)
|
|
908
|
+
>>> print(output.values)
|
|
909
|
+
[3.1415927 nan]
|
|
910
|
+
"""
|
|
911
|
+
if not isinstance(x, CSRTensor):
|
|
912
|
+
raise_type_error('Expects CSRTensor for csr_acos')
|
|
913
|
+
return CSRTensor(x.indptr, x.indices, math_func.acos(x.values), x.shape)
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
def coo_acos(x: COOTensor) -> COOTensor:
|
|
917
|
+
r"""
|
|
918
|
+
Computes arccosine of input coo_tensors element-wise.
|
|
919
|
+
|
|
920
|
+
.. math::
|
|
921
|
+
|
|
922
|
+
out_i = \cos^{-1}(x_i)
|
|
923
|
+
|
|
924
|
+
Args:
|
|
925
|
+
x (COOTensor): Input COOTensor.
|
|
926
|
+
|
|
927
|
+
Returns:
|
|
928
|
+
COOTensor, has the same shape and dtype as `x`.
|
|
929
|
+
|
|
930
|
+
Raises:
|
|
931
|
+
TypeError: If `x` is not a COOTensor.
|
|
932
|
+
TypeError: If dtype of `x` is not float16, float32 or float64.
|
|
933
|
+
|
|
934
|
+
Supported Platforms:
|
|
935
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
936
|
+
|
|
937
|
+
Examples:
|
|
938
|
+
>>> from mindspore import dtype as mstype
|
|
939
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
940
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
941
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
942
|
+
>>> shape = (3, 4)
|
|
943
|
+
>>> x = COOTensor(indices, values, shape)
|
|
944
|
+
>>> output = ops.coo_acos(x)
|
|
945
|
+
>>> print(output.values)
|
|
946
|
+
[3.1415927 nan]
|
|
947
|
+
"""
|
|
948
|
+
if not isinstance(x, COOTensor):
|
|
949
|
+
raise_type_error('Expects COOTensor for coo_acos')
|
|
950
|
+
return COOTensor(x.indices, math_func.acos(x.values), x.shape)
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
def csr_floor(x: CSRTensor) -> CSRTensor:
|
|
954
|
+
r"""
|
|
955
|
+
Rounds a CSRTensor down to the closest integer element-wise.
|
|
956
|
+
|
|
957
|
+
.. math::
|
|
958
|
+
|
|
959
|
+
out_i = \lfloor x_i \rfloor
|
|
960
|
+
|
|
961
|
+
Args:
|
|
962
|
+
x (CSRTensor): The input CSRTensor, its data type must be float16, float32 or float64.
|
|
963
|
+
|
|
964
|
+
Returns:
|
|
965
|
+
CSRTensor, has the same shape as `x`.
|
|
966
|
+
|
|
967
|
+
Raises:
|
|
968
|
+
TypeError: If `x` is not a CSRTensor.
|
|
969
|
+
TypeError: If dtype of `x` is not in [float16, float32, float64].
|
|
970
|
+
|
|
971
|
+
Supported Platforms:
|
|
972
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
973
|
+
|
|
974
|
+
Examples:
|
|
975
|
+
>>> from mindspore import dtype as mstype
|
|
976
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
977
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
978
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
979
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
980
|
+
>>> shape = (3, 4)
|
|
981
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
982
|
+
>>> output = ops.csr_floor(x)
|
|
983
|
+
>>> print(output.values)
|
|
984
|
+
[-1. 2.]
|
|
985
|
+
"""
|
|
986
|
+
if not isinstance(x, CSRTensor):
|
|
987
|
+
raise_type_error('Expects CSRTensor for csr_floor')
|
|
988
|
+
return CSRTensor(x.indptr, x.indices, math_func.floor(x.values), x.shape)
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
def coo_floor(x: COOTensor) -> COOTensor:
|
|
992
|
+
r"""
|
|
993
|
+
Rounds a COOTensor down to the closest integer element-wise.
|
|
994
|
+
|
|
995
|
+
.. math::
|
|
996
|
+
|
|
997
|
+
out_i = \lfloor x_i \rfloor
|
|
998
|
+
|
|
999
|
+
Args:
|
|
1000
|
+
x (COOTensor): The input COOTensor, its data type must be float16, float32 or float64.
|
|
1001
|
+
|
|
1002
|
+
Returns:
|
|
1003
|
+
COOTensor, has the same shape as `x`.
|
|
1004
|
+
|
|
1005
|
+
Raises:
|
|
1006
|
+
TypeError: If `x` is not a COOTensor.
|
|
1007
|
+
TypeError: If dtype of `x` is not in [float16, float32, float64].
|
|
1008
|
+
|
|
1009
|
+
Supported Platforms:
|
|
1010
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1011
|
+
|
|
1012
|
+
Examples:
|
|
1013
|
+
>>> from mindspore import dtype as mstype
|
|
1014
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1015
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1016
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1017
|
+
>>> shape = (3, 4)
|
|
1018
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1019
|
+
>>> output = ops.coo_floor(x)
|
|
1020
|
+
>>> print(output.values)
|
|
1021
|
+
[-1. 2.]
|
|
1022
|
+
"""
|
|
1023
|
+
if not isinstance(x, COOTensor):
|
|
1024
|
+
raise_type_error('Expects COOTensor for coo_floor')
|
|
1025
|
+
return COOTensor(x.indices, math_func.floor(x.values), x.shape)
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
def csr_atan(x: CSRTensor) -> CSRTensor:
|
|
1029
|
+
r"""
|
|
1030
|
+
Computes the trigonometric inverse tangent of the input element-wise.
|
|
1031
|
+
|
|
1032
|
+
.. math::
|
|
1033
|
+
|
|
1034
|
+
out_i = \tan^{-1}(x_i)
|
|
1035
|
+
|
|
1036
|
+
Args:
|
|
1037
|
+
x (CSRTensor): The data type should be one of the following types: float16, float32.
|
|
1038
|
+
|
|
1039
|
+
Returns:
|
|
1040
|
+
A CSRTensor, has the same type as the input.
|
|
1041
|
+
|
|
1042
|
+
Raises:
|
|
1043
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1044
|
+
TypeError: If dtype of `x` is not float16 or float32.
|
|
1045
|
+
|
|
1046
|
+
Supported Platforms:
|
|
1047
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1048
|
+
|
|
1049
|
+
Examples:
|
|
1050
|
+
>>> from mindspore import dtype as mstype
|
|
1051
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1052
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1053
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1054
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1055
|
+
>>> shape = (3, 4)
|
|
1056
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1057
|
+
>>> output = ops.csr_atan(x)
|
|
1058
|
+
>>> print(output.values)
|
|
1059
|
+
[-0.7853982 1.1071488]
|
|
1060
|
+
"""
|
|
1061
|
+
if not isinstance(x, CSRTensor):
|
|
1062
|
+
raise_type_error('Expects CSRTensor for csr_atan')
|
|
1063
|
+
return CSRTensor(x.indptr, x.indices, math_func.atan(x.values), x.shape)
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
def coo_atan(x: COOTensor) -> COOTensor:
|
|
1067
|
+
r"""
|
|
1068
|
+
Computes the trigonometric inverse tangent of the input element-wise.
|
|
1069
|
+
|
|
1070
|
+
.. math::
|
|
1071
|
+
|
|
1072
|
+
out_i = \tan^{-1}(x_i)
|
|
1073
|
+
|
|
1074
|
+
Args:
|
|
1075
|
+
x (COOTensor): The data type should be one of the following types: float16, float32.
|
|
1076
|
+
|
|
1077
|
+
Returns:
|
|
1078
|
+
A COOTensor, has the same type as the input.
|
|
1079
|
+
|
|
1080
|
+
Raises:
|
|
1081
|
+
TypeError: If `x` is not a COOTensor.
|
|
1082
|
+
TypeError: If dtype of `x` is not float16 or float32.
|
|
1083
|
+
|
|
1084
|
+
Supported Platforms:
|
|
1085
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1086
|
+
|
|
1087
|
+
Examples:
|
|
1088
|
+
>>> from mindspore import dtype as mstype
|
|
1089
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1090
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1091
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1092
|
+
>>> shape = (3, 4)
|
|
1093
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1094
|
+
>>> output = ops.coo_atan(x)
|
|
1095
|
+
>>> print(output.values)
|
|
1096
|
+
[-0.7853982 1.1071488]
|
|
1097
|
+
"""
|
|
1098
|
+
if not isinstance(x, COOTensor):
|
|
1099
|
+
raise_type_error('Expects COOTensor for coo_atan')
|
|
1100
|
+
return COOTensor(x.indices, math_func.atan(x.values), x.shape)
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
def csr_square(x: CSRTensor) -> CSRTensor:
|
|
1104
|
+
"""
|
|
1105
|
+
Returns square of a CSRTensor element-wise.
|
|
1106
|
+
|
|
1107
|
+
.. math::
|
|
1108
|
+
|
|
1109
|
+
out_{i} = (x_{i})^2
|
|
1110
|
+
|
|
1111
|
+
Args:
|
|
1112
|
+
x (CSRTensor): The input CSRTensor with a dtype of Number.
|
|
1113
|
+
|
|
1114
|
+
Returns:
|
|
1115
|
+
CSRTensor, has the same shape and dtype as the `x`.
|
|
1116
|
+
|
|
1117
|
+
Raises:
|
|
1118
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1119
|
+
|
|
1120
|
+
Supported Platforms:
|
|
1121
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1122
|
+
|
|
1123
|
+
Examples:
|
|
1124
|
+
>>> from mindspore import dtype as mstype
|
|
1125
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1126
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1127
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1128
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1129
|
+
>>> shape = (3, 4)
|
|
1130
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1131
|
+
>>> output = ops.csr_square(x)
|
|
1132
|
+
>>> print(output.values)
|
|
1133
|
+
[1. 4.]
|
|
1134
|
+
"""
|
|
1135
|
+
if not isinstance(x, CSRTensor):
|
|
1136
|
+
raise_type_error('Expects CSRTensor for csr_square')
|
|
1137
|
+
return CSRTensor(x.indptr, x.indices, math_func.square(x.values), x.shape)
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
def coo_square(x: COOTensor) -> COOTensor:
|
|
1141
|
+
"""
|
|
1142
|
+
Returns square of a COOTensor element-wise.
|
|
1143
|
+
|
|
1144
|
+
.. math::
|
|
1145
|
+
|
|
1146
|
+
out_{i} = (x_{i})^2
|
|
1147
|
+
|
|
1148
|
+
Args:
|
|
1149
|
+
x (COOTensor): The input COOTensor with a dtype of Number.
|
|
1150
|
+
|
|
1151
|
+
Returns:
|
|
1152
|
+
COOTensor, has the same shape and dtype as the `x`.
|
|
1153
|
+
|
|
1154
|
+
Raises:
|
|
1155
|
+
TypeError: If `x` is not a COOTensor.
|
|
1156
|
+
|
|
1157
|
+
Supported Platforms:
|
|
1158
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1159
|
+
|
|
1160
|
+
Examples:
|
|
1161
|
+
>>> from mindspore import dtype as mstype
|
|
1162
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1163
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1164
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1165
|
+
>>> shape = (3, 4)
|
|
1166
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1167
|
+
>>> output = ops.coo_square(x)
|
|
1168
|
+
>>> print(output.values)
|
|
1169
|
+
[1. 4.]
|
|
1170
|
+
"""
|
|
1171
|
+
if not isinstance(x, COOTensor):
|
|
1172
|
+
raise_type_error('Expects COOTensor for coo_square')
|
|
1173
|
+
return COOTensor(x.indices, math_func.square(x.values), x.shape)
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
def csr_relu6(x: CSRTensor) -> CSRTensor:
|
|
1177
|
+
r"""
|
|
1178
|
+
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input csr_tensors element-wise.
|
|
1179
|
+
|
|
1180
|
+
.. math::
|
|
1181
|
+
|
|
1182
|
+
\text{ReLU6}(x) = \min(\max(0,x), 6)
|
|
1183
|
+
|
|
1184
|
+
It returns :math:`\min(\max(0,x), 6)` element-wise.
|
|
1185
|
+
|
|
1186
|
+
Args:
|
|
1187
|
+
x (CSRTensor): Input CSRTensor, with float16 or float32 data type.
|
|
1188
|
+
|
|
1189
|
+
Returns:
|
|
1190
|
+
CSRTensor, with the same dtype and shape as the `x`.
|
|
1191
|
+
|
|
1192
|
+
Raises:
|
|
1193
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1194
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1195
|
+
|
|
1196
|
+
Supported Platforms:
|
|
1197
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1198
|
+
|
|
1199
|
+
Examples:
|
|
1200
|
+
>>> from mindspore import dtype as mstype
|
|
1201
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1202
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1203
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1204
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1205
|
+
>>> shape = (3, 4)
|
|
1206
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1207
|
+
>>> output = ops.csr_relu6(x)
|
|
1208
|
+
>>> print(output.values)
|
|
1209
|
+
[0. 2.]
|
|
1210
|
+
"""
|
|
1211
|
+
if not isinstance(x, CSRTensor):
|
|
1212
|
+
raise_type_error('Expects CSRTensor for csr_relu6')
|
|
1213
|
+
return CSRTensor(x.indptr, x.indices, nn_func.relu6(x.values), x.shape)
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
def coo_relu6(x: COOTensor) -> COOTensor:
|
|
1217
|
+
r"""
|
|
1218
|
+
Computes ReLU (Rectified Linear Unit) upper bounded by 6 of input coo_tensors element-wise.
|
|
1219
|
+
|
|
1220
|
+
.. math::
|
|
1221
|
+
|
|
1222
|
+
\text{ReLU6}(x) = \min(\max(0,x), 6)
|
|
1223
|
+
|
|
1224
|
+
It returns :math:`\min(\max(0,x), 6)` element-wise.
|
|
1225
|
+
|
|
1226
|
+
Args:
|
|
1227
|
+
x (COOTensor): Input COOTensor, with float16 or float32 data type.
|
|
1228
|
+
|
|
1229
|
+
Returns:
|
|
1230
|
+
COOTensor, with the same dtype and shape as the `x`.
|
|
1231
|
+
|
|
1232
|
+
Raises:
|
|
1233
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1234
|
+
TypeError: If `x` is not a COOTensor.
|
|
1235
|
+
|
|
1236
|
+
Supported Platforms:
|
|
1237
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1238
|
+
|
|
1239
|
+
Examples:
|
|
1240
|
+
>>> from mindspore import dtype as mstype
|
|
1241
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1242
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1243
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1244
|
+
>>> shape = (3, 4)
|
|
1245
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1246
|
+
>>> output = ops.coo_relu6(x)
|
|
1247
|
+
>>> print(output.values)
|
|
1248
|
+
[0. 2.]
|
|
1249
|
+
"""
|
|
1250
|
+
if not isinstance(x, COOTensor):
|
|
1251
|
+
raise_type_error('Expects COOTensor for coo_relu6')
|
|
1252
|
+
return COOTensor(x.indices, nn_func.relu6(x.values), x.shape)
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
def csr_sinh(x: CSRTensor) -> CSRTensor:
|
|
1256
|
+
r"""
|
|
1257
|
+
Computes hyperbolic sine of the input element-wise.
|
|
1258
|
+
|
|
1259
|
+
.. math::
|
|
1260
|
+
|
|
1261
|
+
out_i = \sinh(x_i)
|
|
1262
|
+
|
|
1263
|
+
Args:
|
|
1264
|
+
x (CSRTensor): The input CSRTensor of hyperbolic sine function.
|
|
1265
|
+
|
|
1266
|
+
Returns:
|
|
1267
|
+
CSRTensor, has the same shape as `x`.
|
|
1268
|
+
|
|
1269
|
+
Raises:
|
|
1270
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1271
|
+
|
|
1272
|
+
Supported Platforms:
|
|
1273
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1274
|
+
|
|
1275
|
+
Examples:
|
|
1276
|
+
>>> from mindspore import dtype as mstype
|
|
1277
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1278
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1279
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1280
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1281
|
+
>>> shape = (3, 4)
|
|
1282
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1283
|
+
>>> output = ops.csr_sinh(x)
|
|
1284
|
+
>>> print(output.values)
|
|
1285
|
+
[-1.1752012 3.6268604]
|
|
1286
|
+
"""
|
|
1287
|
+
if not isinstance(x, CSRTensor):
|
|
1288
|
+
raise_type_error('Expects CSRTensor for csr_sinh')
|
|
1289
|
+
return CSRTensor(x.indptr, x.indices, math_func.sinh(x.values), x.shape)
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
def coo_sinh(x: COOTensor) -> COOTensor:
|
|
1293
|
+
r"""
|
|
1294
|
+
Computes hyperbolic sine of the input element-wise.
|
|
1295
|
+
|
|
1296
|
+
.. math::
|
|
1297
|
+
|
|
1298
|
+
out_i = \sinh(x_i)
|
|
1299
|
+
|
|
1300
|
+
Args:
|
|
1301
|
+
x (COOTensor): The input COOTensor of hyperbolic sine function.
|
|
1302
|
+
|
|
1303
|
+
Returns:
|
|
1304
|
+
COOTensor, has the same shape as `x`.
|
|
1305
|
+
|
|
1306
|
+
Raises:
|
|
1307
|
+
TypeError: If `x` is not a COOTensor.
|
|
1308
|
+
|
|
1309
|
+
Supported Platforms:
|
|
1310
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1311
|
+
|
|
1312
|
+
Examples:
|
|
1313
|
+
>>> from mindspore import dtype as mstype
|
|
1314
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1315
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1316
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1317
|
+
>>> shape = (3, 4)
|
|
1318
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1319
|
+
>>> output = ops.coo_sinh(x)
|
|
1320
|
+
>>> print(output.values)
|
|
1321
|
+
[-1.1752012 3.6268604]
|
|
1322
|
+
"""
|
|
1323
|
+
if not isinstance(x, COOTensor):
|
|
1324
|
+
raise_type_error('Expects COOTensor for coo_sinh')
|
|
1325
|
+
return COOTensor(x.indices, math_func.sinh(x.values), x.shape)
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
def csr_ceil(x: CSRTensor) -> CSRTensor:
|
|
1329
|
+
r"""
|
|
1330
|
+
Rounds a CSRTensor up to the closest integer element-wise.
|
|
1331
|
+
|
|
1332
|
+
.. math::
|
|
1333
|
+
|
|
1334
|
+
out_i = \lceil x_i \rceil = \lfloor x_i \rfloor + 1
|
|
1335
|
+
|
|
1336
|
+
Args:
|
|
1337
|
+
x (CSRTensor): The input CSRTensor with a dtype of float16 or float32.
|
|
1338
|
+
|
|
1339
|
+
Returns:
|
|
1340
|
+
CSRTensor, has the same shape as the `x`.
|
|
1341
|
+
|
|
1342
|
+
Raises:
|
|
1343
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1344
|
+
TypeError: If dtype of `x` is not float16 or float32.
|
|
1345
|
+
|
|
1346
|
+
Supported Platforms:
|
|
1347
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1348
|
+
|
|
1349
|
+
Examples:
|
|
1350
|
+
>>> from mindspore import dtype as mstype
|
|
1351
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1352
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1353
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1354
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1355
|
+
>>> shape = (3, 4)
|
|
1356
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1357
|
+
>>> output = ops.csr_ceil(x)
|
|
1358
|
+
>>> print(output.values)
|
|
1359
|
+
[-1. 2.]
|
|
1360
|
+
"""
|
|
1361
|
+
if not isinstance(x, CSRTensor):
|
|
1362
|
+
raise_type_error('Expects CSRTensor for csr_ceil')
|
|
1363
|
+
return CSRTensor(x.indptr, x.indices, math_func.ceil(x.values), x.shape)
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
def coo_ceil(x: COOTensor) -> COOTensor:
|
|
1367
|
+
r"""
|
|
1368
|
+
Rounds a COOTensor up to the closest integer element-wise.
|
|
1369
|
+
|
|
1370
|
+
.. math::
|
|
1371
|
+
|
|
1372
|
+
out_i = \lceil x_i \rceil = \lfloor x_i \rfloor + 1
|
|
1373
|
+
|
|
1374
|
+
Args:
|
|
1375
|
+
x (COOTensor): The input COOTensor with a dtype of float16 or float32.
|
|
1376
|
+
|
|
1377
|
+
Returns:
|
|
1378
|
+
COOTensor, has the same shape as the `x`.
|
|
1379
|
+
|
|
1380
|
+
Raises:
|
|
1381
|
+
TypeError: If `x` is not a COOTensor.
|
|
1382
|
+
TypeError: If dtype of `x` is not float16 or float32.
|
|
1383
|
+
|
|
1384
|
+
Supported Platforms:
|
|
1385
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1386
|
+
|
|
1387
|
+
Examples:
|
|
1388
|
+
>>> from mindspore import dtype as mstype
|
|
1389
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1390
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1391
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1392
|
+
>>> shape = (3, 4)
|
|
1393
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1394
|
+
>>> output = ops.coo_ceil(x)
|
|
1395
|
+
>>> print(output.values)
|
|
1396
|
+
[-1. 2.]
|
|
1397
|
+
"""
|
|
1398
|
+
if not isinstance(x, COOTensor):
|
|
1399
|
+
raise_type_error('Expects COOTensor for coo_ceil')
|
|
1400
|
+
return COOTensor(x.indices, math_func.ceil(x.values), x.shape)
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
def csr_cosh(x: CSRTensor) -> CSRTensor:
|
|
1404
|
+
r"""
|
|
1405
|
+
Computes hyperbolic cosine of input element-wise.
|
|
1406
|
+
|
|
1407
|
+
.. math::
|
|
1408
|
+
|
|
1409
|
+
out_i = \cosh(x_i)
|
|
1410
|
+
|
|
1411
|
+
Args:
|
|
1412
|
+
x (CSRTensor): The input CSRTensor of hyperbolic cosine function, its data type
|
|
1413
|
+
must be float16, float32, float64, complex64 or complex128.
|
|
1414
|
+
|
|
1415
|
+
Returns:
|
|
1416
|
+
CSRTensor, has the same shape as `x`.
|
|
1417
|
+
|
|
1418
|
+
Raises:
|
|
1419
|
+
TypeError: If the dtype of `x` is not one of the following types:
|
|
1420
|
+
float16, float32, float64, complex64, complex128.
|
|
1421
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1422
|
+
|
|
1423
|
+
Supported Platforms:
|
|
1424
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1425
|
+
|
|
1426
|
+
Examples:
|
|
1427
|
+
>>> from mindspore import dtype as mstype
|
|
1428
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1429
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1430
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1431
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1432
|
+
>>> shape = (3, 4)
|
|
1433
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1434
|
+
>>> output = ops.csr_cosh(x)
|
|
1435
|
+
>>> print(output.values)
|
|
1436
|
+
[1.5430807 3.7621956]
|
|
1437
|
+
"""
|
|
1438
|
+
if not isinstance(x, CSRTensor):
|
|
1439
|
+
raise_type_error('Expects CSRTensor for csr_cosh')
|
|
1440
|
+
return CSRTensor(x.indptr, x.indices, math_func.cosh(x.values), x.shape)
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
def coo_cosh(x: COOTensor) -> COOTensor:
|
|
1444
|
+
r"""
|
|
1445
|
+
Computes hyperbolic cosine of input element-wise.
|
|
1446
|
+
|
|
1447
|
+
.. math::
|
|
1448
|
+
|
|
1449
|
+
out_i = \cosh(x_i)
|
|
1450
|
+
|
|
1451
|
+
Args:
|
|
1452
|
+
x (COOTensor): The input COOTensor of hyperbolic cosine function, its data type
|
|
1453
|
+
must be float16, float32, float64, complex64 or complex128.
|
|
1454
|
+
|
|
1455
|
+
Returns:
|
|
1456
|
+
COOTensor, has the same shape as `x`.
|
|
1457
|
+
|
|
1458
|
+
Raises:
|
|
1459
|
+
TypeError: If the dtype of `x` is not one of the following types:
|
|
1460
|
+
float16, float32, float64, complex64, complex128.
|
|
1461
|
+
TypeError: If `x` is not a COOTensor.
|
|
1462
|
+
|
|
1463
|
+
Supported Platforms:
|
|
1464
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1465
|
+
|
|
1466
|
+
Examples:
|
|
1467
|
+
>>> from mindspore import dtype as mstype
|
|
1468
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1469
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1470
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1471
|
+
>>> shape = (3, 4)
|
|
1472
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1473
|
+
>>> output = ops.coo_cosh(x)
|
|
1474
|
+
>>> print(output.values)
|
|
1475
|
+
[1.5430807 3.7621956]
|
|
1476
|
+
"""
|
|
1477
|
+
if not isinstance(x, COOTensor):
|
|
1478
|
+
raise_type_error('Expects COOTensor for coo_cosh')
|
|
1479
|
+
return COOTensor(x.indices, math_func.cosh(x.values), x.shape)
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
def csr_softsign(x: CSRTensor) -> CSRTensor:
|
|
1483
|
+
r"""
|
|
1484
|
+
Softsign activation function.
|
|
1485
|
+
|
|
1486
|
+
The function is shown as follows:
|
|
1487
|
+
|
|
1488
|
+
.. math::
|
|
1489
|
+
\text{SoftSign}(x) = \frac{x}{1 + |x|}
|
|
1490
|
+
|
|
1491
|
+
Args:
|
|
1492
|
+
x (CSRTensor): Input CSRTensor, with float16 or float32 data type.
|
|
1493
|
+
|
|
1494
|
+
Returns:
|
|
1495
|
+
CSRTensor, with the same type and shape as the `x`.
|
|
1496
|
+
|
|
1497
|
+
Raises:
|
|
1498
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1499
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1500
|
+
|
|
1501
|
+
Supported Platforms:
|
|
1502
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1503
|
+
|
|
1504
|
+
Examples:
|
|
1505
|
+
>>> from mindspore import dtype as mstype
|
|
1506
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1507
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1508
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1509
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1510
|
+
>>> shape = (3, 4)
|
|
1511
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1512
|
+
>>> output = ops.csr_softsign(x)
|
|
1513
|
+
>>> print(output.values)
|
|
1514
|
+
[-0.5 0.6666667]
|
|
1515
|
+
"""
|
|
1516
|
+
if not isinstance(x, CSRTensor):
|
|
1517
|
+
raise_type_error('Expects CSRTensor for csr_softsign')
|
|
1518
|
+
return CSRTensor(x.indptr, x.indices, nn_func.softsign(x.values), x.shape)
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
def coo_softsign(x: COOTensor) -> COOTensor:
|
|
1522
|
+
r"""
|
|
1523
|
+
Softsign activation function.
|
|
1524
|
+
|
|
1525
|
+
The function is shown as follows:
|
|
1526
|
+
|
|
1527
|
+
.. math::
|
|
1528
|
+
\text{SoftSign}(x) = \frac{x}{1 + |x|}
|
|
1529
|
+
|
|
1530
|
+
Args:
|
|
1531
|
+
x (COOTensor): Input COOTensor, with float16 or float32 data type.
|
|
1532
|
+
|
|
1533
|
+
Returns:
|
|
1534
|
+
COOTensor, with the same type and shape as the `x`.
|
|
1535
|
+
|
|
1536
|
+
Raises:
|
|
1537
|
+
TypeError: If `x` is not a COOTensor.
|
|
1538
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1539
|
+
|
|
1540
|
+
Supported Platforms:
|
|
1541
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1542
|
+
|
|
1543
|
+
Examples:
|
|
1544
|
+
>>> from mindspore import dtype as mstype
|
|
1545
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1546
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1547
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1548
|
+
>>> shape = (3, 4)
|
|
1549
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1550
|
+
>>> output = ops.coo_softsign(x)
|
|
1551
|
+
>>> print(output.values)
|
|
1552
|
+
[-0.5 0.6666667]
|
|
1553
|
+
"""
|
|
1554
|
+
if not isinstance(x, COOTensor):
|
|
1555
|
+
raise_type_error('Expects COOTensor for coo_softsign')
|
|
1556
|
+
return COOTensor(x.indices, nn_func.softsign(x.values), x.shape)
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
def csr_log1p(x: CSRTensor) -> CSRTensor:
|
|
1560
|
+
r"""
|
|
1561
|
+
Returns the natural logarithm of one plus the input CSRTensor element-wise.
|
|
1562
|
+
|
|
1563
|
+
.. math::
|
|
1564
|
+
out_i = \text{log_e}(x_i + 1)
|
|
1565
|
+
|
|
1566
|
+
Args:
|
|
1567
|
+
x (CSRTensor): The input CSRTensor. With float16 or float32 data type.
|
|
1568
|
+
The value must be greater than -1.
|
|
1569
|
+
|
|
1570
|
+
Returns:
|
|
1571
|
+
CSRTensor, has the same shape as the `x`.
|
|
1572
|
+
|
|
1573
|
+
Raises:
|
|
1574
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1575
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1576
|
+
|
|
1577
|
+
Supported Platforms:
|
|
1578
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1579
|
+
|
|
1580
|
+
Examples:
|
|
1581
|
+
>>> from mindspore import dtype as mstype
|
|
1582
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1583
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1584
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1585
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1586
|
+
>>> shape = (3, 4)
|
|
1587
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1588
|
+
>>> output = ops.csr_log1p(x)
|
|
1589
|
+
>>> print(output.values)
|
|
1590
|
+
[ -inf 1.0986123]
|
|
1591
|
+
"""
|
|
1592
|
+
if not isinstance(x, CSRTensor):
|
|
1593
|
+
raise_type_error('Expects CSRTensor for csr_log1p')
|
|
1594
|
+
return CSRTensor(x.indptr, x.indices, math_func.log1p(x.values), x.shape)
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
def coo_log1p(x: COOTensor) -> COOTensor:
|
|
1598
|
+
r"""
|
|
1599
|
+
Returns the natural logarithm of one plus the input COOTensor element-wise.
|
|
1600
|
+
|
|
1601
|
+
.. math::
|
|
1602
|
+
out_i = \text{log_e}(x_i + 1)
|
|
1603
|
+
|
|
1604
|
+
Args:
|
|
1605
|
+
x (COOTensor): The input COOTensor, should have dtype of float16 or float32
|
|
1606
|
+
and its value should be greater than -1.
|
|
1607
|
+
|
|
1608
|
+
Returns:
|
|
1609
|
+
COOTensor, has the same shape as the `x`.
|
|
1610
|
+
|
|
1611
|
+
Raises:
|
|
1612
|
+
TypeError: If `x` is not a COOTensor.
|
|
1613
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1614
|
+
|
|
1615
|
+
Supported Platforms:
|
|
1616
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1617
|
+
|
|
1618
|
+
Examples:
|
|
1619
|
+
>>> from mindspore import dtype as mstype
|
|
1620
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1621
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1622
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1623
|
+
>>> shape = (3, 4)
|
|
1624
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1625
|
+
>>> output = ops.coo_log1p(x)
|
|
1626
|
+
>>> print(output.values)
|
|
1627
|
+
[ -inf 1.0986123]
|
|
1628
|
+
"""
|
|
1629
|
+
if not isinstance(x, COOTensor):
|
|
1630
|
+
raise_type_error('Expects COOTensor for coo_log1p')
|
|
1631
|
+
return COOTensor(x.indices, math_func.log1p(x.values), x.shape)
|
|
1632
|
+
|
|
1633
|
+
|
|
1634
|
+
def csr_round(x: CSRTensor) -> CSRTensor:
|
|
1635
|
+
"""
|
|
1636
|
+
Returns half to even of a CSRTensor element-wise.
|
|
1637
|
+
|
|
1638
|
+
.. math::
|
|
1639
|
+
|
|
1640
|
+
out_i \\approx x_i
|
|
1641
|
+
|
|
1642
|
+
Args:
|
|
1643
|
+
x (CSRTensor): The input CSRTensor.
|
|
1644
|
+
|
|
1645
|
+
Returns:
|
|
1646
|
+
CSRTensor, has the same shape and type as the `x`.
|
|
1647
|
+
|
|
1648
|
+
Raises:
|
|
1649
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1650
|
+
|
|
1651
|
+
Supported Platforms:
|
|
1652
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1653
|
+
|
|
1654
|
+
Examples:
|
|
1655
|
+
>>> from mindspore import dtype as mstype
|
|
1656
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1657
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1658
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1659
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1660
|
+
>>> shape = (3, 4)
|
|
1661
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1662
|
+
>>> output = ops.csr_round(x)
|
|
1663
|
+
>>> print(output.values)
|
|
1664
|
+
[-1. 2.]
|
|
1665
|
+
"""
|
|
1666
|
+
if not isinstance(x, CSRTensor):
|
|
1667
|
+
raise_type_error('Expects CSRTensor for csr_round')
|
|
1668
|
+
return CSRTensor(x.indptr, x.indices, math_func.round(x.values), x.shape)
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
def coo_round(x: COOTensor) -> COOTensor:
|
|
1672
|
+
r"""
|
|
1673
|
+
Returns half to even of a COOTensor element-wise.
|
|
1674
|
+
|
|
1675
|
+
.. math::
|
|
1676
|
+
|
|
1677
|
+
out_i \approx x_i
|
|
1678
|
+
|
|
1679
|
+
Args:
|
|
1680
|
+
x (COOTensor): The input COOTensor.
|
|
1681
|
+
|
|
1682
|
+
Returns:
|
|
1683
|
+
COOTensor, has the same shape and type as the `x`.
|
|
1684
|
+
|
|
1685
|
+
Raises:
|
|
1686
|
+
TypeError: If `x` is not a COOTensor.
|
|
1687
|
+
|
|
1688
|
+
Supported Platforms:
|
|
1689
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1690
|
+
|
|
1691
|
+
Examples:
|
|
1692
|
+
>>> from mindspore import dtype as mstype
|
|
1693
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1694
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1695
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1696
|
+
>>> shape = (3, 4)
|
|
1697
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1698
|
+
>>> output = ops.coo_round(x)
|
|
1699
|
+
>>> print(output.values)
|
|
1700
|
+
[-1. 2.]
|
|
1701
|
+
"""
|
|
1702
|
+
if not isinstance(x, COOTensor):
|
|
1703
|
+
raise_type_error('Expects COOTensor for coo_round')
|
|
1704
|
+
return COOTensor(x.indices, math_func.round(x.values), x.shape)
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
def csr_tanh(x: CSRTensor) -> CSRTensor:
|
|
1708
|
+
r"""
|
|
1709
|
+
Computes hyperbolic tangent of input element-wise. The Tanh function is defined as:
|
|
1710
|
+
|
|
1711
|
+
.. math::
|
|
1712
|
+
|
|
1713
|
+
tanh(x_i) = \frac{\exp(x_i) - \exp(-x_i)}{\exp(x_i) + \exp(-x_i)} = \frac{\exp(2x_i) - 1}{\exp(2x_i) + 1},
|
|
1714
|
+
|
|
1715
|
+
where :math:`x_i` is an element of the input CSRTensor.
|
|
1716
|
+
|
|
1717
|
+
Args:
|
|
1718
|
+
x (CSRTensor): Input CSRTensor, with float16 or float32 data type.
|
|
1719
|
+
|
|
1720
|
+
Returns:
|
|
1721
|
+
CSRTensor, with the same type and shape as the `x`.
|
|
1722
|
+
|
|
1723
|
+
Raises:
|
|
1724
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1725
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1726
|
+
|
|
1727
|
+
Supported Platforms:
|
|
1728
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1729
|
+
|
|
1730
|
+
Examples:
|
|
1731
|
+
>>> from mindspore import dtype as mstype
|
|
1732
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1733
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1734
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1735
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1736
|
+
>>> shape = (3, 4)
|
|
1737
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1738
|
+
>>> output = ops.csr_tanh(x)
|
|
1739
|
+
>>> print(output.values)
|
|
1740
|
+
[-0.7615942 0.9640276]
|
|
1741
|
+
"""
|
|
1742
|
+
if not isinstance(x, CSRTensor):
|
|
1743
|
+
raise_type_error('Expects CSRTensor for csr_tanh')
|
|
1744
|
+
return CSRTensor(x.indptr, x.indices, math_func.tanh(x.values), x.shape)
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
def coo_tanh(x: COOTensor) -> COOTensor:
|
|
1748
|
+
r"""
|
|
1749
|
+
Computes hyperbolic tangent of input element-wise. The Tanh function is defined as:
|
|
1750
|
+
|
|
1751
|
+
.. math::
|
|
1752
|
+
|
|
1753
|
+
tanh(x_i) = \frac{\exp(x_i) - \exp(-x_i)}{\exp(x_i) + \exp(-x_i)} = \frac{\exp(2x_i) - 1}{\exp(2x_i) + 1},
|
|
1754
|
+
|
|
1755
|
+
where :math:`x_i` is an element of the input COOTensor.
|
|
1756
|
+
|
|
1757
|
+
Args:
|
|
1758
|
+
x (COOTensor): Input COOTensor, with float16 or float32 data type.
|
|
1759
|
+
|
|
1760
|
+
Returns:
|
|
1761
|
+
COOTensor, with the same type and shape as the `x`.
|
|
1762
|
+
|
|
1763
|
+
Raises:
|
|
1764
|
+
TypeError: If dtype of `x` is neither float16 nor float32.
|
|
1765
|
+
TypeError: If `x` is not a COOTensor.
|
|
1766
|
+
|
|
1767
|
+
Supported Platforms:
|
|
1768
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1769
|
+
|
|
1770
|
+
Examples:
|
|
1771
|
+
>>> from mindspore import dtype as mstype
|
|
1772
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1773
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1774
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1775
|
+
>>> shape = (3, 4)
|
|
1776
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1777
|
+
>>> output = ops.coo_tanh(x)
|
|
1778
|
+
>>> print(output.values)
|
|
1779
|
+
[-0.7615942 0.9640276]
|
|
1780
|
+
"""
|
|
1781
|
+
if not isinstance(x, COOTensor):
|
|
1782
|
+
raise_type_error('Expects COOTensor for coo_tanh')
|
|
1783
|
+
return COOTensor(x.indices, math_func.tanh(x.values), x.shape)
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
def csr_asinh(x: CSRTensor) -> CSRTensor:
|
|
1787
|
+
r"""
|
|
1788
|
+
Computes inverse hyperbolic sine of the input element-wise.
|
|
1789
|
+
|
|
1790
|
+
.. math::
|
|
1791
|
+
|
|
1792
|
+
out_i = \sinh^{-1}(input_i)
|
|
1793
|
+
|
|
1794
|
+
Args:
|
|
1795
|
+
x (CSRTensor): The input CSRTensor of inverse hyperbolic sine function, i.e. :math:`input_i`.
|
|
1796
|
+
|
|
1797
|
+
Returns:
|
|
1798
|
+
CSRTensor, has the same shape and type as `x`.
|
|
1799
|
+
|
|
1800
|
+
Raises:
|
|
1801
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1802
|
+
|
|
1803
|
+
Supported Platforms:
|
|
1804
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1805
|
+
|
|
1806
|
+
Examples:
|
|
1807
|
+
>>> from mindspore import dtype as mstype
|
|
1808
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1809
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1810
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1811
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1812
|
+
>>> shape = (3, 4)
|
|
1813
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1814
|
+
>>> output = ops.csr_asinh(x)
|
|
1815
|
+
>>> print(output.values)
|
|
1816
|
+
[-0.8813736 1.4436355]
|
|
1817
|
+
"""
|
|
1818
|
+
if not isinstance(x, CSRTensor):
|
|
1819
|
+
raise_type_error('Expects CSRTensor for csr_asinh')
|
|
1820
|
+
return CSRTensor(x.indptr, x.indices, math_func.asinh(x.values), x.shape)
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
def coo_asinh(x: COOTensor) -> COOTensor:
|
|
1824
|
+
r"""
|
|
1825
|
+
Computes inverse hyperbolic sine of the input element-wise.
|
|
1826
|
+
|
|
1827
|
+
.. math::
|
|
1828
|
+
|
|
1829
|
+
out_i = \sinh^{-1}(input_i)
|
|
1830
|
+
|
|
1831
|
+
Args:
|
|
1832
|
+
x (COOTensor): The input COOTensor of inverse hyperbolic sine function.
|
|
1833
|
+
|
|
1834
|
+
Returns:
|
|
1835
|
+
COOTensor, has the same shape and type as `x`.
|
|
1836
|
+
|
|
1837
|
+
Raises:
|
|
1838
|
+
TypeError: If `x` is not a COOTensor.
|
|
1839
|
+
|
|
1840
|
+
Supported Platforms:
|
|
1841
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1842
|
+
|
|
1843
|
+
Examples:
|
|
1844
|
+
>>> from mindspore import dtype as mstype
|
|
1845
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1846
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1847
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1848
|
+
>>> shape = (3, 4)
|
|
1849
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1850
|
+
>>> output = ops.coo_asinh(x)
|
|
1851
|
+
>>> print(output.values)
|
|
1852
|
+
[-0.8813736 1.4436355]
|
|
1853
|
+
"""
|
|
1854
|
+
if not isinstance(x, COOTensor):
|
|
1855
|
+
raise_type_error('Expects COOTensor for coo_asinh')
|
|
1856
|
+
return COOTensor(x.indices, math_func.asinh(x.values), x.shape)
|
|
1857
|
+
|
|
1858
|
+
|
|
1859
|
+
def csr_neg(x: CSRTensor) -> CSRTensor:
|
|
1860
|
+
"""
|
|
1861
|
+
Returns a CSRTensor with csr_negative values of the input CSRTensor element-wise.
|
|
1862
|
+
|
|
1863
|
+
.. math::
|
|
1864
|
+
|
|
1865
|
+
out_{i} = - x_{i}
|
|
1866
|
+
|
|
1867
|
+
Args:
|
|
1868
|
+
x (CSRTensor): The input CSRTensor with a dtype of Number.
|
|
1869
|
+
|
|
1870
|
+
Returns:
|
|
1871
|
+
CSRTensor, has the same shape and dtype as input.
|
|
1872
|
+
|
|
1873
|
+
Raises:
|
|
1874
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1875
|
+
|
|
1876
|
+
Supported Platforms:
|
|
1877
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1878
|
+
|
|
1879
|
+
Examples:
|
|
1880
|
+
>>> from mindspore import dtype as mstype
|
|
1881
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1882
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1883
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1884
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1885
|
+
>>> shape = (3, 4)
|
|
1886
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1887
|
+
>>> output = ops.csr_neg(x)
|
|
1888
|
+
>>> print(output.values)
|
|
1889
|
+
[ 1. -2.]
|
|
1890
|
+
"""
|
|
1891
|
+
if not isinstance(x, CSRTensor):
|
|
1892
|
+
raise_type_error('Expects CSRTensor for csr_neg')
|
|
1893
|
+
return CSRTensor(x.indptr, x.indices, math_func.neg(x.values), x.shape)
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
def coo_neg(x: COOTensor) -> COOTensor:
|
|
1897
|
+
"""
|
|
1898
|
+
Returns a COOTensor with coo_negative values of the input COOTensor element-wise.
|
|
1899
|
+
|
|
1900
|
+
.. math::
|
|
1901
|
+
|
|
1902
|
+
out_{i} = - x_{i}
|
|
1903
|
+
|
|
1904
|
+
Args:
|
|
1905
|
+
x (COOTensor): The input COOTensor with a dtype of Number.
|
|
1906
|
+
|
|
1907
|
+
Returns:
|
|
1908
|
+
COOTensor, has the same shape and dtype as input.
|
|
1909
|
+
|
|
1910
|
+
Raises:
|
|
1911
|
+
TypeError: If `x` is not a COOTensor.
|
|
1912
|
+
|
|
1913
|
+
Supported Platforms:
|
|
1914
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1915
|
+
|
|
1916
|
+
Examples:
|
|
1917
|
+
>>> from mindspore import dtype as mstype
|
|
1918
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1919
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1920
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1921
|
+
>>> shape = (3, 4)
|
|
1922
|
+
>>> x = COOTensor(indices, values, shape)
|
|
1923
|
+
>>> output = ops.coo_neg(x)
|
|
1924
|
+
>>> print(output.values)
|
|
1925
|
+
[ 1. -2.]
|
|
1926
|
+
"""
|
|
1927
|
+
if not isinstance(x, COOTensor):
|
|
1928
|
+
raise_type_error('Expects COOTensor for coo_neg')
|
|
1929
|
+
return COOTensor(x.indices, math_func.neg(x.values), x.shape)
|
|
1930
|
+
|
|
1931
|
+
|
|
1932
|
+
def csr_acosh(x: CSRTensor) -> CSRTensor:
|
|
1933
|
+
r"""
|
|
1934
|
+
Computes inverse hyperbolic cosine of the inputs element-wise.
|
|
1935
|
+
|
|
1936
|
+
.. math::
|
|
1937
|
+
|
|
1938
|
+
out_i = \cosh^{-1}(input_i)
|
|
1939
|
+
|
|
1940
|
+
Args:
|
|
1941
|
+
x (CSRTensor): The input CSRTensor of inverse hyperbolic cosine function, i.e. :math:`input_i`,
|
|
1942
|
+
its element must be in range [1, inf].
|
|
1943
|
+
|
|
1944
|
+
Returns:
|
|
1945
|
+
CSRTensor, has the same shape and type as `x`.
|
|
1946
|
+
|
|
1947
|
+
Raises:
|
|
1948
|
+
TypeError: If `x` is not a CSRTensor.
|
|
1949
|
+
|
|
1950
|
+
Supported Platforms:
|
|
1951
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1952
|
+
|
|
1953
|
+
Examples:
|
|
1954
|
+
>>> from mindspore import dtype as mstype
|
|
1955
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
1956
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
1957
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
1958
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1959
|
+
>>> shape = (3, 4)
|
|
1960
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
1961
|
+
>>> output = ops.csr_acosh(x)
|
|
1962
|
+
>>> print(output.values)
|
|
1963
|
+
[ nan 1.316958]
|
|
1964
|
+
"""
|
|
1965
|
+
if not isinstance(x, CSRTensor):
|
|
1966
|
+
raise_type_error('Expects CSRTensor for csr_acosh')
|
|
1967
|
+
return CSRTensor(x.indptr, x.indices, math_func.acosh(x.values), x.shape)
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
def coo_acosh(x: COOTensor) -> COOTensor:
|
|
1971
|
+
r"""
|
|
1972
|
+
Computes inverse hyperbolic cosine of the inputs element-wise.
|
|
1973
|
+
|
|
1974
|
+
.. math::
|
|
1975
|
+
|
|
1976
|
+
y_i = \cosh^{-1}(x_i)
|
|
1977
|
+
|
|
1978
|
+
.. warning::
|
|
1979
|
+
Given an input COOTensor x, the function computes inverse hyperbolic cosine of every element.
|
|
1980
|
+
Input range is [1, inf].
|
|
1981
|
+
|
|
1982
|
+
Args:
|
|
1983
|
+
x (COOTensor): The input COOTensor of inverse hyperbolic cosine function.
|
|
1984
|
+
|
|
1985
|
+
Returns:
|
|
1986
|
+
COOTensor, has the same shape and type as `x`.
|
|
1987
|
+
|
|
1988
|
+
Raises:
|
|
1989
|
+
TypeError: If `x` is not a COOTensor.
|
|
1990
|
+
|
|
1991
|
+
Supported Platforms:
|
|
1992
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1993
|
+
|
|
1994
|
+
Examples:
|
|
1995
|
+
>>> from mindspore import dtype as mstype
|
|
1996
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
1997
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
1998
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
1999
|
+
>>> shape = (3, 4)
|
|
2000
|
+
>>> x = COOTensor(indices, values, shape)
|
|
2001
|
+
>>> output = ops.coo_acosh(x)
|
|
2002
|
+
>>> print(output.values)
|
|
2003
|
+
[ nan 1.316958]
|
|
2004
|
+
"""
|
|
2005
|
+
if not isinstance(x, COOTensor):
|
|
2006
|
+
raise_type_error('Expects COOTensor for coo_acosh')
|
|
2007
|
+
return COOTensor(x.indices, math_func.acosh(x.values), x.shape)
|
|
2008
|
+
|
|
2009
|
+
|
|
2010
|
+
def csr_isinf(x: CSRTensor) -> CSRTensor:
|
|
2011
|
+
r"""
|
|
2012
|
+
Determines which elements are inf or -inf for each position.
|
|
2013
|
+
|
|
2014
|
+
.. math::
|
|
2015
|
+
|
|
2016
|
+
out_i = \begin{cases}
|
|
2017
|
+
& \text{ if } x_{i} = \text{Inf},\ \ True \\
|
|
2018
|
+
& \text{ if } x_{i} \ne \text{Inf},\ \ False
|
|
2019
|
+
\end{cases}
|
|
2020
|
+
|
|
2021
|
+
where :math:`Inf` means not a number.
|
|
2022
|
+
|
|
2023
|
+
Args:
|
|
2024
|
+
x (CSRTensor): The input CSRTensor.
|
|
2025
|
+
|
|
2026
|
+
Returns:
|
|
2027
|
+
CSRTensor, has the same shape of input, and the dtype is bool.
|
|
2028
|
+
|
|
2029
|
+
Raises:
|
|
2030
|
+
TypeError: If `x` is not a CSRTensor.
|
|
2031
|
+
|
|
2032
|
+
Supported Platforms:
|
|
2033
|
+
``GPU`` ``CPU``
|
|
2034
|
+
|
|
2035
|
+
Examples:
|
|
2036
|
+
>>> from mindspore import dtype as mstype
|
|
2037
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
2038
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
2039
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
2040
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2041
|
+
>>> shape = (3, 4)
|
|
2042
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
2043
|
+
>>> output = ops.csr_isinf(x)
|
|
2044
|
+
>>> print(output.values)
|
|
2045
|
+
[False False]
|
|
2046
|
+
"""
|
|
2047
|
+
if not isinstance(x, CSRTensor):
|
|
2048
|
+
raise_type_error('Expects CSRTensor for csr_isinf')
|
|
2049
|
+
return CSRTensor(x.indptr, x.indices, math_func.isinf(x.values), x.shape)
|
|
2050
|
+
|
|
2051
|
+
|
|
2052
|
+
def coo_isinf(x: COOTensor) -> COOTensor:
|
|
2053
|
+
r"""
|
|
2054
|
+
Determines which elements are inf or -inf for each position.
|
|
2055
|
+
|
|
2056
|
+
.. math::
|
|
2057
|
+
|
|
2058
|
+
out_i = \begin{cases}
|
|
2059
|
+
& \text{ if } x_{i} = \text{Inf},\ \ True \\
|
|
2060
|
+
& \text{ if } x_{i} \ne \text{Inf},\ \ False
|
|
2061
|
+
\end{cases}
|
|
2062
|
+
|
|
2063
|
+
where :math:`Inf` means infinitity or negative infinitity.
|
|
2064
|
+
|
|
2065
|
+
Args:
|
|
2066
|
+
x (COOTensor): The input COOTensor.
|
|
2067
|
+
|
|
2068
|
+
Returns:
|
|
2069
|
+
COOTensor, has the same shape of input, and the dtype is bool.
|
|
2070
|
+
|
|
2071
|
+
Raises:
|
|
2072
|
+
TypeError: If `x` is not a COOTensor.
|
|
2073
|
+
|
|
2074
|
+
Supported Platforms:
|
|
2075
|
+
``GPU`` ``CPU``
|
|
2076
|
+
|
|
2077
|
+
Examples:
|
|
2078
|
+
>>> from mindspore import dtype as mstype
|
|
2079
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
2080
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
2081
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2082
|
+
>>> shape = (3, 4)
|
|
2083
|
+
>>> x = COOTensor(indices, values, shape)
|
|
2084
|
+
>>> output = ops.coo_isinf(x)
|
|
2085
|
+
>>> print(output.values)
|
|
2086
|
+
[False False]
|
|
2087
|
+
"""
|
|
2088
|
+
if not isinstance(x, COOTensor):
|
|
2089
|
+
raise_type_error('Expects COOTensor for coo_isinf')
|
|
2090
|
+
return COOTensor(x.indices, math_func.isinf(x.values), x.shape)
|
|
2091
|
+
|
|
2092
|
+
|
|
2093
|
+
def csr_atanh(x: CSRTensor) -> CSRTensor:
|
|
2094
|
+
r"""
|
|
2095
|
+
Computes inverse hyperbolic tangent of the input element-wise.
|
|
2096
|
+
|
|
2097
|
+
.. math::
|
|
2098
|
+
|
|
2099
|
+
out_i = \tanh^{-1}(x_{i})
|
|
2100
|
+
|
|
2101
|
+
.. warning::
|
|
2102
|
+
This is an experimental API that is subject to change or deletion.
|
|
2103
|
+
|
|
2104
|
+
Args:
|
|
2105
|
+
x (CSRTensor): Input CSRTensor. The shape is :math:`(N, *)` where :math:`*` means,
|
|
2106
|
+
any number of additional dimensions.
|
|
2107
|
+
The data type should be one of the following types: float16, float32.
|
|
2108
|
+
|
|
2109
|
+
Returns:
|
|
2110
|
+
A CSRTensor, has the same type as the input.
|
|
2111
|
+
|
|
2112
|
+
Raises:
|
|
2113
|
+
TypeError: If `x` is not a CSRTensor.
|
|
2114
|
+
TypeError: If dtype of `x` is not float16 or float32.
|
|
2115
|
+
|
|
2116
|
+
Supported Platforms:
|
|
2117
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2118
|
+
|
|
2119
|
+
Examples:
|
|
2120
|
+
>>> from mindspore import dtype as mstype
|
|
2121
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
2122
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
2123
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
2124
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2125
|
+
>>> shape = (3, 4)
|
|
2126
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
2127
|
+
>>> output = ops.csr_atanh(x)
|
|
2128
|
+
>>> print(output.values)
|
|
2129
|
+
[-inf nan]
|
|
2130
|
+
"""
|
|
2131
|
+
if not isinstance(x, CSRTensor):
|
|
2132
|
+
raise_type_error('Expects CSRTensor for csr_atanh')
|
|
2133
|
+
return CSRTensor(x.indptr, x.indices, math_func.atanh(x.values), x.shape)
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
def coo_atanh(x: COOTensor) -> COOTensor:
|
|
2137
|
+
r"""
|
|
2138
|
+
Computes inverse hyperbolic tangent of the input element-wise.
|
|
2139
|
+
|
|
2140
|
+
.. math::
|
|
2141
|
+
|
|
2142
|
+
out_i = \tanh^{-1}(x_{i})
|
|
2143
|
+
|
|
2144
|
+
.. warning::
|
|
2145
|
+
This is an experimental API that is subject to change or deletion.
|
|
2146
|
+
|
|
2147
|
+
Args:
|
|
2148
|
+
x (COOTensor): Input COOTensor.
|
|
2149
|
+
The data type should be one of the following types: float16, float32.
|
|
2150
|
+
|
|
2151
|
+
Returns:
|
|
2152
|
+
A COOTensor, has the same type as the input.
|
|
2153
|
+
|
|
2154
|
+
Raises:
|
|
2155
|
+
TypeError: If `x` is not a COOTensor.
|
|
2156
|
+
TypeError: If dtype of `x` is not float16 or float32.
|
|
2157
|
+
|
|
2158
|
+
Supported Platforms:
|
|
2159
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2160
|
+
|
|
2161
|
+
Examples:
|
|
2162
|
+
>>> from mindspore import dtype as mstype
|
|
2163
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
2164
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
2165
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2166
|
+
>>> shape = (3, 4)
|
|
2167
|
+
>>> x = COOTensor(indices, values, shape)
|
|
2168
|
+
>>> output = ops.coo_atanh(x)
|
|
2169
|
+
>>> print(output.values)
|
|
2170
|
+
[-inf nan]
|
|
2171
|
+
"""
|
|
2172
|
+
if not isinstance(x, COOTensor):
|
|
2173
|
+
raise_type_error('Expects COOTensor for coo_atanh')
|
|
2174
|
+
return COOTensor(x.indices, math_func.atanh(x.values), x.shape)
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
def csr_sigmoid(x: CSRTensor) -> CSRTensor:
|
|
2178
|
+
r"""
|
|
2179
|
+
Sigmoid activation function.
|
|
2180
|
+
|
|
2181
|
+
Computes Sigmoid of input element-wise. The Sigmoid function is defined as:
|
|
2182
|
+
|
|
2183
|
+
.. math::
|
|
2184
|
+
|
|
2185
|
+
\text{csr_sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)}
|
|
2186
|
+
|
|
2187
|
+
where :math:`x_i` is an element of the x.
|
|
2188
|
+
|
|
2189
|
+
Args:
|
|
2190
|
+
x (CSRTensor): Input CSRTensor, the data type is float16, float32, float64, complex64 or complex128.
|
|
2191
|
+
|
|
2192
|
+
Returns:
|
|
2193
|
+
CSRTensor, with the same type and shape as the x.
|
|
2194
|
+
|
|
2195
|
+
Raises:
|
|
2196
|
+
TypeError: If dtype of `x` is not float16, float32, float64, complex64 or complex128.
|
|
2197
|
+
TypeError: If `x` is not a CSRTensor.
|
|
2198
|
+
|
|
2199
|
+
Supported Platforms:
|
|
2200
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2201
|
+
|
|
2202
|
+
Examples:
|
|
2203
|
+
>>> from mindspore import dtype as mstype
|
|
2204
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
2205
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
2206
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
2207
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2208
|
+
>>> shape = (3, 4)
|
|
2209
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
2210
|
+
>>> output = ops.csr_sigmoid(x)
|
|
2211
|
+
>>> print(output.values)
|
|
2212
|
+
[0.26894143 0.8807971 ]
|
|
2213
|
+
"""
|
|
2214
|
+
if not isinstance(x, CSRTensor):
|
|
2215
|
+
raise_type_error('Expects CSRTensor for csr_sigmoid')
|
|
2216
|
+
return CSRTensor(x.indptr, x.indices, nn_func.sigmoid(x.values), x.shape)
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
def coo_sigmoid(x: COOTensor) -> COOTensor:
|
|
2220
|
+
r"""
|
|
2221
|
+
Sigmoid activation function.
|
|
2222
|
+
|
|
2223
|
+
Computes Sigmoid of input element-wise. The Sigmoid function is defined as:
|
|
2224
|
+
|
|
2225
|
+
.. math::
|
|
2226
|
+
|
|
2227
|
+
\text{coo_sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)}
|
|
2228
|
+
|
|
2229
|
+
where :math:`x_i` is an element of the x.
|
|
2230
|
+
|
|
2231
|
+
Args:
|
|
2232
|
+
x (COOTensor): Input COOTensor, the data type is float16, float32, float64, complex64 or complex128.
|
|
2233
|
+
|
|
2234
|
+
Returns:
|
|
2235
|
+
COOTensor, with the same type and shape as the x.
|
|
2236
|
+
|
|
2237
|
+
Raises:
|
|
2238
|
+
TypeError: If dtype of `x` is not float16, float32, float64, complex64 or complex128.
|
|
2239
|
+
TypeError: If `x` is not a COOTensor.
|
|
2240
|
+
|
|
2241
|
+
Supported Platforms:
|
|
2242
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2243
|
+
|
|
2244
|
+
Examples:
|
|
2245
|
+
>>> from mindspore import dtype as mstype
|
|
2246
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
2247
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
2248
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2249
|
+
>>> shape = (3, 4)
|
|
2250
|
+
>>> x = COOTensor(indices, values, shape)
|
|
2251
|
+
>>> output = ops.coo_sigmoid(x)
|
|
2252
|
+
>>> print(output.values)
|
|
2253
|
+
[0.26894143 0.8807971 ]
|
|
2254
|
+
"""
|
|
2255
|
+
if not isinstance(x, COOTensor):
|
|
2256
|
+
raise_type_error('Expects COOTensor for coo_sigmoid')
|
|
2257
|
+
return COOTensor(x.indices, nn_func.sigmoid(x.values), x.shape)
|
|
2258
|
+
|
|
2259
|
+
|
|
2260
|
+
def csr_abs(x: CSRTensor) -> CSRTensor:
|
|
2261
|
+
"""
|
|
2262
|
+
Returns csr_absolute value of a CSRTensor element-wise.
|
|
2263
|
+
|
|
2264
|
+
.. math::
|
|
2265
|
+
|
|
2266
|
+
out_i = |x_i|
|
|
2267
|
+
|
|
2268
|
+
Args:
|
|
2269
|
+
x (CSRTensor): The input CSRTensor.
|
|
2270
|
+
|
|
2271
|
+
Returns:
|
|
2272
|
+
CSRTensor, has the same shape as the `x`.
|
|
2273
|
+
|
|
2274
|
+
Raises:
|
|
2275
|
+
TypeError: If `x` is not a CSRTensor.
|
|
2276
|
+
|
|
2277
|
+
Supported Platforms:
|
|
2278
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2279
|
+
|
|
2280
|
+
Examples:
|
|
2281
|
+
>>> from mindspore import dtype as mstype
|
|
2282
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
2283
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
2284
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
2285
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2286
|
+
>>> shape = (3, 4)
|
|
2287
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
2288
|
+
>>> output = ops.csr_abs(x)
|
|
2289
|
+
>>> print(output.values)
|
|
2290
|
+
[1. 2.]
|
|
2291
|
+
"""
|
|
2292
|
+
if not isinstance(x, CSRTensor):
|
|
2293
|
+
raise_type_error('Expects CSRTensor for csr_abs')
|
|
2294
|
+
return CSRTensor(x.indptr, x.indices, math_func.abs(x.values), x.shape)
|
|
2295
|
+
|
|
2296
|
+
|
|
2297
|
+
def coo_abs(x: COOTensor) -> COOTensor:
|
|
2298
|
+
"""
|
|
2299
|
+
Returns coo_absolute value of a COOTensor element-wise.
|
|
2300
|
+
|
|
2301
|
+
.. math::
|
|
2302
|
+
|
|
2303
|
+
out_i = |x_i|
|
|
2304
|
+
|
|
2305
|
+
Args:
|
|
2306
|
+
x (COOTensor): The input COOTensor.
|
|
2307
|
+
|
|
2308
|
+
Returns:
|
|
2309
|
+
COOTensor, has the same shape as the `x`.
|
|
2310
|
+
|
|
2311
|
+
Raises:
|
|
2312
|
+
TypeError: If `x` is not a COOTensor.
|
|
2313
|
+
|
|
2314
|
+
Supported Platforms:
|
|
2315
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2316
|
+
|
|
2317
|
+
Examples:
|
|
2318
|
+
>>> from mindspore import dtype as mstype
|
|
2319
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
2320
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
2321
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2322
|
+
>>> shape = (3, 4)
|
|
2323
|
+
>>> x = COOTensor(indices, values, shape)
|
|
2324
|
+
>>> output = ops.coo_abs(x)
|
|
2325
|
+
>>> print(output.values)
|
|
2326
|
+
[1. 2.]
|
|
2327
|
+
"""
|
|
2328
|
+
if not isinstance(x, COOTensor):
|
|
2329
|
+
raise_type_error('Expects COOTensor for coo_abs')
|
|
2330
|
+
return COOTensor(x.indices, math_func.abs(x.values), x.shape)
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
def csr_sin(x: CSRTensor) -> CSRTensor:
|
|
2334
|
+
r"""
|
|
2335
|
+
Computes sine of the input element-wise.
|
|
2336
|
+
|
|
2337
|
+
.. math::
|
|
2338
|
+
|
|
2339
|
+
out_i = \sin(x_i)
|
|
2340
|
+
|
|
2341
|
+
Args:
|
|
2342
|
+
x (CSRTensor): Input CSRTensor.
|
|
2343
|
+
|
|
2344
|
+
Returns:
|
|
2345
|
+
CSRTensor, has the same shape and dtype as `x`.
|
|
2346
|
+
|
|
2347
|
+
Raises:
|
|
2348
|
+
TypeError: If `x` is not a CSRTensor.
|
|
2349
|
+
TypeError: If dtype of `x` is not float16, float32 or float64, complex64,
|
|
2350
|
+
complex128.
|
|
2351
|
+
|
|
2352
|
+
Supported Platforms:
|
|
2353
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2354
|
+
|
|
2355
|
+
Examples:
|
|
2356
|
+
>>> from mindspore import dtype as mstype
|
|
2357
|
+
>>> from mindspore import Tensor, ops, CSRTensor
|
|
2358
|
+
>>> indptr = Tensor([0, 1, 2, 2], dtype=mstype.int32)
|
|
2359
|
+
>>> indices = Tensor([3, 0], dtype=mstype.int32)
|
|
2360
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2361
|
+
>>> shape = (3, 4)
|
|
2362
|
+
>>> x = CSRTensor(indptr, indices, values, shape)
|
|
2363
|
+
>>> output = ops.csr_sin(x)
|
|
2364
|
+
>>> print(output.values)
|
|
2365
|
+
[-0.84147096 0.9092974 ]
|
|
2366
|
+
"""
|
|
2367
|
+
if not isinstance(x, CSRTensor):
|
|
2368
|
+
raise_type_error('Expects CSRTensor for csr_sin')
|
|
2369
|
+
return CSRTensor(x.indptr, x.indices, math_func.sin(x.values), x.shape)
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
def coo_sin(x: COOTensor) -> COOTensor:
|
|
2373
|
+
r"""
|
|
2374
|
+
Computes sine of the input element-wise.
|
|
2375
|
+
|
|
2376
|
+
.. math::
|
|
2377
|
+
|
|
2378
|
+
out_i = \sin(x_i)
|
|
2379
|
+
|
|
2380
|
+
Args:
|
|
2381
|
+
x (COOTensor): Input COOTensor.
|
|
2382
|
+
|
|
2383
|
+
Returns:
|
|
2384
|
+
COOTensor, has the same shape and dtype as `x`.
|
|
2385
|
+
|
|
2386
|
+
Raises:
|
|
2387
|
+
TypeError: If `x` is not a COOTensor.
|
|
2388
|
+
TypeError: If dtype of `x` is not float16, float32 or float64, complex64,
|
|
2389
|
+
complex128.
|
|
2390
|
+
|
|
2391
|
+
Supported Platforms:
|
|
2392
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
2393
|
+
|
|
2394
|
+
Examples:
|
|
2395
|
+
>>> from mindspore import dtype as mstype
|
|
2396
|
+
>>> from mindspore import Tensor, ops, COOTensor
|
|
2397
|
+
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
2398
|
+
>>> values = Tensor([-1, 2], dtype=mstype.float32)
|
|
2399
|
+
>>> shape = (3, 4)
|
|
2400
|
+
>>> x = COOTensor(indices, values, shape)
|
|
2401
|
+
>>> output = ops.coo_sin(x)
|
|
2402
|
+
>>> print(output.values)
|
|
2403
|
+
[-0.84147096 0.9092974 ]
|
|
2404
|
+
"""
|
|
2405
|
+
if not isinstance(x, COOTensor):
|
|
2406
|
+
raise_type_error('Expects COOTensor for coo_sin')
|
|
2407
|
+
return COOTensor(x.indices, math_func.sin(x.values), x.shape)
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
__all__ = [
|
|
2411
|
+
"csr_cos", "csr_tan", "csr_exp", "csr_inv", "csr_relu", "csr_expm1", "csr_isfinite",
|
|
2412
|
+
"csr_asin", "csr_sqrt", "csr_log", "csr_isnan", "csr_acos", "csr_floor", "csr_atan",
|
|
2413
|
+
"csr_square", "csr_relu6", "csr_sinh", "csr_ceil", "csr_cosh", "csr_softsign",
|
|
2414
|
+
"csr_log1p", "csr_round", "csr_tanh", "csr_asinh", "csr_neg", "csr_acosh", "csr_isinf",
|
|
2415
|
+
"csr_atanh", "csr_sigmoid", "csr_abs", "csr_sin", "coo_cos", "coo_tan", "coo_exp",
|
|
2416
|
+
"coo_inv", "coo_relu", "coo_expm1", "coo_isfinite", "coo_asin", "coo_sqrt", "coo_log",
|
|
2417
|
+
"coo_isnan", "coo_acos", "coo_floor", "coo_atan", "coo_square", "coo_relu6", "coo_sinh",
|
|
2418
|
+
"coo_ceil", "coo_cosh", "coo_softsign", "coo_log1p", "coo_round", "coo_tanh",
|
|
2419
|
+
"coo_asinh", "coo_neg", "coo_acosh", "coo_isinf", "coo_atanh", "coo_sigmoid", "coo_abs",
|
|
2420
|
+
"coo_sin"
|
|
2421
|
+
]
|
|
2422
|
+
__all__.sort()
|