visualtorch 0.2.2__tar.gz → 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
1
  MIT License
2
2
 
3
+ Copyright (c) 2020 Paul Gavrikov
4
+
3
5
  Copyright (c) 2024 Willy Fitra Hendria
4
6
 
5
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: visualtorch
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Architecture visualization of Torch models
5
5
  Home-page: https://github.com/willyfh/visualtorch
6
6
  Author: Willy Fitra Hendria
@@ -14,6 +14,7 @@ Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
+ Provides-Extra: dev
17
18
  License-File: LICENSE
18
19
 
19
20
  <div align="center">
@@ -49,11 +50,11 @@ See the [Usage Examples page](https://visualtorch.readthedocs.io/en/latest/usage
49
50
 
50
51
  ## Contributing
51
52
 
52
- Please feel free to send a pull request to contribute to this project.
53
+ Please feel free to send a pull request to contribute to this project by following this [guideline](https://github.com/willyfh/visualtorch/blob/main/CONTRIBUTING.md).
53
54
 
54
55
  ## License
55
56
 
56
- This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/update-readme/LICENSE).
57
+ This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/main/LICENSE).
57
58
 
58
59
  Originally, this project was based on the [visualkeras](https://github.com/paulgavrikov/visualkeras) (under the MIT license), with additional modifications inspired by [pytorchviz](https://github.com/szagoruyko/pytorchviz), and [pytorch-summary](https://github.com/sksq96/pytorch-summary), both of which are also licensed under the MIT license.
59
60
 
@@ -31,11 +31,11 @@ See the [Usage Examples page](https://visualtorch.readthedocs.io/en/latest/usage
31
31
 
32
32
  ## Contributing
33
33
 
34
- Please feel free to send a pull request to contribute to this project.
34
+ Please feel free to send a pull request to contribute to this project by following this [guideline](https://github.com/willyfh/visualtorch/blob/main/CONTRIBUTING.md).
35
35
 
36
36
  ## License
37
37
 
38
- This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/update-readme/LICENSE).
38
+ This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/main/LICENSE).
39
39
 
40
40
  Originally, this project was based on the [visualkeras](https://github.com/paulgavrikov/visualkeras) (under the MIT license), with additional modifications inspired by [pytorchviz](https://github.com/szagoruyko/pytorchviz), and [pytorch-summary](https://github.com/sksq96/pytorch-summary), both of which are also licensed under the MIT license.
41
41
 
@@ -11,9 +11,17 @@ file_path = Path("README.md")
11
11
  with file_path.open("r") as fh:
12
12
  long_description = fh.read()
13
13
 
14
+
15
+ def _read_requirements(file: str) -> list:
16
+ file_path = Path(file)
17
+ with file_path.open("r") as fh:
18
+ reqs = fh.read()
19
+ return reqs.strip().split("\n")
20
+
21
+
14
22
  setuptools.setup(
15
23
  name="visualtorch",
16
- version="0.2.2",
24
+ version="0.2.4",
17
25
  author="Willy Fitra Hendria",
18
26
  author_email="willyfitrahendria@gmail.com",
19
27
  description="Architecture visualization of Torch models",
@@ -29,12 +37,8 @@ setuptools.setup(
29
37
  "License :: OSI Approved :: MIT License",
30
38
  "Operating System :: OS Independent",
31
39
  ],
32
- install_requires=[
33
- "pillow>=10.0.0",
34
- "numpy>=1.18.1",
35
- "aggdraw>=1.3.11",
36
- "torch>=2.0.0",
37
- ],
40
+ install_requires=_read_requirements("requirements.txt"),
41
+ extras_require={"dev": _read_requirements("docs/requirements.txt") + _read_requirements("dev-requirements.txt")},
38
42
  python_requires=">=3.10",
39
43
  license="MIT",
40
44
  license_files=("LICENSE",),
@@ -1,5 +1,6 @@
1
1
  """Graph View module for pytorch model visualization."""
2
2
 
3
+ # Copyright (C) 2020 Paul Gavrikov
3
4
  # Copyright (C) 2024 Willy Fitra Hendria
4
5
  # SPDX-License-Identifier: MIT
5
6
 
@@ -168,7 +169,6 @@ def _draw_connector(
168
169
 
169
170
  def _retrieve_isbox_units(layer: torch.autograd.Function, show_neurons: bool) -> tuple[bool, int]:
170
171
  """Return the number of units and the flag whether to visualize using a box or not."""
171
- print("test: ", type(layer))
172
172
  is_box = True
173
173
  units = 1
174
174
  if show_neurons:
@@ -1,5 +1,6 @@
1
1
  """Layered View module for pytorch model visualization."""
2
2
 
3
+ # Copyright (C) 2020 Paul Gavrikov
3
4
  # Copyright (C) 2024 Willy Fitra Hendria
4
5
  # SPDX-License-Identifier: MIT
5
6
 
@@ -1,5 +1,6 @@
1
1
  """Layer Utils module for pytorch model visualization."""
2
2
 
3
+ # Copyright (C) 2020 Paul Gavrikov
3
4
  # Copyright (C) 2024 Willy Fitra Hendria
4
5
  # SPDX-License-Identifier: MIT
5
6
 
@@ -184,8 +185,13 @@ def register_hook(
184
185
  m_key = "%s-%i" % (class_name, module_idx + 1)
185
186
  layers[m_key] = OrderedDict()
186
187
  layers[m_key]["module"] = module
187
- if isinstance(out, list | tuple):
188
- layers[m_key]["output_shape"] = tuple((-1,) + o.size()[1:] for o in out)
188
+ if isinstance(out, tuple):
189
+ if hasattr(out[0], "size"):
190
+ layers[m_key]["output_shape"] = out[0].size()
191
+ else:
192
+ layers[m_key]["output_shape"] = tuple(o.size() for o in out if hasattr(o, "size"))
193
+ elif isinstance(out, list):
194
+ layers[m_key]["output_shape"] = tuple(o.size() for o in out if hasattr(o, "size"))
189
195
  else:
190
196
  layers[m_key]["output_shape"] = out.size()
191
197
 
@@ -1,5 +1,6 @@
1
1
  """Utils module for pytorch model visualization."""
2
2
 
3
+ # Copyright (C) 2020 Paul Gavrikov
3
4
  # Copyright (C) 2024 Willy Fitra Hendria
4
5
  # SPDX-License-Identifier: MIT
5
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: visualtorch
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Architecture visualization of Torch models
5
5
  Home-page: https://github.com/willyfh/visualtorch
6
6
  Author: Willy Fitra Hendria
@@ -14,6 +14,7 @@ Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
+ Provides-Extra: dev
17
18
  License-File: LICENSE
18
19
 
19
20
  <div align="center">
@@ -49,11 +50,11 @@ See the [Usage Examples page](https://visualtorch.readthedocs.io/en/latest/usage
49
50
 
50
51
  ## Contributing
51
52
 
52
- Please feel free to send a pull request to contribute to this project.
53
+ Please feel free to send a pull request to contribute to this project by following this [guideline](https://github.com/willyfh/visualtorch/blob/main/CONTRIBUTING.md).
53
54
 
54
55
  ## License
55
56
 
56
- This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/update-readme/LICENSE).
57
+ This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/main/LICENSE).
57
58
 
58
59
  Originally, this project was based on the [visualkeras](https://github.com/paulgavrikov/visualkeras) (under the MIT license), with additional modifications inspired by [pytorchviz](https://github.com/szagoruyko/pytorchviz), and [pytorch-summary](https://github.com/sksq96/pytorch-summary), both of which are also licensed under the MIT license.
59
60
 
@@ -0,0 +1,18 @@
1
+ pillow>=10.0.0
2
+ numpy>=1.18.1
3
+ aggdraw>=1.3.11
4
+ torch>=2.0.0
5
+
6
+ [dev]
7
+ myst-parser
8
+ nbsphinx
9
+ pandoc
10
+ sphinx<7.0
11
+ sphinx_autodoc_typehints
12
+ sphinx_book_theme
13
+ sphinx-copybutton
14
+ sphinx_design
15
+ sphinx_gallery
16
+ matplotlib
17
+ pre-commit
18
+ pytest
@@ -1,4 +0,0 @@
1
- pillow>=10.0.0
2
- numpy>=1.18.1
3
- aggdraw>=1.3.11
4
- torch>=2.0.0
File without changes
File without changes