mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-16 13:41:30 +08:00
[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:
7
fastdeploy/core/fd_tensor.h
Executable file → Normal file
7
fastdeploy/core/fd_tensor.h
Executable file → Normal file
@@ -57,9 +57,7 @@ struct FASTDEPLOY_DECL FDTensor {
|
||||
|
||||
void* Data();
|
||||
|
||||
bool IsShared() {
|
||||
return external_data_ptr != nullptr;
|
||||
}
|
||||
bool IsShared() { return external_data_ptr != nullptr; }
|
||||
|
||||
void StopSharing();
|
||||
|
||||
@@ -116,6 +114,7 @@ struct FASTDEPLOY_DECL FDTensor {
|
||||
const FDDataType& data_type, const std::string& tensor_name = "",
|
||||
const Device& new_device = Device::CPU);
|
||||
|
||||
bool Reshape(const std::vector<int64_t>& new_shape);
|
||||
// Debug function
|
||||
// Use this function to print shape, dtype, mean, max, min
|
||||
// prefix will also be printed as tag
|
||||
@@ -141,7 +140,7 @@ struct FASTDEPLOY_DECL FDTensor {
|
||||
|
||||
static void CopyBuffer(void* dst, const void* src, size_t nbytes,
|
||||
const Device& device = Device::CPU,
|
||||
bool is_pinned_memory = false);
|
||||
bool is_pinned_memory = false);
|
||||
};
|
||||
|
||||
} // namespace fastdeploy
|
||||
|
Reference in New Issue
Block a user