How to use the redisai.constants.DType 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 / tensor.py View on Github external
def from_numpy(cls, *nparrs) -> 'BlobTensor':
        blobs = []
        for arr in nparrs:
            blobs.append(arr.data)
        dt = DType.__members__[str(nparrs[0].dtype)]
        return cls(dt, nparrs[0].shape, *blobs)
github RedisAI / redisai-py / redisai / tensor.py View on Github external
def _to_numpy_type(t):
        if isinstance(t, DType):
            t = t.value
        mm = {
            'FLOAT': 'float32',
            'DOUBLE': 'float64'
        }
        if t in mm:
            return mm[t]
        return t.lower()