Spaces:
Running
Running
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import torch | |
import torch.nn as nn | |
inputs = torch.randn(size=(1, 1, 16000)) | |
conv1d = nn.Conv1d( | |
in_channels=1, | |
out_channels=1, | |
kernel_size=3, | |
stride=2, | |
padding=0, | |
dilation=1, | |
) | |
conv1dt = nn.ConvTranspose1d( | |
in_channels=1, | |
out_channels=1, | |
kernel_size=3, | |
stride=2, | |
padding=0, | |
output_padding=1, | |
dilation=1, | |
) | |
x = conv1d.forward(inputs) | |
print(x.shape) | |
x = conv1dt.forward(x) | |
print(x.shape) | |
print(x[:, :, 0]) | |
print(x[:, :, -2]) | |
print(x[:, :, -1]) | |
if __name__ == "__main__": | |
pass | |