RedisAI/redisai-py

Smoothening tensor API

hhsecond opened this issue · 1 comments

This issue is the outcome of the discussion with @lantiga about smoothening the API to make it more intuitive. Here my thoughts about the design changes after going through the discussion points.

  • tensorset should accept numpy array or scalar values or python list as input. Having users wrapping them with Tensor seems like an avoidable step. We implicitly convert to Scalar tensor or BlobTensor but user doesn't have to know about it at all.
data = [1, 2, 3]
con.tensorset('a', np.array(data))
con.tensorset('b', data, shape=(1, 1, 3), dtype=np.float)
# dtype can be a string perhaps??
con.tensorset('c', data, shape=(1, 1, 3), dtype='float')
  • tensorget could take a keyword argument that decides whether it's a META call or a VALUE call or a BLOB call. So user would never get a redisai Tensor
meta = con.tensorget('name', meta_only=True)
data = con.tensorget('name')  # data -> np array
data = con.tensorget('name', as_type='VALUE')  # data -> python list

Addressing with #21