Type error in getting input dimension

In week 4 of the first assignment, I do not understand how to create the vectors for the input dimension.

I tried to create it using as following, but it is throwing type error.

Did you implement the combine_vectors function?

Update

I assume you have a problem with the torch.randn function. It takes a shape as the first argument and it should be a tuple. In your case it will be something like this:

x = torch.randn((n_samples, z_dim))
y = torch.randn((n_samples, n_classes))
combine_vectors(x, y)

Note that the shape (n_samples, z_dim) is surrounded by extra parentheses, which are nothing more than a tuple.

yes. I did implemented it

check my updated answer

after I use the updated one i get the following error.
n_samples is mnist_shape in this case right?

I guess this is because the mnist_shape is a tuple that represents a size of mnist images and you should pass a batch size instead. I assume the first value of mnist_shape is the batch size, so you can call the function as follows:

x = torch.randn((mnist_shape[0], z_dim))

It would be helpful if you post your code snippet and also print the shape of the parameters.

here is my code

the error

Could you please point me to the assignment as well as the line of code where the error occurs?

Maybe try directly as:

generator_input_dim = z_dim + n_classes # None
discriminator_im_chan = mnist_shape[0] + n_classes # None

The get_input_dimensions function should return exactly that — the input dimensions, i.e. two integers that represent the dimensionality of the conditional generator and the number of input channels to the discriminator.

You shouldn’t generate a random tensor with those dimensions, as that is not what the function is for.

As @pedrorohde mentioned the function is not asking you create tensors, it’s asking the dimensionality of the conditional generator and the number of input channels to the discriminator. If you read the description of function carefully you will able to figure out the right ans. You don’t need to create tensors with those dimensions.