forked from mindspore-Ecosystem/mindspore
!20400 Fix the invalid input data for the ReduceXXX Op.
Merge pull request !20400 from liqiliang/master
This commit is contained in:
commit
a993f5a46a
|
@ -79,6 +79,10 @@ template <typename T>
|
||||||
bool ReduceCPUKernel<T>::Launch(const std::vector<kernel::AddressPtr> &inputs, const std::vector<kernel::AddressPtr> &,
|
bool ReduceCPUKernel<T>::Launch(const std::vector<kernel::AddressPtr> &inputs, const std::vector<kernel::AddressPtr> &,
|
||||||
const std::vector<kernel::AddressPtr> &outputs) {
|
const std::vector<kernel::AddressPtr> &outputs) {
|
||||||
size_t input_size = inputs[0]->size / sizeof(T);
|
size_t input_size = inputs[0]->size / sizeof(T);
|
||||||
|
if (input_size == 0) {
|
||||||
|
MS_LOG(EXCEPTION) << "Input data size is 0.";
|
||||||
|
}
|
||||||
|
|
||||||
auto input_addr = reinterpret_cast<T *>(inputs[0]->addr);
|
auto input_addr = reinterpret_cast<T *>(inputs[0]->addr);
|
||||||
auto output_addr = reinterpret_cast<T *>(outputs[0]->addr);
|
auto output_addr = reinterpret_cast<T *>(outputs[0]->addr);
|
||||||
if (axis_.empty() || input_shape_.empty() || input_shape_.size() == 1) {
|
if (axis_.empty() || input_shape_.empty() || input_shape_.size() == 1) {
|
||||||
|
|
Loading…
Reference in New Issue