!6319 [MS][LITE][Develop] GPU ops fix warnning for divide zero

Merge pull request !6319 from pengyongrong/dongxu_fix_winograd
This commit is contained in:
mindspore-ci-bot 2020-09-16 14:06:54 +08:00 committed by Gitee
commit dccd231ff0
2 changed files with 3 additions and 2 deletions

View File

@ -31,7 +31,7 @@ __kernel void Scale_C_IMG(__read_only image2d_t input, __read_only image2d_t sca
__write_only image2d_t output, const int2 output_shape, const int C) { __write_only image2d_t output, const int2 output_shape, const int C) {
int X = get_global_id(0); int X = get_global_id(0);
int Y = get_global_id(1); int Y = get_global_id(1);
if (X >= output_shape.x || Y >= output_shape.y) { if (X >= output_shape.x || Y >= output_shape.y || C == 0) {
return; return;
} }

View File

@ -126,7 +126,8 @@ std::vector<T> MatrixMultiply(const T A[], const T B[], int M, int N, int K) {
template <typename SRC_T, typename DST_T> template <typename SRC_T, typename DST_T>
void ConvertConvWeight4DTo7D(void *src, void *dst, size_t CO, size_t KH, size_t KW, size_t CI, size_t OGroup = 1, void ConvertConvWeight4DTo7D(void *src, void *dst, size_t CO, size_t KH, size_t KW, size_t CI, size_t OGroup = 1,
size_t CI_TILE = 4, size_t CO_TILE = 4) { const size_t CI_TILE = 4, const size_t CO_TILE = 4) {
if (CO_TILE == 0 || CI_TILE == 0) return;
auto origin_weight = reinterpret_cast<SRC_T *>(src); auto origin_weight = reinterpret_cast<SRC_T *>(src);
auto packed_weight = reinterpret_cast<DST_T *>(dst); auto packed_weight = reinterpret_cast<DST_T *>(dst);
auto CI_SLICES = UP_DIV(CI, CI_TILE); auto CI_SLICES = UP_DIV(CI, CI_TILE);