-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Autoscan] add 0D-tensor test for CPU #10214
Conversation
Thanks for your contribution! |
CMakeLists.txt
Outdated
@@ -74,6 +74,7 @@ lite_option(LITE_ON_TINY_PUBLISH "Publish tiny predictor lib." | |||
lite_option(LITE_ON_MODEL_OPTIMIZE_TOOL "Build the model optimize tool" OFF) | |||
lite_option(LITE_WITH_BENCHMARK_TEST "Build benchmark test cases" OFF) | |||
lite_option(LITE_THREAD_POOL "Enable thread pool in lite" OFF) | |||
lite_option(LITE_BLOCK_0DIM_PASS "Block support_0_dim_tensor_pass" OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LITE_SKIP_SUPPORT_0_DIM_TENSOR_PASS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
cmake/configure.cmake
Outdated
@@ -263,3 +263,7 @@ if (EMSCRIPTEN) | |||
add_compile_options("-pthread") | |||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") | |||
endif() | |||
|
|||
if(LITE_BLOCK_0DIM_PASS) | |||
add_definitions("-DLITE_BLOCK_0DIM_PASS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -60,6 +60,15 @@ bool naive_not<bool>(bool a) { | |||
return !a; | |||
} | |||
|
|||
#define PROCESS_0D \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个有点 trick,能直接改 GenBatchElementWiseArg 吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这位置我最开始也是想改 GenBatchElementWiseArg。。。但是改完发现有内存错误,所以想先绕过这块,等之后再修复可以吗
lite/operators/gaussian_random_op.cc
Outdated
if (param_.ShapeTensor == nullptr && param_.ShapeTensorList.empty()) { | ||
CHECK(param_.shape.size() > 0) | ||
<< "Attribute(shape) of GaussRandomOp must be set and shape.size() > 0"; | ||
if (param_.ShapeTensor == nullptr && param_.ShapeTensorList.empty() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是不是可以直接删除?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -102,6 +103,9 @@ | |||
args = parser.parse_args() | |||
|
|||
logging.basicConfig(level=logging.INFO, format="%(message)s") | |||
logg = logging.getLogger(__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用logger 或 log 会不会更好?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
from functools import partial | ||
|
||
|
||
def check_broadcast(x_shape, y_shape, axis): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是可以抽出来作为公共模块?我理解大部分eltwise 类算子都需要使用的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个确实可以复用,但应该放哪个文件里,就一个函数新建个文件是不是有点浪费
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(axes) == 0 or len(in_shape) <= 1: | ||
return True | ||
|
||
self.add_ignore_check_case( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Don't have paddlepaddle, need install." | ||
fi | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
如讨论,GenBatchElementWiseArg 和 check_broadcast 在后面一个 PR 修复
PR devices
Arm/Host
PR types
New features
PR changes
OP
Description
(1)增加android/linux编译选项 block_0dim_pass=ON/OFF,用来判断是否开启support_0_dim_pass;
(2)为AutoScan单测增加0D测试case,同时增加 add_ignore_pass_case,目前只测Host/Arm CPU;
(3)修复部分算子不支持0D的问题;