MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / FlopEstimator2D1DNotExact

Class FlopEstimator2D1DNotExact

datasets/bucket_config.py:166–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164
165
166class FlopEstimator2D1DNotExact(FlopEstimatorExact):
167 common_factor = 16 # this value should be at least 16
168 max_thw = 16934400 # 720 * 480 * 49
169 max_t = 49
170 max_hw = 1920 * 1920
171
172 def __init__(self, t, h, w, hw_value_arr: np.ndarray,
173 t_arr: np.ndarray) -> None:
174 self.size = self.net_size(t, h, w)
175 t, h, w = self.size
176 hw_idx = find_nearest_equal_or_smaller_value(
177 h * w, hw_value_arr, return_idx=True)
178 t_idx = find_nearest_equal_or_smaller_value(t, t_arr, return_idx=True)
179 self.size_not_exact = (t_idx, hw_idx)
180 self.thw = np.prod(self.size)
181
182 def __eq__(self, other) -> None:
183 return self.size_not_exact == other.size_not_exact
184
185 def __lt__(self, other) -> None:
186 return self.size_not_exact != other.size_not_exact and self.thw < other.thw
187
188 def __gt__(self, other) -> None:
189 return self.size_not_exact != other.size_not_exact and self.thw > other.thw
190
191 def __hash__(self, ):
192 return hash(self.size_not_exact)
193
194 def __str__(self) -> str:
195 return str(self.size)
196
197
198# class FlopEstimator3DNotExact(FlopEstimator2D1DNotExact):

Callers 2

__call__Method · 0.85
__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected