345 Star 1.6K Fork 1K

MindSpore/docs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.gitee
.github
activity
docs
federated
hub
lite
mindarmour
mindinsight
mindquantum
mindscience
mindspore
notebook
probability
reinforcement
sample_code
acl_resnet50_sample
ascend310_resnet50_preprocess_sample
ascend310_single_op_sample
ascend910_resnet50_preprocess_sample
bert_poetry
cache
custom_debugging_info
debug_in_pynative_mode
01_single_op.py
02_single_function.py
03_staging.py
04_staging_2.py
05_staging_3.py
06_grad.py
07_lenet.py
README.md
debugging_info
distributed_export
distributed_inference
distributed_training
distributed_training_transformer
evaluate_the_model_during_training
gpu_resnet50_inference_sample
gradient_accumulation
high_order_differentiation
lenet
maskrcnn_fine_tune
mixed_precision
model_encrypt_protection
nnie_proposal
resnet
sample_for_cloud
save_model
linear_regression.py
mid_low_level_api.py
transform_cluster_profiler_data.py
serving
xai
install
resource
tools
tutorials
.gitignore
CONTRIBUTING_DOC.md
CONTRIBUTING_DOC_CN.md
LICENSE
LICENSE-CC-BY-4.0
NOTICE
README.md
README_CN.md
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

文件说明

测试文件运行环境为: mindspore-ascend 1.0.1。

  • 01_single_op.py:执行单个算子,并打印相关结果,示例输出([[[[-0.02190447 -0.05208071 -0.0……5208071 -0.05208071 -0.06265172] ... [ 0.05016355 0.03958241 0.03958241 0.03958241 0.03443141]]]])

  • 02_single_function.py:若干算子组合成一个函数,并打印相关结果,示例输出([[3. 3. 3.] [3. 3. 3.] [3. 3. 3.]])

  • 03_staging.py:MindSpore提供Staging功能,该功能可以在PyNative模式下将Python函数或者Python类的方法编译成计算图,通过图优化等技术提高运行速度,示例输出([[3. 3. 3. 3.] [3. 3. 3. 3.] [3. 3. 3. 3.] [3. 3. 3. 3.]])

  • 04_staging_2.py:加装了ms_function装饰器的函数中,如果包含不需要进行参数训练的算子(如poolingtensor_add等算子),则这些算子可以在被装饰的函数中直接调用,示例输出[[2. 2. 2. 2.] [2. 2. 2. 2.] [2. 2. 2. 2.] [2. 2. 2. 2.]]

  • 05_staging_3.py:被装饰的函数中包含了需要进行参数训练的算子(如ConvolutionBatchNorm等算子),则这些算子必须在被装饰的函数之外完成实例化操作,示例输出[[[[ 0.10377571 -0.0182163 -0.05221086] ... [ 0.0377498 -0.06117418 0.00546303]]]]

  • 06_grad.py:PyNative模式下,还可以支持单独求梯度的操作,示例输出(Tensor(shape=[], dtype=Int32, value=2), Tensor(shape=[], dtype=Int32, value=1))

  • 07_lenet.py:LeNet示例输出:2.3050091。

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mindspore/docs.git
git@gitee.com:mindspore/docs.git
mindspore
docs
docs
r1.5

搜索帮助