Hi,
currently I am trying to integrate some TensorFlow neural Networks into NGSolve models for nonlinear mechanics. Basically I want to remodel the
Nonlinear Elasticity Example
but instead of using some closed formula I want to use my trained Neural Network to compute the Potential (W) from the material deformation (The Green-Langrangian Deformation tensor E).
Now I figured I cannot use my Network directly to create a function, that NGSolve can compile, but instead I need to remodel my Network using the weight matrizes and activation functions. The problem I now have is the twofold:
I want to multiply a vector (lets say size 6) and a weight matrix (lets say size 6*32) to return a vector of size 32. The vector is a CoefficientFunction and the matrix is a (constant) numpy array. I tried using the python (numpy?) operator for matrix multiplication
The Operator used in the NGSolve example to create the right ChaucyGreen tensor
The numpy matrix multiplication method
and tensorproduct method
The NGSolve
method, all resulting in various errors.
I have attached my trial file
File Attachment:
File Name:
trials.py
File Size:3 KB
so you can better understand, what I want to do.
I hope you can give me some hints how to solve my problem.
Thanks a lot!!
Best,
Til