Spaces:
Running
Running
File size: 581 Bytes
35a4689 |
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 29 30 31 32 33 34 35 36 37 38 39 40 |
#!/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
|