Skip to content

Commit

Permalink
Merge pull request #2599 from wangzhaode/feature/bugfix_compile
Browse files Browse the repository at this point in the history
[Compile:Bugfix] Bugfix of action and compile.
  • Loading branch information
wangzhaode committed Sep 21, 2023
2 parents 38b7196 + 05a1623 commit 94e1212
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pymnn_macos.yml
Expand Up @@ -26,15 +26,15 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.8.10'
- name: prepare
run: |
pip3 install numpy opencv-python torch
- name: build
run: |
cd pymnn/pip_package
python3 build_deps.py
sudo python3 setup.py install --version 1.0
python3 setup.py install --version 1.0
- name: test
run: |
cd pymnn/test
Expand Down
4 changes: 3 additions & 1 deletion package_scripts/win/build_lib_release.ps1
Expand Up @@ -26,13 +26,15 @@ mkdir -p $PACKAGE_LIB_PATH

#clear and create package directory
powershell ./schema/generate.ps1
pushd $PACKAGE_LIB_PATH

if ($cibuild) {
pushd $PACKAGE_LIB_PATH
mkdir -p Release\Dynamic\MT
} else {
Remove-Item -Path $PACKAGE_PATH/include -Recurse -ErrorAction Ignore
cp -r include $PACKAGE_PATH
cp -r tools/cv/include/cv $PACKAGE_PATH/include
pushd $PACKAGE_LIB_PATH
mkdir -p Release\Dynamic\MT, Release\Dynamic\MD, Release\Static\MD, Release\Static\MT
}
popd
Expand Down
6 changes: 4 additions & 2 deletions pymnn/test/unit_test.py
Expand Up @@ -194,7 +194,7 @@ def test_greater_equal(self):
def test_less(self):
self.assertEqualVar(expr.less(self.x, self.x), np.less(self.x_, self.x_))
def test_floordiv(self):
self.assertEqualVar(expr.floordiv(self.x, self.x), np.floor_divide(self.x_, self.x_))
self.assertEqualVar(expr.floordiv(2.0, 1.2), np.floor_divide(2.0, 1.2))
def test_less(self):
self.assertEqualVar(expr.less(self.x, self.x), np.less(self.x_, self.x_))
def test_squared_difference(self):
Expand Down Expand Up @@ -784,7 +784,9 @@ def test_Structural(self):
rect = cv.minAreaRect(contour)
rect_ = cv2.minAreaRect(contour_)
if version_info.major >= 3:
self.assertEqual(rect, rect_)
rect_list = [rect[0][0], rect[0][1], rect[1][0], rect[1][0], rect[2]]
rect__list = [rect_[0][0], rect_[0][1], rect_[1][0], rect_[1][0], rect_[2]]
self.assertEqualArray(np.array(rect_list), np.array(rect__list))
points = cv.boxPoints(rect)
points_ = cv2.boxPoints(rect_)
if version_info.major >= 3:
Expand Down
1 change: 1 addition & 0 deletions source/backend/cuda/core/CUDABackend.cpp
Expand Up @@ -302,6 +302,7 @@ void CUDABackend::onResizeBegin() {
}

ErrorCode CUDABackend::onResizeEnd() {
return NO_ERROR;
}

void CUDABackend::onExecuteBegin() const {
Expand Down
2 changes: 2 additions & 0 deletions source/backend/opengl/GLBackend.hpp
Expand Up @@ -99,6 +99,8 @@ class GLBackend : public Backend {

virtual void onExecuteEnd() const override;

ErrorCode onResizeEnd() { return NO_ERROR; }

/// get execution
virtual Execution* onCreate(const std::vector<Tensor*>& inputs, const std::vector<Tensor*>& outputs,
const MNN::Op* op) override;
Expand Down
3 changes: 3 additions & 0 deletions source/core/Backend.cpp
Expand Up @@ -83,6 +83,9 @@ bool Backend::onAcquireBuffer(const Tensor* tensor, StorageType storageType) {
TensorUtils::getDescribe(tensor)->mem.reset(mem);
return true;
}
ErrorCode Backend::onResizeEnd() {
return NO_ERROR;
}
bool Backend::onReleaseBuffer(const Tensor* tensor, StorageType storageType) {
TensorUtils::getDescribe(tensor)->mem.reset(nullptr);
return true;
Expand Down
5 changes: 1 addition & 4 deletions source/core/Backend.hpp
Expand Up @@ -115,10 +115,7 @@ class Backend : public NonCopyable {
/**
* @brief callback after resize ops.
*/
virtual ErrorCode onResizeEnd() {
// nothing to do
return NO_ERROR;
}
virtual ErrorCode onResizeEnd();

/**
* @brief callback before executing ops.
Expand Down
3 changes: 3 additions & 0 deletions source/core/BufferAllocator.cpp
Expand Up @@ -72,6 +72,9 @@ class RecurseAllocator : public BufferAllocator::Allocator {
BufferAllocator* mParent;
};

ErrorCode BufferAllocator::compute() {
return NO_ERROR;
}
std::shared_ptr<BufferAllocator::Allocator> BufferAllocator::Allocator::createDefault() {
std::shared_ptr<BufferAllocator::Allocator> _res;
_res.reset(new DefaultAllocator);
Expand Down
2 changes: 1 addition & 1 deletion source/core/BufferAllocator.hpp
Expand Up @@ -98,7 +98,7 @@ class MNN_PUBLIC BufferAllocator : public NonCopyable {
virtual void beginGroup() {}
virtual void endGroup() {}
virtual void reset() {}
virtual ErrorCode compute() { return NO_ERROR; }
virtual ErrorCode compute();
};


Expand Down

0 comments on commit 94e1212

Please sign in to comment.