Use the PyTorch Model Predict function block in the matlab2024a simulink module to import a neural network trained using pytorch.
Hi everyone, I am now going to use PyTorch Model Predict in matlab2024a,simulink to import the neural network trained in pytorch into simulink for robot dynamics control. My current environment configuration is: matlab2024a,conda environment python environment, interpreter version 3.9, pytorch version using the cpu version, the neural network has also been saved as cpu version.
Checking python at the matlab command line:
>>pyenv
ans =
PythonEnvironment – 属性:
Version: "3.9"
Executable: "C:Users64375.condaenvsconda_env_39python.exe"
Library: "C:Users64375.condaenvsconda_env_39python39.dll"
Home: "C:Users64375.condaenvsconda_env_39"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "21020"
ProcessName: "MATLAB"
Import the neural network policy_net_matlab.pth file in the simulink module following the official tutorial, using the function torch.load(). The input and output dimensions are set to match the network parameters. No pre-processing and post-processing functions are loaded. Because they are not used. Clicking Run reports the following error as shown in the image:Hi everyone, I am now going to use PyTorch Model Predict in matlab2024a,simulink to import the neural network trained in pytorch into simulink for robot dynamics control. My current environment configuration is: matlab2024a,conda environment python environment, interpreter version 3.9, pytorch version using the cpu version, the neural network has also been saved as cpu version.
Checking python at the matlab command line:
>>pyenv
ans =
PythonEnvironment – 属性:
Version: "3.9"
Executable: "C:Users64375.condaenvsconda_env_39python.exe"
Library: "C:Users64375.condaenvsconda_env_39python39.dll"
Home: "C:Users64375.condaenvsconda_env_39"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "21020"
ProcessName: "MATLAB"
Import the neural network policy_net_matlab.pth file in the simulink module following the official tutorial, using the function torch.load(). The input and output dimensions are set to match the network parameters. No pre-processing and post-processing functions are loaded. Because they are not used. Clicking Run reports the following error as shown in the image: Hi everyone, I am now going to use PyTorch Model Predict in matlab2024a,simulink to import the neural network trained in pytorch into simulink for robot dynamics control. My current environment configuration is: matlab2024a,conda environment python environment, interpreter version 3.9, pytorch version using the cpu version, the neural network has also been saved as cpu version.
Checking python at the matlab command line:
>>pyenv
ans =
PythonEnvironment – 属性:
Version: "3.9"
Executable: "C:Users64375.condaenvsconda_env_39python.exe"
Library: "C:Users64375.condaenvsconda_env_39python39.dll"
Home: "C:Users64375.condaenvsconda_env_39"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "21020"
ProcessName: "MATLAB"
Import the neural network policy_net_matlab.pth file in the simulink module following the official tutorial, using the function torch.load(). The input and output dimensions are set to match the network parameters. No pre-processing and post-processing functions are loaded. Because they are not used. Clicking Run reports the following error as shown in the image: python, simulink MATLAB Answers — New Questions