Skip to content

AffineCouplingLayer breaks under some shapes #1

@anshuln

Description

@anshuln

In the call_ function of the affine coupling layer
`
def call_(self, X):

	in_shape = tf.shape(X)
	n, h, w, c = X.shape

	for layer in self.layers: 
		X = layer.call(X) # residual 

	X = tf.reshape(X, (-1, h, w, c*2))
	s = X[:, :, w//2:, :]
	t = X[:, :, :w//2, :]  

	s = tf.reshape(s, in_shape)
	t = tf.reshape(t, in_shape)

	return s, t

Shouldn't s and t be X[:,:,:,c:] and X[:,:,:,:c] respectively?
My code-

`	data = np.random.normal(0,1,(1,6,6,4)).astype('f')
	a = FlowSequential()      #This is similar to a sequential model
	b = AffineCoupling(part=0)
	b.add(Conv2D(64, kernel_size=(3,3), activation="relu"))
	b.add(Flatten())
	b.add(Dense(50,activation='relu'))
	b.add(Dense(6*6*4,activation='relu'))
	a.add(Squeeze())
	a.add(b)
        a.call(data)
`

Gives the error
in call_ s = tf.reshape(s, in_shape) tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 96 values, but the requested shape has 72

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