Code Monkey home page Code Monkey logo

Comments (4)

mmbrian avatar mmbrian commented on July 17, 2024

According to https://www.tensorflow.org/api_docs/python/tf/concat concatenation axis should be the second argument passed to tf,concat. so basically you need to fix lines 86 and 95 by switching the arguments.

from ac-gan.

VinniaKemala avatar VinniaKemala commented on July 17, 2024

Hi, I switched the arguments in lines 86 and 95
Line 86:
from: y_disc = tf.concat(0,[y, y * 0])
to: y_disc = tf.concat([y, y * 0], 0)

Line 95:
from: z = tf.concat(1, [z_cat.sg_one_hot(depth=cat_dim), z_con, z_rand])
to: z = tf.concat([z_cat.sg_one_hot(depth=cat_dim), z_con, z_rand], 1)

and this following error occurs:

Traceback (most recent call last):

File "", line 1, in
runfile('E:/ac-gan-master/train.py', wdir='E:/ac-gan-master')

File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)

File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "E:/ac-gan-master/train.py", line 103, in
gen = generator(z)

File "E:/ac-gan-master/train.py", line 34, in generator
.sg_dense(dim=1024, name='fc1')

File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\sugartensor\sg_main.py", line 249, in wrapper
mean, variance = tf.nn.moments(out, axes=range(len(out.get_shape()) - 1))

File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\ops\nn_impl.py", line 638, in moments
math_ops.reduce_mean(y, axes, keep_dims=True))

File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\ops\math_ops.py", line 1355, in reduce_mean
name=name)

File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\ops\gen_math_ops.py", line 1290, in _mean
keep_dims=keep_dims, name=name)

File "C:\Program Files\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 508, in apply_op
(input_name, err))

ValueError: Tried to convert 'reduction_indices' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 1) - got shape [1], but wanted [].

from ac-gan.

mitchelljy avatar mitchelljy commented on July 17, 2024

The complete fix to this problem is to switch the arguments on line 86 as mentioned above, and then replace line 95 with:

z = tf.concat(axis=1, values=[z_cat.sg_one_hot(depth=cat_dim), z_con, z_rand])

For some reason explicitly giving the arg names fixes it.

from ac-gan.

zhgao2020 avatar zhgao2020 commented on July 17, 2024

Hi, I met the same problem and solved it. The TensorFlow version mismatches SugarTensor here. You may try an earlier version of TensorFlow 1.7.
Also, you can modify the SugarTensor itself. Please go to sugartensor/sglogging.py, line 170 and line 176. You can delete the underscore before _scaler_summary and _histogram_summary and reinstall it.
image

from ac-gan.

Related Issues (11)

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.