Smoothening tensor API
hhsecond opened this issue · 1 comments
hhsecond commented
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 acceptnumpy
array or scalar values or python list as input. Having users wrapping them withTensor
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 aMETA
call or aVALUE
call or aBLOB
call. So user would never get a redisaiTensor
meta = con.tensorget('name', meta_only=True)
data = con.tensorget('name') # data -> np array
data = con.tensorget('name', as_type='VALUE') # data -> python list