mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Some documentation updates. (#3060)
This commit is contained in:
parent
c033cfee92
commit
932ecaea34
4 changed files with 37 additions and 5 deletions
|
|
@ -3821,3 +3821,29 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
-----
|
||||
|
||||
dcleblanc/SafeInt
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
|
|||
|
|
@ -27,9 +27,12 @@ Other
|
|||
* Don't overuse std::shared\_ptr. Use std::shared\_ptr only if it's not clear when and where the object will be deallocated. See also: [https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-shared_ptr](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-shared_ptr)
|
||||
* Avoid using the 'long' type, which could be either 32 bits or 64 bits.
|
||||
* If there is a legitimate need to allocate objects on the heap, prefer using onnxruntime::make_unique(). References for the reasoning:
|
||||
* https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-make_unique
|
||||
* https://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/
|
||||
* https://abseil.io/tips/126
|
||||
* https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-make_unique
|
||||
* https://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/
|
||||
* https://abseil.io/tips/126
|
||||
* Use [SafeInt](https://github.com/dcleblanc/SafeInt) when calculating the size of memory to allocate to protect against overflow errors
|
||||
* `#include "core/common/safeint.h"`
|
||||
* search for `SafeInt<size_t>` in the code for examples
|
||||
|
||||
#### Clang-format
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,9 @@ using IAllocatorUniquePtr = std::unique_ptr<T, std::function<void(T*)>>;
|
|||
class IAllocator {
|
||||
public:
|
||||
virtual ~IAllocator() = default;
|
||||
/**
|
||||
@remarks Use SafeInt when calculating the size of memory to allocate using Alloc.
|
||||
*/
|
||||
virtual void* Alloc(size_t size) = 0;
|
||||
virtual void Free(void* p) = 0;
|
||||
virtual const OrtMemoryInfo& Info() const = 0;
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ class OpKernelContext {
|
|||
}
|
||||
|
||||
/**
|
||||
* return an allocator on device 0, with memtype of OrtMemTypeDefault
|
||||
*
|
||||
Return an allocator on device 0, with memtype of OrtMemTypeDefault.
|
||||
@remarks Use SafeInt when calculating the size of memory to allocate using AllocatorPtr->Alloc.
|
||||
*/
|
||||
Status GetTempSpaceAllocator(AllocatorPtr* output) const;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue