Class ModelLoader
Provides methods for loading models.
Inherited Members
Namespace: Unity.InferenceEngine
Assembly: Unity.InferenceEngine.dll
Syntax
[MovedFrom("Unity.Sentis")]
public static class ModelLoader
Methods
Load(Stream)
Loads a model that has been serialized to a stream.
Declaration
public static Model Load(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to load the serialized model from. |
Returns
| Type | Description |
|---|---|
| Model | The loaded |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the stream is null. |
| ArgumentException | Thrown when the stream is not readable. |
| EndOfStreamException | Thrown when the stream ends unexpectedly while reading model data. |
| InvalidOperationException | Thrown when the stream contains invalid format (invalid model description size, invalid weights chunk size). |
| Exception | Thrown when model description loading or weights loading fails. This can occur if the model was exported with an incompatible version or contains unsupported operators. |
Load(string)
Loads a model that has been serialized to disk.
Declaration
public static Model Load(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | The path of the binary serialized model |
Returns
| Type | Description |
|---|---|
| Model | The loaded |
Load(ModelAsset)
Converts a binary ModelAsset representation of a neural network to an object-oriented Model representation.
Declaration
public static Model Load(ModelAsset modelAsset)
Parameters
| Type | Name | Description |
|---|---|---|
| ModelAsset | modelAsset | The binary |
Returns
| Type | Description |
|---|---|
| Model | The loaded |