File size: 825 Bytes
957e2dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import torch
import torch.nn as nn

from src.data import DataProperties

################################################################################
# Base class for differentiable audio-processing units
################################################################################


class Component(nn.Module):
    """

    Base class for differentiable audio-processing units

    """
    def __init__(self, compute_grad: bool = True):
        super().__init__()
        self.compute_grad = compute_grad

        # fetch persistent data properties
        self.sample_rate, self.scale, self.signal_length = DataProperties.get(
            'sample_rate',
            'scale',
            'signal_length'
        )

    def forward(self, x: torch.Tensor):
        raise NotImplementedError()