forked from mindspore-Ecosystem/mindspore
fix lite cv resize bilinear fuzz bug
This commit is contained in:
parent
d4e77ed507
commit
8a28ad1aa5
|
@ -379,6 +379,9 @@ bool ResizeBilinear(const LiteMat &src, LiteMat &dst, int dst_w, int dst_h) {
|
|||
}
|
||||
if (dst.IsEmpty()) {
|
||||
(void)dst.Init(dst_w, dst_h, src.channel_, LDataType::UINT8);
|
||||
if (dst.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
} else if (dst.height_ != dst_h || dst.width_ != dst_w || dst.channel_ != src.channel_) {
|
||||
return false;
|
||||
} else if (dst.data_type_ != LDataType::UINT8) {
|
||||
|
@ -965,10 +968,17 @@ bool Merge(const std::vector<LiteMat> &mv, LiteMat &dst) {
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool CheckInt(const std::vector<int> &nums) {
|
||||
if (std::any_of(nums.begin(), nums.end(), [](const auto &num) { return num < 0; })) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pad(const LiteMat &src, LiteMat &dst, int top, int bottom, int left, int right, PaddBorderType pad_type,
|
||||
uint8_t fill_b_or_gray, uint8_t fill_g, uint8_t fill_r) {
|
||||
RETURN_FALSE_IF_LITEMAT_EMPTY(src);
|
||||
if (top < 0 || bottom < 0 || left < 0 || right < 0) {
|
||||
if (!CheckInt({top, bottom, left, right})) {
|
||||
return false;
|
||||
}
|
||||
if (src.width_ > std::numeric_limits<int>::max() - left ||
|
||||
|
|
|
@ -364,7 +364,7 @@ class Dataset:
|
|||
|
||||
def notify_watchdog(self):
|
||||
"""
|
||||
Close watchdog thread in dataset. Now GeneratorDataset/map/batch will use a thread named watch_dog tp monitor
|
||||
Close watchdog thread in dataset. Now GeneratorDataset/map/batch will use a thread named watch_dog to monitor
|
||||
multiprocess, for get_dataset_size/output_shapes/output_types/get_col_name/num_classes, we need notify_watchdog
|
||||
to close watch_dog thread manually.
|
||||
"""
|
||||
|
|
|
@ -211,7 +211,7 @@ def test_resnet_thor_imagenet_8p():
|
|||
"""
|
||||
Feature: Resnet50 thor network
|
||||
Description: Train and evaluate resnet50 thor network on imagenet dataset
|
||||
Expectation: accuracy > 0.28, time cost < 22.
|
||||
Expectation: accuracy > 0.28, time cost < 25.
|
||||
"""
|
||||
context.set_context(enable_graph_kernel=False, enable_sparse=False)
|
||||
context.reset_auto_parallel_context()
|
||||
|
|
Loading…
Reference in New Issue