Giter VIP home page Giter VIP logo

Comments (3)

caogang avatar caogang commented on June 15, 2024

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

from wgan-gp.

jmandivarapu1 avatar jmandivarapu1 commented on June 15, 2024

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

from wgan-gp.

neale avatar neale commented on June 15, 2024

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()))

from wgan-gp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.