| @@ -86,8 +86,9 @@ bool ReducePrecisionFusion::Run(const FuncGraphPtr &graph) { | |||
| auto used_node_index = used_node_list->at(j).second - 1; | |||
| if (AnfAlgo::GetCNodeName(used_node) == prim::kPrimTupleGetItem->name()) { | |||
| ProcessTupleGetItem(graph, used_node, used_node_index, deviceType, inferType); | |||
| } else { | |||
| ReducePrecision(graph, used_node, used_node_index, deviceType, inferType); | |||
| } | |||
| ReducePrecision(graph, used_node, used_node_index, deviceType, inferType); | |||
| } | |||
| } | |||
| } | |||
| @@ -65,6 +65,13 @@ cast_op_info = AkgGpuRegOp("Cast") \ | |||
| .dtype_format(DataType.F32_Default, DataType.F16_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.F64_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.BOOL_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.I8_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.I16_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.I64_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.U8_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.U16_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.U32_Default) \ | |||
| .dtype_format(DataType.F32_Default, DataType.U64_Default) \ | |||
| .dtype_format(DataType.F64_Default, DataType.BOOL_Default) \ | |||
| .dtype_format(DataType.F64_Default, DataType.F32_Default) \ | |||
| .dtype_format(DataType.F64_Default, DataType.F16_Default) \ | |||
| @@ -419,13 +419,13 @@ result: {'top_5_accuracy': 0.9342589628681178, 'top_1_accuracy': 0.7680657810499 | |||
| | uploaded Date | 04/01/2020 (month/day/year) ; | 08/01/2020 (month/day/year) | |||
| | MindSpore Version | 0.1.0-alpha |0.6.0-alpha | | |||
| | Dataset | ImageNet2012 | ImageNet2012| | |||
| | Training Parameters | epoch=90, steps per epoch=626, batch_size = 256 |epoch=90, steps per epoch=5004, batch_size = 32 | | |||
| | Training Parameters | epoch=90, steps per epoch=626, batch_size = 256 |epoch=90, steps per epoch=626, batch_size = 256 | | |||
| | Optimizer | Momentum |Momentum| | |||
| | Loss Function | Softmax Cross Entropy |Softmax Cross Entropy | | |||
| | outputs | probability | probability | | |||
| | Loss | 1.8464266 | 1.9023 | | |||
| | Speed | 118ms/step(8pcs) |67.1ms/step(8pcs)| | |||
| | Total time | 114 mins | 500 mins| | |||
| | Speed | 118ms/step(8pcs) |270ms/step(8pcs)| | |||
| | Total time | 114 mins | 260 mins| | |||
| | Parameters (M) | 25.5 | 25.5 | | |||
| | Checkpoint for Fine tuning | 197M (.ckpt file) |197M (.ckpt file) | | |||
| | Scripts | [Link](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/resnet) | [Link](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/resnet) | | |||
| @@ -502,8 +502,8 @@ def test_cast26(): | |||
| def test_cast27(): | |||
| x0 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t0 = mstype.float64 | |||
| x1 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float64)) | |||
| t1 = mstype.float32 | |||
| x1 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t1 = mstype.uint64 | |||
| context.set_context(mode=context.GRAPH_MODE, device_target='GPU') | |||
| net = Net(t0, t1) | |||
| @@ -511,4 +511,55 @@ def test_cast27(): | |||
| type0 = output[0].asnumpy().dtype | |||
| assert type0 == 'float64' | |||
| type1 = output[1].asnumpy().dtype | |||
| assert type1 == 'float32' | |||
| assert type1 == 'uint64' | |||
| @pytest.mark.level0 | |||
| @pytest.mark.platform_x86_gpu_training | |||
| @pytest.mark.env_onecard | |||
| def test_cast28(): | |||
| x0 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t0 = mstype.int8 | |||
| x1 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t1 = mstype.int16 | |||
| context.set_context(mode=context.GRAPH_MODE, device_target='GPU') | |||
| net = Net(t0, t1) | |||
| output = net(x0, x1) | |||
| type0 = output[0].asnumpy().dtype | |||
| assert type0 == 'int8' | |||
| type1 = output[1].asnumpy().dtype | |||
| assert type1 == 'int16' | |||
| @pytest.mark.level0 | |||
| @pytest.mark.platform_x86_gpu_training | |||
| @pytest.mark.env_onecard | |||
| def test_cast29(): | |||
| x0 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t0 = mstype.int64 | |||
| x1 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t1 = mstype.uint8 | |||
| context.set_context(mode=context.GRAPH_MODE, device_target='GPU') | |||
| net = Net(t0, t1) | |||
| output = net(x0, x1) | |||
| type0 = output[0].asnumpy().dtype | |||
| assert type0 == 'int64' | |||
| type1 = output[1].asnumpy().dtype | |||
| assert type1 == 'uint8' | |||
| @pytest.mark.level0 | |||
| @pytest.mark.platform_x86_gpu_training | |||
| @pytest.mark.env_onecard | |||
| def test_cast30(): | |||
| x0 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t0 = mstype.uint16 | |||
| x1 = Tensor(np.arange(24).reshape((4, 3, 2)).astype(np.float32)) | |||
| t1 = mstype.uint32 | |||
| context.set_context(mode=context.GRAPH_MODE, device_target='GPU') | |||
| net = Net(t0, t1) | |||
| output = net(x0, x1) | |||
| type0 = output[0].asnumpy().dtype | |||
| assert type0 == 'uint16' | |||
| type1 = output[1].asnumpy().dtype | |||
| assert type1 == 'uint32' | |||