Can Variable be converted to Tensor
Hello, I'm a newbie in Machine Learning.
I constructe a neural network using torch and I want Variable serve as neural network inputs.
my code:
model = nn.gen_nn()
model.load_state_dict(torch.load('NN.pt'), strict=True)
p = cvxpy.Variable(n)
V = model(p)
objective = cvxpy.Maximize(V)
constraints = []
prob = cvxpy.Problem(objective, constraints)
the issue is that Variable cannot convert to Tensor. Is my idea feasible?
Any help is great! thanks!
Unfortunately this isn't supported at the moment. There is no Intermediate Representation between cvxpy and torch currently, but it is something that the developers are planning to add soon.
Unfortunately this isn't supported at the moment. There is no Intermediate Representation between cvxpy and torch currently, but it is something that the developers are planning to add soon.
Thank you very much for your answer! To the best of your knowledge, can you tell me what tools can solve the maximum/minimum value of a neural network?
I am not too familiar with Neural Networks, sorry about that.
I would look deeper into torch features, it is possible that something similar exists.
With some little searching I found that the cost-functions of neural networks are generally not convex (see here).
Maybe you could look into cvxpylayers?