Deep-learning library Neon DataIterator / ArrayIterator init error - python

When trying to set up the DataIterator as explained on neon tutorial.
from neon.data import DataIterator
import numpy as np
X = np.random.rand(10000, 3072)
y = np.random.randint(1, 11, 10000)
train = DataIterator(X=X, y=y, nclass=10, lshape=(3, 32, 32))
I encountered a weird error:
ERROR:neon.data.dataiterator:DataIterator class has been deprecated and renamed"ArrayIterator" please use that name.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "neon/data/dataiterator.py", line 168, in __init__
super(DataIterator, self).__init__(*args, **kwargs)
File "neon/data/dataiterator.py", line 82, in __init__
self.Xdev = [self.be.array(x) for x in X]
AttributeError: 'NoneType' object has no attribute 'array'
I then tried with ArrayIterator, keeping X, y the same.
ArrayIterator(X=X, y=y, nclass=10, lshape=(3,32,32))
With the same NoneType error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "neon/data/dataiterator.py", line 82, in __init__
self.Xdev = [self.be.array(x) for x in X]
AttributeError: 'NoneType' object has no attribute 'array'
Why would this be the case? Is there an easy fix?

Fixed the problem by generating backend.
from neon.backends import gen_backend
be = gen_backend()
(...)

Related

'NoneType' object has no attribute 'eglGetCurrentContext'

I am having a problem with python and pyopengl
I am just importing the modules, and getting errors, I checked and pip did install opengl and everything.
Here is my code
# ulWindow
import ulMath as ulm
import OpenGL.GL as gl
import OpenGL.GlE as gle
import glfw
def init() ->int|str:
if (not glfw.init()):
return "GLFW Failed to initialize"
return 0
And the error im getting:
Traceback (most recent call last):
File "src/ulWindow.py", line 3, in <module>
import OpenGL.GL as gl
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/GL/__init__.py", line 4, in <module>
from OpenGL.GL.VERSION.GL_1_1 import *
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/GL/VERSION/GL_1_1.py", line 14, in <module>
from OpenGL.raw.GL.VERSION.GL_1_1 import *
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/raw/GL/VERSION/GL_1_1.py", line 7, in <module>
from OpenGL.raw.GL import _errors
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/raw/GL/_errors.py", line 4, in <module>
_error_checker = _ErrorChecker( _p, _p.GL.glGetError )
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/error.py", line 183, in __init__
self._isValid = platform.CurrentContextIsValid
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
value = self.fget( obj )
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 356, in CurrentContextIsValid
return self.GetCurrentContext
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
value = self.fget( obj )
File "/home/jack3/.local/lib/python3.8/site-packages/OpenGL/platform/egl.py", line 106, in GetCurrentContext
return self.EGL.eglGetCurrentContext
AttributeError: 'NoneType' object has no attribute 'eglGetCurrentContext'
I have absolutely no clue what is going on, can someone help me out?

How can I fix this Qo-DL-Reborn error i tried reinstalling python and the error continues?

Traceback (most recent call last):
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\qo-dl_reborn.py", line 21, in
client = qopy.Client()
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\qopy\qopy.py", line 16, in init
self.id, self.sec = self.cfg_setup(False)
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\qopy\qopy.py", line 163, in cfg_setup
id = spoofer.get_app_id()
File "F:\GAMES-MOVIE-VIDEO-MUSIC COLLECTION [OPTICAL-DIGITAL]\DIGITAL COPIES\QOBUZ MUSIC\Qo-DL-Reborn\spoofbuz.py", line 20, in get_app_id
return re.search(self.appId_regex, self.bundle).group("app_id")
AttributeError: 'NoneType' object has no attribute 'group'

data_format = value.lower(),error:'Tensor' object has no attribute 'lower'

I am fine-tuning a DCGAN. When I run this code:
tf.keras.layers.Flatten(
tf.abs(tf.multiply(self.mask, self.G) - tf.multiply(self.mask, self.images))), 1)
it turns out error:
Traceback (most recent call last):
File "train-dcgan.py", line 39, in <module>
is_crop=False, checkpoint_dir=FLAGS.checkpoint_dir)
File "E:\dcgan-completion.tensorflow-master\dcgan-completion.tensorflow-master\model.py", line 81, in __init__
self.build_model()
File "E:\dcgan-completion.tensorflow-master\dcgan-completion.tensorflow-master\model.py", line 137, in build_model
tf.abs(tf.multiply(self.mask, self.G) - tf.multiply(self.mask, self.images))), 1)
File "D:\anaconda\envs\labelme\lib\site-packages\tensorflow_core\python\keras\layers\core.py", line 588, in __init__
self.data_format = conv_utils.normalize_data_format(data_format)
File "D:\anaconda\envs\labelme\lib\site-packages\tensorflow_core\python\keras\utils\conv_utils.py", line 191, in normalize_data_format
data_format = value.lower()
AttributeError: 'Tensor' object has no attribute 'lower'
My tensorflow version is 2.1.0,but in this project,most of code use tensorflow 1.x,hope you can tell me the reason of error,thank you a lot!
Flatten layer should be
tf.keras.layers.Flatten()(tf.abs(tf.multiply(self.mask, self.G) - tf.multiply(self.mask, self.images))), 1)
For more details please refer here

'MatlabWorkSpace' object is not callable

eng = matlab.engine.start_matlab()
for line in matcode:
eng.workspace(line, nargout=0)
res = eng.workspace['x']
eng.quit()
and matcode.txt object string is
'x = [1 1;1 2;1 3;1 4];'
Couldn't figure out why is this happening :(
Traceback (most recent call last):
File "lreg.py", line 14, in <module>
main()
File "lreg.py", line 10, in main
data = matlab_engine.start_engine(code_object)
File "/Users/hiteshkr/PycharmProjects/MLCO/matlab_engine.py", line 7, in start_engine
eng.workspace(line, nargout=0)
TypeError: 'MatlabWorkSpace' object is not callable

TypeError: 'float' object is not callable error while calling a function

This is the code I currently have:
def uniform_distribution(users,radius):
user_coordinates_distance=[]
user_coordinates=[]
finding_shadowing=[]
r=radius*np.sqrt(np.random.uniform(0,1,users))
angle=2*np.pi*np.random.uniform(0,1,users)
x = r*np.cos(angle)
y = r*np.sin(angle)
user_distance = np.sqrt(x*x+y*y)
x_shadowing=1000*x
y_shadowing=1000*y
x_shadowing=(x_shadowing-x_shadowing%10)/10
y_shadowing=(y_shadowing-y_shadowing%10)/10
finding_shadowing=shadowing(x_shadowing,y_shadowing,shadowing_matrix)
print(finding_shadowing)
for i in range (0,users):
user_coordinates=[x[i],y[i],user_distance[i],finding_shadowing[i]]
user_coordinates_distance.append(user_coordinates)
return (user_coordinates_distance)
And this is the error I get when I run it:
Traceback (most recent call last):
File "C:\Users\Ajit\Desktop\maryland\Sem 2\ENTS 656\project656\main program and functions\main_1.py", line 136, in <module>
user_coordinates=uniform_distribution(attempts,cell_radius)#list [x,y,distance,shadowing]
File "C:\Users\Ajit\Desktop\maryland\Sem 2\ENTS 656\project656\main program and functions\main_1.py", line 81, in uniform_distribution
finding_shadowing=shadowing(x_shadowing,y_shadowing,shadowing_matrix)
TypeError: 'float' object is not callable
What exactly does this error mean?

Categories

Resources