How to use the redisai.utils.recursive_bytetransform function in redisai

To help you get started, we’ve selected a few redisai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RedisAI / redisai-py / redisai / client.py View on Github external
Returns
        -------
        List[List[AnyStr]]
            List of list of models and tags for each model if they existed

        Example
        -------
        >>> con.modelscan()
        [['pt_model', ''], ['m', 'v1.2']]
        """
        warnings.warn("Experimental: Model List API is experimental and might change "
                      "in the future without any notice", UserWarning)
        args = builder.modelscan()
        result = self.execute_command(*args)
        return utils.recursive_bytetransform(result, lambda x: x.decode())
github RedisAI / redisai-py / redisai / postprocessor.py View on Github external
def tensorget(res, as_numpy, meta_only):
        """Process the tensorget output.

        If ``as_numpy`` is True, it'll be converted to a numpy array. The required
        information such as datatype and shape must be in ``rai_result`` itself.
        """
        rai_result = utils.list2dict(res)
        if meta_only:
            return rai_result
        elif as_numpy is True:
            return utils.blob2numpy(rai_result['blob'], rai_result['shape'], rai_result['dtype'])
        else:
            target = float if rai_result['dtype'] in ('FLOAT', 'DOUBLE') else int
            utils.recursive_bytetransform(rai_result['values'], target)
            return rai_result
github RedisAI / redisai-py / redisai / postprocessor.py View on Github external
def modelget(res):
        resdict = utils.list2dict(res)
        utils.recursive_bytetransform(resdict['inputs'], lambda x: x.decode())
        utils.recursive_bytetransform(resdict['outputs'], lambda x: x.decode())
        return resdict
github RedisAI / redisai-py / redisai / postprocessor.py View on Github external
def scriptscan(res):
        return utils.recursive_bytetransform(res, lambda x: x.decode())