![]() |
iVS3D v2.0.0
|
Abstract base class for neural networks. More...
#include <NeuralNet.h>
Public Member Functions | |
| virtual tl::expected< Tensor, NeuralError > | infer (const Tensor &input)=0 |
| Perform inference on the given input tensor. | |
| tl::expected< Tensor, NeuralError > | operator() (const Tensor &input) |
| Call the infer method with the given input tensor. | |
| virtual Shape | inputShape () const =0 |
| Get the input shape of the neural network. This might contain dynamic dimensions (e.g., -1 for batch size). | |
| virtual Shape | outputShape () const =0 |
| Get the output shape of the neural network. This might contain dynamic dimensions (e.g., -1 for batch size). | |
| virtual int | gpuId () const =0 |
| Get the GPU ID used by the neural network if it is configured to use GPU. | |
Abstract base class for neural networks.
This class defines the interface for neural networks, including methods for inference, input/output shape queries, and operator overloading for convenience.
|
pure virtual |
Get the GPU ID used by the neural network if it is configured to use GPU.
This method returns the ID of the GPU that the neural network uses for inference. If the neural network is not using GPU, it returns -1.
Implemented in NN::OrtNeuralNet.
|
pure virtual |
Perform inference on the given input tensor.
| input | The input tensor to the neural network. This tensor must have the correct shape and data type expected by the model. |
This method takes an input tensor, processes it through the neural network, and returns the output tensor. The input tensor must match the expected input shape of the model. If the input tensor is invalid or the inference fails, an error object is returned.
Implemented in NN::OrtNeuralNet.
|
pure virtual |
Get the input shape of the neural network. This might contain dynamic dimensions (e.g., -1 for batch size).
Implemented in NN::OrtNeuralNet.
|
inline |
Call the infer method with the given input tensor.
| input | The input tensor to the neural network. |
|
pure virtual |
Get the output shape of the neural network. This might contain dynamic dimensions (e.g., -1 for batch size).
Implemented in NN::OrtNeuralNet.