MCPcopy Index your code
hub / github.com/OpenPPL/ppq / create_block

Method create_block

ppq/quantization/algorithm/training.py:205–214  ·  view source on GitHub ↗
(self, sp: Operation, ep: Operation)

Source from the content-addressed store, hash-verified

203 self.initialize_depth()
204
205 def create_block(self, sp: Operation, ep: Operation) -> TrainableBlock:
206 if sp == ep: return TrainableBlock(sp=sp, ep=ep, rps=[sp])
207 rps = self.search_engine.opset_matching(
208 sp_expr = lambda x: x == sp,
209 rp_expr = lambda x, y: True,
210 ep_expr = lambda x: x == ep,
211 direction='down')
212 rps = [(self.op_orders.index(op), op) for op in rps]
213 rps = sorted(rps)
214 return TrainableBlock(sp=sp, ep=ep, rps=[op for _, op in rps])
215
216 def build(self, op: Operation, limit: int) -> TrainableBlock:
217 """子图分割算法, 这个算法将从指定节点出发, 构造一个满足定义的子图结构 Solving best block from given

Callers 1

buildMethod · 0.95

Calls 2

TrainableBlockClass · 0.85
opset_matchingMethod · 0.80

Tested by

no test coverage detected