Loading...
Build a neural network using the nn.Sequential container.
nn.Sequential is a convenient container for building simple feed-forward networks. Modules are added in order, and each module's output is automatically passed as input to the next.
Write a function build_sequential_net(input_size, hidden_size, output_size) that builds a two-layer network with a ReLU activation between them and returns a dictionary describing it.
Return a dictionary with keys: "num_layers" (int), "output_shape" (list — shape for a single sample), "has_relu" (boolean).
input_size=784, hidden_size=128, output_size=10
{'num_layers': 3, 'output_shape': [1, 10], 'has_relu': True}3 modules: Linear, ReLU, Linear. Output is (1, 10)