docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ONNXModelConverter

    ONNX model converter to Barracuda format.

    Inheritance
    object
    ONNXModelConverter
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Barracuda.ONNX
    Assembly: solution.dll
    Syntax
    public class ONNXModelConverter

    Constructors

    ONNXModelConverter(bool, bool, bool)

    Constructs ONNX model converter

    Declaration
    public ONNXModelConverter(bool optimizeModel, bool treatErrorsAsWarnings = false, bool forceArbitraryBatchSize = true)
    Parameters
    Type Name Description
    bool optimizeModel

    Enable/disable various model optimizations while importing model from ONNX format.

    bool treatErrorsAsWarnings

    Treat import errors as warnings.

    bool forceArbitraryBatchSize

    Repair model input batch size. Sometimes needed for ONNX models coming from PyTorch.

    Methods

    Convert(byte[])

    Convert ONNX model and return Barracuda Model object.

    Declaration
    public Model Convert(byte[] buffer)
    Parameters
    Type Name Description
    byte[] buffer

    Memory buffer containing ONNX model.

    Returns
    Type Description
    Model

    Barracuda Model object.

    Convert(string)

    Convert ONNX model and return Barracuda Model object.

    Declaration
    public Model Convert(string filePath)
    Parameters
    Type Name Description
    string filePath

    Location of the input ONNX model.

    Returns
    Type Description
    Model

    Barracuda Model object.

    Events

    ModelImported

    Model imported event

    Declaration
    public static event Action<object, Model> ModelImported
    Event Type
    Type Description
    Action<object, Model>
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)