mindspore.ops.Pow()等算子不能处理float64类型的数据

原文地址:

https://gitee.com/mindspore/mindspore/issues/I3ZG99

 

 

Software Environment:
-- MindSpore r1.2 GPU ( pip install this package)
-- Python 3.7.5
-- Linux Ubuntu 18.04

 

显卡1660ti  nvidia

Intel i7 cpu

 

 

 

代码:

import mindspore
from mindspore import Tensor
import mindspore.ops as ops
import numpy as np
from mindspore import context

#context.set_context(mode=context.PYNATIVE_MODE, device_target=‘GPU‘)
context.set_context(mode=context.GRAPH_MODE, device_target=GPU)

input_x = Tensor(np.array([[1.0], [2.0], [4.0]]), mindspore.float32)
input_y = 3
_pow = ops.Pow()
_mean = ops.ReduceMean()
#out = _pow(input_x, input_y)
out = _mean(input_x)


print(out)
print(out.dtype)

 

运行结果:

mindspore.ops.Pow()等算子不能处理float64类型的数据

 

 

 

 

如果把数据的类型该为float64, 则报错:

 

input_x = Tensor(np.array([[1.0], [2.0], [4.0]]), mindspore.float64)

 

代码:

mindspore.ops.Pow()等算子不能处理float64类型的数据
import mindspore
from mindspore import Tensor
import mindspore.ops as ops
import numpy as np
from mindspore import context

#context.set_context(mode=context.PYNATIVE_MODE, device_target=‘GPU‘)
context.set_context(mode=context.GRAPH_MODE, device_target=GPU)

input_x = Tensor(np.array([[1.0], [2.0], [4.0]]), mindspore.float64)
input_y = 3
_pow = ops.Pow()
_mean = ops.ReduceMean()
#out = _pow(input_x, input_y)
out = _mean(input_x)


print(out)
print(out.dtype)
View Code

 

 

系统提示:

mindspore.ops.Pow()等算子不能处理float64类型的数据

 

 

 

 

[ERROR] DEVICE(11003,python):2021-07-07-13:08:40.312.582 [mindspore/ccsrc/runtime/device/gpu/kernel_info_setter.cc:118] SelectAkgKernel] Not find op[ReduceMean] in akg
[ERROR] DEVICE(11003,python):2021-07-07-13:08:40.312.602 [mindspore/ccsrc/runtime/device/gpu/kernel_info_setter.cc:347] PrintUnsupportedTypeException] Select GPU kernel op[ReduceMean] fail! Incompatible data type!
The supported data types are in[float32], out[float32]; in[float16], out[float16]; , but get in [float64 ] out [float64 ]
Traceback (most recent call last):
  File "/home/devil/mindSpore_Projects/3.py", line 15, in <module>
    out = _mean(input_x)
  File "/home/devil/anaconda3/envs/mindspore/lib/python3.7/site-packages/mindspore/ops/operations/math_ops.py", line 331, in __call__
    output = _run_op(self, self.name, args)
  File "/home/devil/anaconda3/envs/mindspore/lib/python3.7/site-packages/mindspore/common/api.py", line 75, in wrapper
    results = fn(*arg, **kwargs)
  File "/home/devil/anaconda3/envs/mindspore/lib/python3.7/site-packages/mindspore/ops/primitive.py", line 559, in _run_op
    output = real_run_op(obj, op_name, args)
TypeError: mindspore/ccsrc/runtime/device/gpu/kernel_info_setter.cc:347 PrintUnsupportedTypeException] Select GPU kernel op[ReduceMean] fail! Incompatible data type!
The supported data types are in[float32], out[float32]; in[float16], out[float16]; , but get in [float64 ] out [float64 ]

 

mindspore.ops.Pow()等算子不能处理float64类型的数据

上一篇:[ARC117D] Miracle Tree


下一篇:nginx部署环境命令