Support for tensorflow or keras? #37
Unanswered
xushanthu-2014
asked this question in
Q&A
Replies: 1 comment
-
Hi, For your Mac example, there is a mismatch between Python versions. There is For your import question, this should work: type(module_py) :: keras_models
ierror = import_py(keras_models, "keras.models")
! using load_module from keras.models
ierror = call_py(retval, keras_models, "load_model", args) Alternatively: type(module_py) :: keras_models
type(object) :: load_model
ierror = import_py(keras_models, "keras.models")
ierror = keras_models%getattribute(load_model, "load_model")
ierror = call_py(retval, load_model, args) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi I want to use
forpy
to import tensorflow or keras in one program. The code of fortran90 simply follows:Then I run the command
gfortran -c forpy_mod.F90
andgfortran intro_to_forpy.F90 forpy_mod.o `python3-config --ldflags --embed`
. The./a.out
showstensorflow imported return value -1
. When I rungfortran intro_to_forpy.F90 forpy_mod.o `python3-config --ldflags`
, it returns a long error message which ends withIn your code it was said that the value of
ierror
should be 0 if theimport py_module
is successful. And I also checked the python version on my machine. In my VS Code terminal, I ran following codes and got returned messages as following:But when I tried the same commands in
terminal
of my own Mac, it returned a different message:For the keras path, it's
So does that mean my
tensorflow
is installed on my anoconda andforpy
is not able to import it? I guess I need to do something to specify the python version? Thanks!(btw, if I want to write something in fortran using your forpy to
from keras.models import load_model
, how can I write that? do I need to firstly import tensorflow in fortran90 subroutine, then import models, finally import load_model? is there any way to simply it? Thanks!)Beta Was this translation helpful? Give feedback.
All reactions