Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

FactorizationTest.py 917 B

You have to be logged in to leave a comment. Sign In
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
  1. import torch
  2. from torch import nn
  3. import sys
  4. sys.path.append("../")
  5. from TorchUtils.Core.ShapeChecker import check_shape
  6. from torchsummary import summary
  7. class Model5(nn.Module):
  8. def __init__(self):
  9. super(Model5, self).__init__()
  10. self.conv1 = nn.Conv2d(1, 1, kernel_size=5)
  11. def forward(self, x):
  12. return self.conv1(x)
  13. class Model3(nn.Module):
  14. def __init__(self):
  15. super(Model3, self).__init__()
  16. self.conv1 = nn.Conv2d(1, 1, kernel_size=3)
  17. self.conv2 = nn.Conv2d(1, 1, kernel_size=3)
  18. def forward(self, x):
  19. x = self.conv1(x)
  20. return self.conv2(x)
  21. if __name__ == "__main__":
  22. model5 = Model5().to("cpu")
  23. model3 = Model3().to("cpu")
  24. model = Model().to("cpu")
  25. input_shape = (1, 100, 100)
  26. summary(model5, input_shape)
  27. print("="*30)
  28. summary(model3, input_shape)
  29. print("="*30)
  30. summary(model, input_shape)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...