mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-03 23:49:44 +00:00
Add TensorShape noexcept for move ops and fix some warnings (#9802)
Add TensorShape noexcept for move ops and fix some warnings
This commit is contained in:
parent
8ef6aff734
commit
6284cbe833
9 changed files with 11 additions and 11 deletions
|
|
@ -26,8 +26,8 @@ class TensorShape {
|
|||
TensorShape(const TensorShape& other) : TensorShape(other.GetDims()) {}
|
||||
TensorShape& operator=(const TensorShape& other);
|
||||
|
||||
TensorShape(TensorShape&& other) { operator=(std::move(other)); }
|
||||
TensorShape& operator=(TensorShape&& other);
|
||||
TensorShape(TensorShape&& other) noexcept { operator=(std::move(other)); }
|
||||
TensorShape& operator=(TensorShape&& other) noexcept;
|
||||
|
||||
TensorShape(gsl::span<const int64_t> dims);
|
||||
TensorShape(const std::vector<int64_t>& dims) : TensorShape(gsl::make_span(dims)) {}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class ExecutionProviders {
|
|||
exec_provider_options_[provider_id] = p_exec_provider->GetProviderOptions();
|
||||
|
||||
exec_provider_ids_.push_back(provider_id);
|
||||
exec_providers_.push_back(std::move(p_exec_provider));
|
||||
exec_providers_.push_back(p_exec_provider);
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ TensorShape& TensorShape::operator=(const TensorShape& other) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
TensorShape& TensorShape::operator=(TensorShape&& other) {
|
||||
TensorShape& TensorShape::operator=(TensorShape&& other) noexcept {
|
||||
if (&other==this)
|
||||
return *this;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ inline int64_t ComputeOutputShape(const int64_t in_dim,
|
|||
const int64_t stride, const int64_t kernel, const int64_t dilation,
|
||||
const int64_t pad_head, const int64_t pad_tail) {
|
||||
const int64_t dkernel = dilation * (kernel - 1) + 1;
|
||||
return static_cast<int64_t>(static_cast<float>(in_dim + pad_head + pad_tail - dkernel) / stride + 1);
|
||||
return static_cast<int64_t>(static_cast<double>(in_dim + pad_head + pad_tail - dkernel) / stride + 1);
|
||||
}
|
||||
|
||||
inline Status ComputePadAndOutputShape(const int64_t in_dim,
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ constexpr size_t num_of_letters = 52;
|
|||
*/
|
||||
inline int64_t LetterToIndex(char ch) {
|
||||
if (ch >= 'a' && ch <= 'z') {
|
||||
return static_cast<int64_t>(ch - 'a');
|
||||
return static_cast<int64_t>(ch) - 'a';
|
||||
}
|
||||
|
||||
if (ch >= 'A' && ch <= 'Z') {
|
||||
return 26 + static_cast<int64_t>(ch - 'A');
|
||||
return 26 + static_cast<int64_t>(ch) - 'A';
|
||||
}
|
||||
|
||||
// invalid character - return error value
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ TensorShape& TensorShape::operator=(const TensorShape& other) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
TensorShape& TensorShape::operator=(TensorShape&& other) {
|
||||
TensorShape& TensorShape::operator=(TensorShape&& other) noexcept {
|
||||
g_host->TensorShape__operator_move_assign(this, std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ struct ProviderHost {
|
|||
|
||||
// TensorShape
|
||||
virtual void TensorShape__operator_assign(TensorShape* p, const TensorShape& other) = 0;
|
||||
virtual void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) = 0;
|
||||
virtual void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) noexcept = 0;
|
||||
virtual void TensorShape__Allocate(TensorShape* p, size_t size) = 0;
|
||||
virtual int64_t TensorShape__SizeHelper(const TensorShape* p, size_t start, size_t end) = 0;
|
||||
virtual std::string TensorShape__ToString(const TensorShape* p) = 0;
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ common::Status InferenceSession::RegisterExecutionProvider(const std::shared_ptr
|
|||
|
||||
p_exec_provider->SetLogger(session_logger_);
|
||||
session_profiler_.AddEpProfilers(p_exec_provider->GetProfiler());
|
||||
return execution_providers_.Add(provider_type, std::move(p_exec_provider));
|
||||
return execution_providers_.Add(provider_type, p_exec_provider);
|
||||
}
|
||||
|
||||
// Custom Op support
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ struct ProviderHostImpl : ProviderHost {
|
|||
|
||||
// TensorShape (direct)
|
||||
void TensorShape__operator_assign(TensorShape* p, const TensorShape& other) override { p->TensorShape::operator=(other); }
|
||||
void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) override { p->TensorShape::operator=(std::move(other)); }
|
||||
void TensorShape__operator_move_assign(TensorShape* p, TensorShape&& other) noexcept override { p->TensorShape::operator=(std::move(other)); }
|
||||
void TensorShape__Allocate(TensorShape* p, size_t size) override { p->TensorShape::Allocate(size); }
|
||||
int64_t TensorShape__SizeHelper(const TensorShape* p, size_t start, size_t end) override { return p->TensorShape::SizeHelper(start, end); }
|
||||
std::string TensorShape__ToString(const TensorShape* p) override { return p->TensorShape::ToString(); }
|
||||
|
|
|
|||
Loading…
Reference in a new issue