mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +08:00
[Functions] Add quantile function (#700)
* Add sort function * Add isfinite function * upgrade isinf isnan * Add Scalar to FDTensor * Add floor, ceil function * add cast functions * Update out_tmp * Update quantile * add gather scatter along axis * finish quantile function * Add quantile unittest * refresh code style for test source code * Add comments * Add full function * Add scalar to fd tensor * Add full unittest * Add functions headers * move fdtensor operators to fastdeploy namespace
This commit is contained in:
@@ -71,6 +71,22 @@ TEST(fastdeploy, exp_sqrt_round_log) {
|
||||
check_data(reinterpret_cast<const float*>(y.Data()), round_result.data(),
|
||||
round_result.size());
|
||||
|
||||
Ceil(x, &y);
|
||||
std::vector<float> ceil_result = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
|
||||
check_shape(y.shape, {2, 3, 4});
|
||||
check_data(reinterpret_cast<const float*>(y.Data()), ceil_result.data(),
|
||||
ceil_result.size());
|
||||
|
||||
Floor(x, &y);
|
||||
std::vector<float> floor_result = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
||||
check_shape(y.shape, {2, 3, 4});
|
||||
check_data(reinterpret_cast<const float*>(y.Data()), floor_result.data(),
|
||||
floor_result.size());
|
||||
|
||||
// Test Log function
|
||||
Log(x, &y);
|
||||
std::vector<float> log_result = {
|
||||
|
Reference in New Issue
Block a user