[Functions] Add +-*/ operators and reshape for FDTensor (#655)

* Add +-*/ functions

* Add same dims test case for operations

* add broadcast 0

* Add broadcast dim2 testcase

* Add broadcast dim3 and dim4 testcase

* Add +-*/ operators

* Add mixed operation

* refresh code style

* Add reshape op

* update code style
This commit is contained in:
Jack Zhou
2022-11-23 11:34:02 +08:00
committed by GitHub
parent c11bfb8341
commit de98163efa
12 changed files with 1163 additions and 126 deletions

View File

@@ -13,6 +13,7 @@
// limitations under the License.
#include "fastdeploy/utils/utils.h"
#include <sstream>
namespace fastdeploy {
@@ -55,4 +56,14 @@ std::vector<int64_t> GetStride(const std::vector<int64_t>& dims) {
return result;
}
std::string Str(const std::vector<int64_t>& shape) {
std::ostringstream oss;
oss << "[ " << shape[0];
for (int i = 1; i < shape.size(); ++i) {
oss << " ," << shape[i];
}
oss << " ]";
return oss.str();
}
} // namespace fastdeploy