File tree Expand file tree Collapse file tree 4 files changed +26
-17
lines changed
neural_network/optimizers Expand file tree Collapse file tree 4 files changed +26
-17
lines changed Original file line number Diff line number Diff line change 1616from __future__ import annotations
1717
1818import math
19+ from typing import Any
1920
2021from .base_optimizer import BaseOptimizer
2122
@@ -120,12 +121,10 @@ def update(
120121 """
121122
122123 def _adagrad_update_recursive (
123- parameters : float | list [float | list [float ]],
124- gradients : float | list [float | list [float ]],
125- accumulated_gradients : float | list [float | list [float ]],
126- ) -> tuple [
127- float | list [float | list [float ]], float | list [float | list [float ]]
128- ]:
124+ parameters : Any ,
125+ gradients : Any ,
126+ accumulated_gradients : Any ,
127+ ) -> tuple [Any , Any ]:
129128 # Handle scalar case
130129 if isinstance (parameters , (int , float )):
131130 if not isinstance (gradients , (int , float )):
Original file line number Diff line number Diff line change 1515
1616from __future__ import annotations
1717
18+ from typing import Any
19+
1820from .base_optimizer import BaseOptimizer
1921
2022
@@ -115,12 +117,10 @@ def update(
115117 """
116118
117119 def _check_shapes_and_get_velocity (
118- parameters : float | list [float | list [float ]],
119- gradients : float | list [float | list [float ]],
120- velocity_values : float | list [float | list [float ]],
121- ) -> tuple [
122- float | list [float | list [float ]], float | list [float | list [float ]]
123- ]:
120+ parameters : Any ,
121+ gradients : Any ,
122+ velocity_values : Any ,
123+ ) -> tuple [Any , Any ]:
124124 # Handle scalar case
125125 if isinstance (parameters , (int , float )):
126126 if not isinstance (gradients , (int , float )):
Original file line number Diff line number Diff line change 1010
1111from __future__ import annotations
1212
13+ from typing import Any
14+
1315from .base_optimizer import BaseOptimizer
1416
1517
@@ -97,9 +99,9 @@ def update(
9799 """
98100
99101 def _check_and_update_recursive (
100- parameters : float | list [ float | list [ float ]] ,
101- gradients : float | list [ float | list [ float ]] ,
102- ) -> float | list [ float | list [ float ]] :
102+ parameters : Any ,
103+ gradients : Any ,
104+ ) -> Any :
103105 # Handle 1D case (list of floats)
104106 if isinstance (parameters , (int , float )):
105107 if not isinstance (gradients , (int , float )):
Original file line number Diff line number Diff line change 1919 print ("\n " .join (space_files ) + "\n " )
2020
2121if hyphen_files := [
22- file for file in filepaths if "-" in file and "/site-packages/" not in file
22+ file
23+ for file in filepaths
24+ if "-" in file
25+ and "/site-packages/" not in file
26+ and file != "get-pip.py" # Exclude standard pip installer
2327]:
2428 print (f"{ len (hyphen_files )} files contain hyphen characters:" )
2529 print ("\n " .join (hyphen_files ) + "\n " )
2630
27- if nodir_files := [file for file in filepaths if os .sep not in file ]:
31+ if nodir_files := [
32+ file
33+ for file in filepaths
34+ if os .sep not in file and file != "get-pip.py" # Exclude standard pip installer
35+ ]:
2836 print (f"{ len (nodir_files )} files are not in a directory:" )
2937 print ("\n " .join (nodir_files ) + "\n " )
3038
You can’t perform that action at this time.
0 commit comments