Hello.
I’ve trained a model in PyTorch using Dataset
and DataLoader
. Now, I need to use this trained model within CyIpopt, which relies on NumPy arrays for gradient-based optimization. Since PyTorch uses tensors, I have to constantly convert data between NumPy and PyTorch formats. Additionally, I’ve been using a DataLoader
for inference, assuming it’s necessary for accurate outputs.
However, repeatedly converting data types and creating a DataLoader
in every iteration is significantly slowing things down, making real-time implementation questionable. Is there a more efficient way to integrate the PyTorch model with CyIpopt to improve performance?