Exemplo n.º 1
0
    def destroy(self):
        """
        release resource of model inference
        Args:
            null
        Returns:
            null
        """
        if self._is_destroyed:
            return

        self._release_dataset(self._output_dataset, free_memory=True)
        if self._model_id:
            ret = acl.mdl.unload(self._model_id)
            if ret != const.ACL_ERROR_NONE:
                log_info("acl.mdl.unload error:", ret)

        if self._model_desc:
            ret = acl.mdl.destroy_desc(self._model_desc)
            if ret != const.ACL_ERROR_NONE:
                log_info("acl.mdl.destroy_desc error:", ret)
       
        self._is_destroyed = True
        resource_list.unregister(self)
        log_info("Model release source success")
Exemplo n.º 2
0
    def destroy(self):
        """
        dvpp resource release
        """
        if self._is_destroyed:
            return

        if self._resize_config:
            acl.media.dvpp_destroy_resize_config(self._resize_config)

        if self._dvpp_channel_desc:
            acl.media.dvpp_destroy_channel(self._dvpp_channel_desc)
            acl.media.dvpp_destroy_channel_desc(self._dvpp_channel_desc)

        if self._jpege_config:
            acl.media.dvpp_destroy_jpege_config(self._jpege_config)
        self._is_destroyed = True
        resource_list.unregister(self)
        log_info("dvpp resource release success")