メインコンテンツ

PyTorchExportedProgram

R2026b

PyTorch ExportedProgram モデル

R2026a 以降

    説明

    Add-On Required: この機能には MATLAB Coder Support Package for PyTorch and LiteRT Models アドオンが必要です。

    PyTorchExportedProgram オブジェクトを使用して、MATLAB® や Simulink® でモデルを実行したりコードを生成したりできます。

    作成

    loadPyTorchExportedProgram 関数を使用して PyTorchExportedProgram オブジェクトを作成します。

    プロパティ

    すべて展開する

    モデル パス。文字ベクトルとして指定します。

    関数名。文字ベクトルの cell 配列として指定します。

    オブジェクト関数

    summaryDisplay input and output specifications of PyTorch ExportedProgram or LiteRT model
    inputSpecificationsReturn input specifications for functions in PyTorch ExportedProgram or LiteRT model
    outputSpecificationsReturn output specifications for functions in PyTorch ExportedProgram or LiteRT model
    invokeRun inference on a PyTorch ExportedProgram or LiteRT model input to compute output

    例

    すべて折りたたむ

    1 つの入力を受け取り、1 つの出力を返す、siso.pt2 という名前の PyTorch ExportedProgram モデルがあるとします。PyTorchExportedProgram オブジェクトを作成します。

    myModel = loadPyTorchExportedProgram("siso.pt2")
    Loading the model. This may take a few minutes.
    
    myModel = 
      PyTorchExportedProgram contained in siso.pt2: 
    
                      Input Specifications               
        _________________________________________________
    
        Input    Name            Size              Type  
        _____    _____    ___________________    ________
                                                         
          1      "in1"    "1 x 3 x 128 x 128"    "single"
    
    
                     Output Specifications             
        _______________________________________________
    
        Output     Name          Size            Type  
        ______    ______    _______________    ________
                                                       
          1       "out1"    "1 x 8 x 2 x 1"    "single"
    
    
        properties: 
            ModelPath                         -      Path to the model file
            FcnNames                          -      Names of the functions in the model
        methods: 
            invoke                            -      Performs forward inference by invoking a function in the model
            inputSpecifications               -      Returns the input specifications of the model or of a specific function in the model
            outputSpecifications              -      Returns the output specifications of the model or of a specific function in the model
            summary                           -      Displays the input and output specifications of the model or of a specific function in the model
    
    

    拡張機能

    すべて展開する

    C/C++ コード生成
    MATLAB® Coder™ を使用して C および C++ コードを生成します。

    GPU コード生成
    GPU Coder™ を使用して NVIDIA® GPU のための CUDA® コードを生成します。

    バージョン履歴

    R2026a で導入