human
I am working on the file "CMSIS/DSP/PythonWrapper/examples/kws_example/kws.ipynb".
The first task is:
To describe our compute graph, we need to describe the nodes which are used in this graph.
Each node is described by its inputs and outputs. For each IO, we define the data type and the number of samples read or written on the IO.
We need the following nodes in our system:
* A source to get audio samples from the Arduino PDM driver
* A Sink to generate the messages on the Arduino serial port
* A feature node to compute the feature for a given window (and pre-multipliying with the Hann window)
* A FIR node which is filtering all the features for one second of signal
* A KWS node which is doing the logistic regression
In addition to that we need sliding windows:
* Like in the Python code above we need a sliding window for audio
* After each recognition attempt on a segment of 1 second, we want to slide the recognition window by 0.5 seconds. It can be implemented with a sliding window on the features before the FIR
Can you write Python code for it?
 ... Give me a Python code to compute graph, we need to describe the nodes which are used in this graph?
assistant
#Here is Python code to compute graph, we need to describe the nodes which are used in this graph.

class Source(GenericSource):
    def __init__(self,name,inLength):
        GenericSource.__init__(self,name)
        q15Type=CType(Q15)
        self.addOutput("o",q15Type,inLength)

    @property
    def typeName(self):
        return "Source"
    
class Sink(GenericSink):
    def __init__(self,name,outLength):
        GenericSink.__init__(self,name)
        q15Type=CType(Q15)
        self.addInput("i",q15Type,outLength)

    @property
    def typeName(self):
        return "Sink"
    
class Feature(GenericNode):
    def __init__(self,name,inLength):
        GenericNode.__init__(self,name)

        q15Type=CType(Q15)
        self.addInput("i",q15Type,inLength)
        self.addOutput("o",q15Type,1)

    @property
    def typeName(self):
        return "Feature"
    
class FIR(GenericNode):
    def __init__(self,name,inLength,outLength):
        GenericNode.__init__(self,name)

        q15Type=CType(Q15)
        self.addInput("i",q15Type,inLength)
        self.addOutput("o",q15Type,outLength)

    @property
    def typeName(self):
        return "FIR"
    
class KWS(GenericNode):
    def __init__(self,name,inLength):
        GenericNode.__init__(self,name)

        q15Type=CType(Q15)
        self.addInput("i",q15Type,inLength)
        self.addOutput("o",q15Type,1)

    @property
    def typeName(self):
        return "KWS"