Skip to content

ValueError: Shape (16980, 50) must have rank 1 #2

@chenguilin

Description

@chenguilin

I have not changed your code, why there will be the following results? How to solve this problem?

Importing Data ...
Done.
Creating Tensorflow Variables...
Traceback (most recent call last):
File "./main.py", line 5, in
model.train()
File "/home/chen/Desktop/Collaborative-Denoising-Autoencoder-master/models/CDAE.py", line 85, in train
self.weight = self._init_variables(n_hidden)
File "/home/chen/Desktop/Collaborative-Denoising-Autoencoder-master/models/CDAE.py", line 269, in _init_variables
all_weights['W'] = [tf.Variable(W[i]) for i in xrange(self.n_items)]
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 167, in _SliceHelper
sliced = slice(tensor, indices, sizes)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 217, in slice
return gen_array_ops.slice(input, begin, size, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 1318, in _slice
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/op_def_library.py", line 655, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2156, in create_op
set_shapes_for_outputs(ret)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1612, in set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 865, in _SliceShape
input_shape.assert_has_rank(ndims)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_shape.py", line 605, in assert_has_rank
raise ValueError("Shape %s must have rank %d" % (self, rank))
ValueError: Shape (16980, 50) must have rank 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions