PIXELBANKv8.2.1
Menu

Create a Simple Neural Network Class

Problem Statement

Create a basic neural network class by subclassing nn.Module.

Background

In PyTorch, neural networks are defined by subclassing nn.Module. You define the layers in the constructor and specify how data flows through them in the forward method.

Your Task

Write a function create_simple_network() that defines a single-layer neural network (10 inputs → 5 outputs) and returns a dictionary describing the network.

Output Format

Return a dictionary with keys: "class_name" (string), "is_module" (boolean), "output_shape" (list — shape when given a single sample of 10 features).

Example:

Input:
None
Output:
{'class_name': 'SimpleNet', 'is_module': True, 'output_shape': [1, 5]}
Reasoning:

SimpleNet inherits from nn.Module with one Linear(10,5) layer

Constraints:

  • Must subclass nn.Module
  • Must call super().init() in init
  • Use nn.Linear(10, 5)
Editor

Test Results

0/0
Run code to see test results.