Class OrtExternalAllocation
This class represents an arbitrary buffer of memory allocated and owned by the user. It can be either a CPU, GPU or other device memory that can be suitably represented by IntPtr. This is just a composite of the buffer related information. The memory is assumed to be pinned if necessary and usable immediately in the native code.
Inherited Members
Namespace: Microsoft.ML.OnnxRuntime
Assembly: Microsoft.ML.OnnxRuntime.dll
Syntax
[Obsolete("Create OrtValue over an arbitrary piece of memory and use it where appropriate.")]
public class OrtExternalAllocation
Constructors
| Improve this Doc View SourceOrtExternalAllocation(OrtMemoryInfo, long[], TensorElementType, nint, long)
Constructor
Declaration
public OrtExternalAllocation(OrtMemoryInfo memInfo, long[] shape, TensorElementType elementType, nint pointer, long sizeInBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| OrtMemoryInfo | memInfo | use to accurately describe a piece of memory that this is wrapping |
| long[] | shape | shape of this buffer |
| TensorElementType | elementType | element type |
| nint | pointer | the actual pointer to memory |
| long | sizeInBytes | size of the allocation in bytes |
Properties
| Improve this Doc View SourceElementType
Data type
Declaration
public TensorElementType ElementType { get; }
Property Value
| Type | Description |
|---|---|
| TensorElementType |
Info
OrtMemoryInfo
Declaration
public OrtMemoryInfo Info { get; }
Property Value
| Type | Description |
|---|---|
| OrtMemoryInfo |
Pointer
Actual memory ptr
Declaration
public nint Pointer { get; }
Property Value
| Type | Description |
|---|---|
| nint |
Shape
Shape
Declaration
public long[] Shape { get; }
Property Value
| Type | Description |
|---|---|
| long[] |
Size
Size of the allocation in bytes
Declaration
public long Size { get; }
Property Value
| Type | Description |
|---|---|
| long |