forked from mindspore-Ecosystem/mindspore
[CODE CHECK] clean some code check warnings
This commit is contained in:
parent
a057c988d6
commit
b4f2706a15
|
@ -16,7 +16,7 @@
|
|||
#ifndef MINDSPORE_INCLUDE_API_DATA_TYPE_H_
|
||||
#define MINDSPORE_INCLUDE_API_DATA_TYPE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace mindspore {
|
||||
enum class DataType : int {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "utils/profile.h"
|
||||
#include "mindspore/ccsrc/kernel/common_utils.h"
|
||||
#include "nnacl/fp32_grad/maxpool_grad_grad.h"
|
||||
#include "nnacl/errorcode.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace kernel {
|
||||
|
|
|
@ -60,7 +60,7 @@ int InitCalVec(size_t *in_strides, size_t *out_strides, size_t *pos, const size_
|
|||
for (size_t i = 0; i < input_shape_size; ++i) {
|
||||
in_strides[i] = 1;
|
||||
}
|
||||
for (int i = input_shape_size - 2; i >= 0; --i) {
|
||||
for (int i = (int)input_shape_size - 2; i >= 0; --i) {
|
||||
in_strides[i] = input_shape[i + 1] * in_strides[i + 1];
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ int InitCalVec(size_t *in_strides, size_t *out_strides, size_t *pos, const size_
|
|||
for (size_t i = 0; i < output_shape_size; ++i) {
|
||||
out_strides[i] = 1;
|
||||
}
|
||||
for (int i = output_shape_size - 2; i >= 0; --i) {
|
||||
for (int i = (int)output_shape_size - 2; i >= 0; --i) {
|
||||
out_strides[i] = output_shape[i + 1] * out_strides[i + 1];
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "nnacl/fp32_grad/maxpool_grad_grad.h"
|
||||
#include "nnacl/errorcode.h"
|
||||
|
||||
int MaxPoolGradGrad(const float *input, const float *grad, float *output, size_t start, size_t end,
|
||||
PoolingParameter *param) {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "nnacl/op_base.h"
|
||||
#include "nnacl/pooling_parameter.h"
|
||||
#include "nnacl/errorcode.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -106,6 +106,7 @@ int gather_d_compute(struct KernelBase *self) {
|
|||
KernelBase *CreateGatherD(OpParameter *param, TensorC *in, size_t insize, TensorC *out, size_t outsize, int data_type,
|
||||
FormatC format) {
|
||||
GatherDStru *gather_d = (GatherDStru *)malloc(sizeof(GatherDStru));
|
||||
NNACL_CHECK_NULL_RETURN_NULL(gather_d);
|
||||
gather_d->base.param = param;
|
||||
gather_d->base.in = in;
|
||||
gather_d->base.insize = insize;
|
||||
|
|
|
@ -173,6 +173,7 @@
|
|||
#define NNACL_CHECK_ZERO_RETURN(val)
|
||||
#define NNACL_CHECK_NULL_RETURN_ERR(ptr)
|
||||
#define NNACL_CHECK_NULL_RETURN_VOID(ptr)
|
||||
#define NNACL_CHECK_NULL_RETURN_NULL(ptr)
|
||||
#else
|
||||
// Check whether value is true, if not return 'errcode'
|
||||
#define MS_CHECK_TRUE_RET(value, errcode) \
|
||||
|
@ -288,6 +289,12 @@
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define NNACL_CHECK_NULL_RETURN_NULL(ptr) \
|
||||
do { \
|
||||
if ((ptr) == NULL) { \
|
||||
return NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
enum PrimType {
|
||||
|
|
Loading…
Reference in New Issue