Click4Ai

453.

Hard

GAN Discriminator

======================

**Problem:** Implement a basic GAN discriminator using a neural network. The discriminator should take a 2D input (batch of images) and output a probability of the input being real.

Constraints:

  • Use NumPy for array operations.
  • Use a simple neural network architecture (e.g., fully connected layers).
  • Example:

    Suppose we have a batch of 10 images, each with a size of 28x28. The discriminator should output a probability of each image being real.

    Test Cases

    Test Case 1
    Input: [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]]
    Expected: [[0.5]]
    Test Case 2
    Input: [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28], [29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]]
    Expected: [[0.5], [0.5]]
    + 3 hidden test cases