human
What is a the Python code you requested given the following:
I am working on the file "Seminar3/HW3_Modules.ipynb".
The first task is:
Sequential container
Define a forward and backward pass procedures.
Can you write Python code for it?
assistant
#Here is the Python code you requested.

class Sequential(Module):
    """
         This class implements a container, which processes `input` data sequentially. 
         
         `input` is processed by each module (layer) in self.modules consecutively.
         The resulting array is called `output`. 
    """
    
    def __init__ (self):
        super(Sequential, self).__init__()
        self.modules = []
        
    def add(self, module):
        """
        Adds a module to the container.
        """
        self.modules.append(module)
        self.inputs = []

    def updateOutput(self, input):
        """
        Basic workflow of FORWARD PASS:
        
            y_0    = module[0].forward(input)
            y_1    = module[1].forward(y_0)
            ...
            output = module[n-1].forward(y_{n-2})   
            
            
        Just write a little loop. 
        """
        self.inputs = []
        y = input
        for mod in self.modules:
            self.inputs.append(y)
            y = mod.forward(y)
        self.output = y
        return self.output

    def backward(self, input, gradOutput):
        """
        Workflow of BACKWARD PASS:
            
            g_{n-1} = module[n-1].backward(y_{n-2}, gradOutput)
            g_{n-2} = module[n-2].backward(y_{n-3}, g_{n-1})
            ...
            g_1 = module[1].backward(y_0, g_2)   
            gradInput = module[0].backward(input, g_1)   
             
             
        !!!
                
        To ech module you need to provide the input, module saw while forward pass, 
        it is used while computing gradients. 
        Make sure that the input for `i-th` layer the output of `module[i]` (just the same input as in forward pass) 
        and NOT `input` to this Sequential module. 
        
        !!!
        
        """
        
        g = gradOutput
        for mod, inp in zip(self.modules[::-1], self.inputs[::-1]):
            g = mod.backward(inp, g)
        
        self.gradInput = g
        return self.gradInput
      

    def...