Skip to content

Commit

Permalink
add override mark (PaddlePaddle#312)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason <[email protected]>
  • Loading branch information
ChaoII and jiangjiajun authored Oct 7, 2022
1 parent 5c5debd commit 116265d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 10 deletions.
10 changes: 5 additions & 5 deletions fastdeploy/backends/ort/ort_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ class OrtBackend : public BaseBackend {
const OrtBackendOption& option = OrtBackendOption(),
bool from_memory_buffer = false);

bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs);
bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs) override;

int NumInputs() const { return inputs_desc_.size(); }
int NumInputs() const override { return inputs_desc_.size(); }

int NumOutputs() const { return outputs_desc_.size(); }
int NumOutputs() const override { return outputs_desc_.size(); }

TensorInfo GetInputInfo(int index);
TensorInfo GetOutputInfo(int index);
TensorInfo GetInputInfo(int index) override;
TensorInfo GetOutputInfo(int index) override;
std::vector<TensorInfo> GetInputInfos() override;
std::vector<TensorInfo> GetOutputInfos() override;
static std::vector<OrtCustomOp*> custom_operators_;
Expand Down
10 changes: 5 additions & 5 deletions fastdeploy/backends/paddle/paddle_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ class PaddleBackend : public BaseBackend {
const std::string& model_file, const std::string& params_file,
const PaddleBackendOption& option = PaddleBackendOption());

bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs);
bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs) override;

int NumInputs() const { return inputs_desc_.size(); }
int NumInputs() const override { return inputs_desc_.size(); }

int NumOutputs() const { return outputs_desc_.size(); }
int NumOutputs() const override { return outputs_desc_.size(); }

TensorInfo GetInputInfo(int index);
TensorInfo GetOutputInfo(int index);
TensorInfo GetInputInfo(int index) override;
TensorInfo GetOutputInfo(int index) override;
std::vector<TensorInfo> GetInputInfos() override;
std::vector<TensorInfo> GetOutputInfos() override;

Expand Down
51 changes: 51 additions & 0 deletions fastdeploy/core/fd_type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ std::string Str(const Device& d) {
return out;
}

std::ostream& operator<<(std::ostream& out,const Device& d){
switch (d) {
case Device::CPU:
out << "Device::CPU";
break;
case Device::GPU:
out << "Device::GPU";
break;
default:
out << "Device::UNKOWN";
}
return out;
}



std::string Str(const FDDataType& fdt) {
std::string out;
switch (fdt) {
Expand Down Expand Up @@ -95,6 +111,41 @@ std::string Str(const FDDataType& fdt) {
return out;
}

std::ostream& operator<<(std::ostream& out,const FDDataType& fdt){
switch (fdt) {
case FDDataType::BOOL:
out << "FDDataType::BOOL";
break;
case FDDataType::INT16:
out << "FDDataType::INT16";
break;
case FDDataType::INT32:
out << "FDDataType::INT32";
break;
case FDDataType::INT64:
out << "FDDataType::INT64";
break;
case FDDataType::FP32:
out << "FDDataType::FP32";
break;
case FDDataType::FP64:
out << "FDDataType::FP64";
break;
case FDDataType::FP16:
out << "FDDataType::FP16";
break;
case FDDataType::UINT8:
out << "FDDataType::UINT8";
break;
case FDDataType::INT8:
out << "FDDataType::INT8";
break;
default:
out << "FDDataType::UNKNOWN";
}
return out;
}

template <typename PlainType>
const FDDataType TypeToDataType<PlainType>::dtype = UNKNOWN1;

Expand Down
4 changes: 4 additions & 0 deletions fastdeploy/core/fd_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ enum FASTDEPLOY_DECL FDDataType {
INT8
};

FASTDEPLOY_DECL std::ostream& operator<<(std::ostream& out,const Device& d);

FASTDEPLOY_DECL std::ostream& operator<<(std::ostream& out,const FDDataType& fdt);

FASTDEPLOY_DECL std::string Str(const FDDataType& fdt);

FASTDEPLOY_DECL int32_t FDDataTypeSize(const FDDataType& data_dtype);
Expand Down

0 comments on commit 116265d

Please sign in to comment.