Plot Prediciton model Structure
In [1]:
Copied!
import torch
import numpy as np
from ANN_models import PredictionModel, PredictionModel2, PredictionModel3, PredictionModel4, PredictionModel_single_SDS, PredictionModel5
import random
import os
import torch
import numpy as np
from ANN_models import PredictionModel, PredictionModel2, PredictionModel3, PredictionModel4, PredictionModel_single_SDS, PredictionModel5
import random
import os
In [2]:
Copied!
model = PredictionModel5(neuronsize=1).cuda()
# model = PredictionModel3().cuda()
# Get cpu or gpu device for training.
device = "cuda" if torch.cuda.is_available() else "cpu"
# Model visualization
input_names = ['spectrum']
output_names = ['\u0394SO2']
tensor_input = np.array([random.random() for i in range(800)])
tensor_input = torch.tensor(tensor_input)
tensor_input = tensor_input.to(torch.float32).to(device)
torch.onnx.export(model, tensor_input, os.path.join('pic', 'prediction_model5_neuronsize_1.onnx'), input_names=input_names, output_names=output_names)
model = PredictionModel5(neuronsize=1).cuda()
# model = PredictionModel3().cuda()
# Get cpu or gpu device for training.
device = "cuda" if torch.cuda.is_available() else "cpu"
# Model visualization
input_names = ['spectrum']
output_names = ['\u0394SO2']
tensor_input = np.array([random.random() for i in range(800)])
tensor_input = torch.tensor(tensor_input)
tensor_input = tensor_input.to(torch.float32).to(device)
torch.onnx.export(model, tensor_input, os.path.join('pic', 'prediction_model5_neuronsize_1.onnx'), input_names=input_names, output_names=output_names)
============= Diagnostic Run torch.onnx.export version 2.0.0+cu117 ============= verbose: False, log level: Level.ERROR ======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================