jina.types.ndarray.sparse¶
-
class
jina.types.ndarray.sparse.
BaseSparseNdArray
(*args, **kwargs)[source]¶ Bases:
jina.types.ndarray.BaseNdArray
The base class for
SparseNdArray
.Do not use this class directly. Subclass should be used.
Set constructor method.
-
sparse_constructor
(indices, values, shape)[source]¶ Sparse NdArray constructor, must be implemented by subclass.
- Parameters
indices (np.ndarray) – the indices of the sparse array
values (np.ndarray) – the values of the sparse array
shape (
List
[int
]) – the shape of the sparse array
- Return type
~AnySparseNdArray
- Returns
Sparse NdArray
-
sparse_parser
(value)[source]¶ Parse a Sparse NdArray to indices, values and shape, must be implemented by subclass.
- Parameters
value (~AnySparseNdArray) – the sparse ndarray
- Return type
Dict
[str
,Union
[ForwardRef
,List
[int
]]]- Returns
a Dict with three entries {‘indices’: …, ‘values’:…, ‘shape’:…}
-
property
value
¶ Get the value of protobuf message in
SparseNdArray
.- Return type
~AnySparseNdArray
-