Ejemplo n.º 1
0
    def get_function(self, name, query_imports=False):
        """Get function from the module.

        Parameters
        ----------
        name : str
            The name of the function

        query_imports : bool
            Whether also query modules imported by this module.

        Returns
        -------
        f : tvm.runtime.PackedFunc
            The result function.
        """
        ret_handle = PackedFuncHandle()
        check_call(
            _LIB.TVMModGetFunction(
                self.handle, c_str(name), ctypes.c_int(query_imports), ctypes.byref(ret_handle)
            )
        )
        if not ret_handle.value:
            raise AttributeError("Module has no function '%s'" % name)
        return PackedFunc(ret_handle, False)
Ejemplo n.º 2
0
 def program_fpga(file_name):
     path = tvm.get_global_func("tvm.rpc.server.workpath")(file_name)
     load_vta_dll().VTAProgram(c_str(path))
     logging.info("Program FPGA with %s", file_name)