Skip to content

Instantly share code, notes, and snippets.

View jinglescode's full-sized avatar
🎯
stay focus

Hong Jing (Jingles) jinglescode

🎯
stay focus
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
def generate_signal(length_seconds, sampling_rate, frequencies_list, func="sin", add_noise=0, plot=True):
r"""
Generate a `length_seconds` seconds signal at `sampling_rate` sampling rate. See torchsignal (https://github.com/jinglescode/torchsignal) for more info.
Args:
length_seconds : int
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=1, out_channels=1, kernel_size=1, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=1, out_channels=1, kernel_size=2, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=1, out_channels=1, kernel_size=3, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=1, out_channels=1, kernel_size=3, padding=1, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=1, out_channels=1, kernel_size=5, padding=2, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=1, out_channels=1, kernel_size=3, stride=3, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=1, out_channels=1, kernel_size=3, dilation=2, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):
class TestConv1d(nn.Module):
def __init__(self):
super(TestConv1d, self).__init__()
self.conv = nn.Conv1d(in_channels=2, out_channels=2, kernel_size=1, groups=2, bias=False)
self.init_weights()
def forward(self, x):
return self.conv(x)
def init_weights(self):