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

Method bind

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

Source from the content-addressed store, hash-verified

232 return True
233
234 def bind(self, var_map, skip_check=SKIP_ENGINE_MODEL_CHECK):
235 if not (skip_check):
236 for source in var_map:
237 assert source in self.output_names
238 target = var_map[source]
239 assert target in self.input_names
240 assert match_shape(self.output_shapes[source], self.input_shapes[target])
241 assert match_dtype(self.output_dtypes[source], self.input_dtypes[target])
242
243 if not(self.extra_lock is None):
244 self.extra_lock.acquire()
245 self.ctx.push()
246 try:
247 for source in var_map:
248 target = var_map[source]
249 self.context.set_tensor_address(target, int(self.doutputs[source]))
250 except Exception as e:
251 traceback.print_exc()
252 self.ctx.pop()
253 if not(self.extra_lock is None):
254 self.extra_lock.release()
255 return False
256 self.ctx.pop()
257 if not(self.extra_lock is None):
258 self.extra_lock.release()
259 return True
260
261 def unlink(self):
262

Callers 1

thread_funcMethod · 0.80

Calls 2

match_shapeFunction · 0.85
match_dtypeFunction · 0.85

Tested by

no test coverage detected