Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Python3 Version #26

Closed
jmandivarapu1 opened this issue Dec 5, 2017 · 3 comments
Closed

Issues with Python3 Version #26

jmandivarapu1 opened this issue Dec 5, 2017 · 3 comments

Comments

@jmandivarapu1
Copy link

When i am trying to run with Python3 .I am facing lot of issues.
Fixed almost of them Except the error in plot.py file at Flush

Axis Error: axis -1 is out of bounds for array of dimension 0.

Can you kindly help with this?

def flush():
prints = []

for name, vals in _since_last_flush.items():
	prints.append("{}\t{}".format(name, np.mean(vals.values())))
	_since_beginning[name].update(vals)

	x_vals = np.sort(_since_beginning[name].keys())
	y_vals = [_since_beginning[name][x] for x in x_vals]

	plt.clf()
	plt.plot(x_vals, y_vals)
	plt.xlabel('iteration')
	plt.ylabel(name)
	plt.savefig(name.replace(' ', '_')+'.jpg')
@caogang
Copy link
Owner

caogang commented Dec 5, 2017

Which line did it raise the error "Axis Error: axis -1 is out of bounds for array of dimension 0"?

@jmandivarapu1
Copy link
Author

jmandivarapu1 commented Dec 5, 2017


def flush():
	prints = []
	for name, vals in _since_last_flush.items():
		prints.append("{}\t{}".format(name, np.mean(vals.values())))
		_since_beginning[name].update(vals)
		x_vals = np.sort(_since_beginning[name].keys())
		y_vals = [_since_beginning[name][x] for x in x_vals]
		plt.clf()
		plt.plot(x_vals, y_vals)
		plt.xlabel('iteration')
		plt.ylabel(name)
		plt.savefig(name.replace(' ', '_')+'.jpg')

First prints.append("{}\t{}".format(name, np.mean(vals.values()))) line thrown the error
Error: TypeError: unsupported operand type(s) for /: 'dict_values' and 'int'
Fix made:prints.append("{}\t{}".format(name, np.mean(list(vals.values()))))
Then the below two lines given the error

x_vals = np.sort(_since_beginning[name].keys())
y_vals = [_since_beginning[name][x] for x in x_vals]

Error:

line 845,in <module>
    lib.plot.flush()
  File "/Users/Jay/Documents/Andromeda/BitBucket_Networks/newnetworks/tflib/plot.py", line 28, in flush
    x_vals = np.sort(_since_beginning[name].keys())
  File "//anaconda/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 822, in sort
    a.sort(axis=axis, kind=kind, order=order)
numpy.core._internal.AxisError: axis-1 is out of bounds for array of dimension 0

these two lines in Flush function in plot.py

@neale
Copy link

neale commented Jan 28, 2018

you should make the same change that you did above.

x_vals = np.sort(_since_beginning[name].keys())

becomes

x_vals = np.sort(list(_since_beginning[name].keys()))

@caogang caogang closed this as completed Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants