[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Integrating Pytave and Nnet
From: |
enricobertino |
Subject: |
Re: Integrating Pytave and Nnet |
Date: |
Fri, 31 Mar 2017 10:03:26 -0700 (PDT) |
Hi all,
I have some questions about how namespaces are treated in Pytave and how
modules are imported.
1) If I understand correctly, the global namespace is shared between pyexec
and pyeval. Local namespaces can also be used, defining python dictionaries
and passing them as arguments to the functions. For example I can run:
NS = pyeval ("{}");
pyexec ("import numpy as np", NS)
pyeval("np.sqrt(2)", NS)
and it works correctly. But what about pycall? The global namespace is
shared between pyexec and pycall? Because for example if I define a function
with pyexec as
pyexec (["import numpy as np\n" ...
"def squareroot(x):\n" ...
" s = np.sqrt(x)\n" ...
" return s"]);
than I can recall the function as
pycall ("squareroot", 4)
but I can not call
pycall ("np.sqrt", 4)
getting the error: "pycall: no such Python function or callable: np.sqrt"
Is there a reason for that?
2) Unfortunately, I am not able to import Tensorflow, that is the module
that should be used for the project. I tried to import several others
modules, both with pyexec ("import MODULE") and
pyeval("__import__('MODULE')") and everything was good. I also tried to
implement a basic nnet with an other neural networks module, Theano, and it
worked. But when I try
pyexec("import tensorflow")
I get two different errors, first time
error: pyexec: AttributeError: 'module' object has no attribute 'argv'
and second time
error: pyexec: ImportError: Traceback (most recent call last):
File
"/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line
61, in <module>
from tensorflow.python import pywrap_tensorflow
ImportError: cannot import name pywrap_tensorflow
that is a weird Tensorflow error. The Tensorflow package is correctly
installed as the others modules and I can use it normally in python. Any
idea on how this problem could be solved?
Thank you very much!
Enrico
Ps. I'm using Ubuntu 16.10, Octave 4.3.0+ installed from source and Python
2.7.12+
--
View this message in context:
http://octave.1599824.n4.nabble.com/Integrating-Pytave-and-Nnet-tp4682478p4682721.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.