MCPcopy Index your code
hub / github.com/apache/tvm / registerObjectConstructor

Method registerObjectConstructor

web/src/runtime.ts:1745–1757  ·  view source on GitHub ↗

* Register an object constructor. * @param typeKey The name of the function. * @param func Function to be registered. * @param override Whether overwrite function in existing registry.

(
    typeKey: string,
    func: FObjectConstructor,
    override = false
  )

Source from the content-addressed store, hash-verified

1743 * @param override Whether overwrite function in existing registry.
1744 */
1745 registerObjectConstructor(
1746 typeKey: string,
1747 func: FObjectConstructor,
1748 override = false
1749 ): void {
1750 const typeIndex = this.typeKey2Index(typeKey);
1751 if (this.objFactory.has(typeIndex)) {
1752 if (!override) {
1753 throw new Error("Type " + typeKey + " already registered");
1754 }
1755 }
1756 this.objFactory.set(typeIndex, func);
1757 }
1758
1759 /**
1760 * Wrap a function obtained from tvm runtime as AsyncPackedFunc

Callers 1

Calls 2

typeKey2IndexMethod · 0.95
hasMethod · 0.80

Tested by

no test coverage detected