mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-04 04:07:22 +00:00
static_typename (#4520)
* Use static_typename * Disable RTTI outside of Release * Fix unused var * Add test types * PR feedback
This commit is contained in:
parent
b43ce2d7ad
commit
2189c77e5b
2 changed files with 12 additions and 0 deletions
|
|
@ -432,8 +432,12 @@ struct SetMapTypes {
|
|||
TensorElementTypeSetter<K>::SetMapKeyType(proto);
|
||||
MLDataType dt = GetMLDataType<V, IsTensorContainedType<V>::value>::Get();
|
||||
const auto* value_proto = dt->GetTypeProto();
|
||||
#ifdef ORT_NO_RTTI
|
||||
ORT_ENFORCE(value_proto != nullptr, "expected a registered ONNX type");
|
||||
#else
|
||||
ORT_ENFORCE(value_proto != nullptr, typeid(V).name(),
|
||||
" expected to be a registered ONNX type");
|
||||
#endif
|
||||
CopyMutableMapValue(*value_proto, proto);
|
||||
}
|
||||
};
|
||||
|
|
@ -449,8 +453,12 @@ struct SetSequenceType {
|
|||
static void Set(ONNX_NAMESPACE::TypeProto& proto) {
|
||||
MLDataType dt = GetMLDataType<T, IsTensorContainedType<T>::value>::Get();
|
||||
const auto* elem_proto = dt->GetTypeProto();
|
||||
#ifdef ORT_NO_RTTI
|
||||
ORT_ENFORCE(elem_proto != nullptr, "expected a registered ONNX type");
|
||||
#else
|
||||
ORT_ENFORCE(elem_proto != nullptr, typeid(T).name(),
|
||||
" expected to be a registered ONNX type");
|
||||
#endif
|
||||
CopyMutableSeqElement(*elem_proto, proto);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -157,7 +157,11 @@ inline void CastFromStringData(const Tensor* in, Tensor* out, const TensorShape&
|
|||
mutable_data[i] = std::stoull(in->Data<std::string>()[i]);
|
||||
}
|
||||
} else {
|
||||
#ifdef ORT_NO_RTTI
|
||||
ORT_THROW("Unsupported type in cast op");
|
||||
#else
|
||||
ORT_THROW("Unsupported type in cast op: from String to ", typeid(DstType).name());
|
||||
#endif
|
||||
}
|
||||
} // namespace onnxruntime
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue