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

super_gradients.common.decorators.html 16 KB

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
  1. <!DOCTYPE html>
  2. <html class="writer-html5" lang="en" >
  3. <head>
  4. <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>super_gradients.common.decorators package &mdash; SuperGradients 1.0 documentation</title>
  7. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  9. <link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
  10. <!--[if lt IE 9]>
  11. <script src="_static/js/html5shiv.min.js"></script>
  12. <![endif]-->
  13. <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
  14. <script src="_static/jquery.js"></script>
  15. <script src="_static/underscore.js"></script>
  16. <script src="_static/doctools.js"></script>
  17. <script src="_static/js/theme.js"></script>
  18. <link rel="index" title="Index" href="genindex.html" />
  19. <link rel="search" title="Search" href="search.html" />
  20. </head>
  21. <body class="wy-body-for-nav">
  22. <div class="wy-grid-for-nav">
  23. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  24. <div class="wy-side-scroll">
  25. <div class="wy-side-nav-search" >
  26. <a href="index.html" class="icon icon-home"> SuperGradients
  27. </a>
  28. <div role="search">
  29. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  30. <input type="text" name="q" placeholder="Search docs" />
  31. <input type="hidden" name="check_keywords" value="yes" />
  32. <input type="hidden" name="area" value="default" />
  33. </form>
  34. </div>
  35. </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
  36. <p class="caption"><span class="caption-text">Welcome To SuperGradients</span></p>
  37. <ul>
  38. <li class="toctree-l1"><a class="reference internal" href="welcome.html">Fill our 4-question quick survey! We will raffle free SuperGradients swag between those who will participate -&gt; Fill Survey</a></li>
  39. <li class="toctree-l1"><a class="reference internal" href="welcome.html#supergradients">SuperGradients</a></li>
  40. </ul>
  41. <p class="caption"><span class="caption-text">Technical Documentation</span></p>
  42. <ul>
  43. <li class="toctree-l1"><a class="reference internal" href="super_gradients.common.html">Common package</a></li>
  44. <li class="toctree-l1"><a class="reference internal" href="super_gradients.training.html">Training package</a></li>
  45. </ul>
  46. <p class="caption"><span class="caption-text">User Guide</span></p>
  47. <ul>
  48. <li class="toctree-l1"><a class="reference internal" href="user_guide.html">What is SuperGradients?</a></li>
  49. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#introducing-the-supergradients-library">Introducing the SuperGradients library</a></li>
  50. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#installation">Installation</a></li>
  51. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#integrating-your-training-code-complete-walkthrough">Integrating Your Training Code - Complete Walkthrough</a></li>
  52. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#training-parameters">Training Parameters</a></li>
  53. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#logs-and-checkpoints">Logs and Checkpoints</a></li>
  54. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#dataset-parameters">Dataset Parameters</a></li>
  55. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#network-architectures">Network Architectures</a></li>
  56. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#pretrained-models">Pretrained Models</a></li>
  57. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#how-to-reproduce-our-training-recipes">How To Reproduce Our Training Recipes</a></li>
  58. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#professional-tools-integration">Professional Tools Integration</a></li>
  59. <li class="toctree-l1"><a class="reference internal" href="user_guide.html#supergradients-faq">SuperGradients FAQ</a></li>
  60. </ul>
  61. </div>
  62. </div>
  63. </nav>
  64. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
  65. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  66. <a href="index.html">SuperGradients</a>
  67. </nav>
  68. <div class="wy-nav-content">
  69. <div class="rst-content">
  70. <div role="navigation" aria-label="Page navigation">
  71. <ul class="wy-breadcrumbs">
  72. <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
  73. <li>super_gradients.common.decorators package</li>
  74. <li class="wy-breadcrumbs-aside">
  75. <a href="_sources/super_gradients.common.decorators.rst.txt" rel="nofollow"> View page source</a>
  76. </li>
  77. </ul>
  78. <hr/>
  79. </div>
  80. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  81. <div itemprop="articleBody">
  82. <section id="super-gradients-common-decorators-package">
  83. <h1>super_gradients.common.decorators package<a class="headerlink" href="#super-gradients-common-decorators-package" title="Permalink to this headline"></a></h1>
  84. <section id="submodules">
  85. <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
  86. </section>
  87. <section id="module-super_gradients.common.decorators.deci_logger">
  88. <span id="super-gradients-common-decorators-deci-logger-module"></span><h2>super_gradients.common.decorators.deci_logger module<a class="headerlink" href="#module-super_gradients.common.decorators.deci_logger" title="Permalink to this headline"></a></h2>
  89. <dl class="py function">
  90. <dt class="sig sig-object py" id="super_gradients.common.decorators.deci_logger.deci_func_logger">
  91. <span class="sig-prename descclassname"><span class="pre">super_gradients.common.decorators.deci_logger.</span></span><span class="sig-name descname"><span class="pre">deci_func_logger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">_func</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">'abstract_decorator'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/super_gradients/common/decorators/deci_logger.html#deci_func_logger"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#super_gradients.common.decorators.deci_logger.deci_func_logger" title="Permalink to this definition"></a></dt>
  92. <dd><p>This decorator is used to wrap our functions with logs.
  93. It will log every enter and exit of the functon with the equivalent parameters as extras.
  94. It will also log exceptions that raises in the function.
  95. It will also log the exception time of the function.</p>
  96. <dl class="simple">
  97. <dt>How it works:`</dt><dd><p>First it will check if the decorator called with name keyword.
  98. If so it will return a new decorator that its logger is the name parameter.
  99. If not it will return a new decorator that its logger is the wrapped function name.
  100. Then the return decorator will return a new function that warps the original function with the new logs.
  101. For further understanding advise real-python “fancy decorators documentation”</p>
  102. </dd>
  103. </dl>
  104. <dl class="field-list simple">
  105. <dt class="field-odd">Parameters</dt>
  106. <dd class="field-odd"><ul class="simple">
  107. <li><p><strong>(</strong><strong>)</strong> (<em>name</em>) – used when called without name specify. dont pass it directly</p></li>
  108. <li><p><strong>(</strong><strong>)</strong> – The name of the logger to save logs by.</p></li>
  109. </ul>
  110. </dd>
  111. <dt class="field-even">Returns</dt>
  112. <dd class="field-even"><p>a decorator that wraps function with logs logic.</p>
  113. </dd>
  114. </dl>
  115. </dd></dl>
  116. <dl class="py function">
  117. <dt class="sig sig-object py" id="super_gradients.common.decorators.deci_logger.deci_class_logger">
  118. <span class="sig-prename descclassname"><span class="pre">super_gradients.common.decorators.deci_logger.</span></span><span class="sig-name descname"><span class="pre">deci_class_logger</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/super_gradients/common/decorators/deci_logger.html#deci_class_logger"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#super_gradients.common.decorators.deci_logger.deci_class_logger" title="Permalink to this definition"></a></dt>
  119. <dd><p>This decorator wraps every class method with deci_func_logger decorator.
  120. It works by checking if class method is callable and if so it will set a new decorated method as the same method name.</p>
  121. </dd></dl>
  122. </section>
  123. <section id="module-super_gradients.common.decorators.explicit_params_validator">
  124. <span id="super-gradients-common-decorators-explicit-params-validator-module"></span><h2>super_gradients.common.decorators.explicit_params_validator module<a class="headerlink" href="#module-super_gradients.common.decorators.explicit_params_validator" title="Permalink to this headline"></a></h2>
  125. <dl class="py function">
  126. <dt class="sig sig-object py" id="super_gradients.common.decorators.explicit_params_validator.explicit_params_validation">
  127. <span class="sig-prename descclassname"><span class="pre">super_gradients.common.decorators.explicit_params_validator.</span></span><span class="sig-name descname"><span class="pre">explicit_params_validation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Callable</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">validation_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">'None'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/super_gradients/common/decorators/explicit_params_validator.html#explicit_params_validation"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#super_gradients.common.decorators.explicit_params_validator.explicit_params_validation" title="Permalink to this definition"></a></dt>
  128. <dd></dd></dl>
  129. </section>
  130. <section id="module-super_gradients.common.decorators.singleton">
  131. <span id="super-gradients-common-decorators-singleton-module"></span><h2>super_gradients.common.decorators.singleton module<a class="headerlink" href="#module-super_gradients.common.decorators.singleton" title="Permalink to this headline"></a></h2>
  132. <dl class="py class">
  133. <dt class="sig sig-object py" id="super_gradients.common.decorators.singleton.SingletonMeta">
  134. <em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">super_gradients.common.decorators.singleton.</span></span><span class="sig-name descname"><span class="pre">SingletonMeta</span></span><a class="reference internal" href="_modules/super_gradients/common/decorators/singleton.html#SingletonMeta"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#super_gradients.common.decorators.singleton.SingletonMeta" title="Permalink to this definition"></a></dt>
  135. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code></p>
  136. <p>A Singleton meta class.
  137. A class that derives from this class will have only 1 instance of that type for the process.</p>
  138. </dd></dl>
  139. <dl class="py function">
  140. <dt class="sig sig-object py" id="super_gradients.common.decorators.singleton.singleton">
  141. <span class="sig-prename descclassname"><span class="pre">super_gradients.common.decorators.singleton.</span></span><span class="sig-name descname"><span class="pre">singleton</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/super_gradients/common/decorators/singleton.html#singleton"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#super_gradients.common.decorators.singleton.singleton" title="Permalink to this definition"></a></dt>
  142. <dd><p>A singleton decorator. Returns a wrapper objects. A call on that object
  143. returns a single instance object of decorated class. Use the __wrapped__
  144. attribute to access decorated class directly in unit tests</p>
  145. </dd></dl>
  146. </section>
  147. <section id="module-super_gradients.common.decorators">
  148. <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-super_gradients.common.decorators" title="Permalink to this headline"></a></h2>
  149. <dl class="py function">
  150. <dt class="sig sig-object py" id="super_gradients.common.decorators.explicit_params_validation">
  151. <span class="sig-prename descclassname"><span class="pre">super_gradients.common.decorators.</span></span><span class="sig-name descname"><span class="pre">explicit_params_validation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">function</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Callable</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">validation_type</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">'None'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/super_gradients/common/decorators/explicit_params_validator.html#explicit_params_validation"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#super_gradients.common.decorators.explicit_params_validation" title="Permalink to this definition"></a></dt>
  152. <dd></dd></dl>
  153. <dl class="py function">
  154. <dt class="sig sig-object py" id="super_gradients.common.decorators.singleton">
  155. <span class="sig-prename descclassname"><span class="pre">super_gradients.common.decorators.</span></span><span class="sig-name descname"><span class="pre">singleton</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/super_gradients/common/decorators/singleton.html#singleton"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#super_gradients.common.decorators.singleton" title="Permalink to this definition"></a></dt>
  156. <dd><p>A singleton decorator. Returns a wrapper objects. A call on that object
  157. returns a single instance object of decorated class. Use the __wrapped__
  158. attribute to access decorated class directly in unit tests</p>
  159. </dd></dl>
  160. </section>
  161. </section>
  162. </div>
  163. </div>
  164. <footer>
  165. <hr/>
  166. <div role="contentinfo">
  167. <p>&#169; Copyright 2021, SuperGradients team.</p>
  168. </div>
  169. Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
  170. <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
  171. provided by <a href="https://readthedocs.org">Read the Docs</a>.
  172. </footer>
  173. </div>
  174. </div>
  175. </section>
  176. </div>
  177. <script>
  178. jQuery(function () {
  179. SphinxRtdTheme.Navigation.enable(true);
  180. });
  181. </script>
  182. </body>
  183. </html>
Tip!

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

Comments

Loading...