MCPcopy Create free account
hub / github.com/MatrixTeam-AI/RAIN / link

Method link

src/modeling/engine_model.py:206–232  ·  view source on GitHub ↗
(self, other, var_map, skip_check=SKIP_ENGINE_MODEL_CHECK)

Source from the content-addressed store, hash-verified

204 return r
205
206 def link(self, other, var_map, skip_check=SKIP_ENGINE_MODEL_CHECK):
207 assert self.device_int == other.device_int
208 if not (skip_check):
209 for source in var_map:
210 assert source in other.output_names
211 target = var_map[source]
212 assert target in self.input_names
213 assert match_shape(other.output_shapes[source], self.input_shapes[target])
214 assert match_dtype(other.output_dtypes[source], self.input_dtypes[target])
215
216 if not(self.extra_lock is None):
217 self.extra_lock.acquire()
218 self.ctx.push()
219 try:
220 for source in var_map:
221 target = var_map[source]
222 self.context.set_tensor_address(target, int(other.doutputs[source]))
223 except Exception as e:
224 traceback.print_exc()
225 self.ctx.pop()
226 if not(self.extra_lock is None):
227 self.extra_lock.release()
228 return False
229 self.ctx.pop()
230 if not(self.extra_lock is None):
231 self.extra_lock.release()
232 return True
233
234 def bind(self, var_map, skip_check=SKIP_ENGINE_MODEL_CHECK):
235 if not (skip_check):

Callers

nothing calls this directly

Calls 2

match_shapeFunction · 0.85
match_dtypeFunction · 0.85

Tested by

no test coverage detected