jina.types.ndarray.sparse.numpy¶
-
class
jina.types.ndarray.sparse.numpy.
SparseNdArray
(*args, **kwargs)[source]¶ Bases:
jina.types.ndarray.sparse.BaseSparseNdArray
Numpy powered sparse ndarray, it uses nonzero.
Note
This always take a dense
np.ndarray
and return anp.ndarray
. It only store nonzero data in sparse format, it does not keep a sparse representation in memory.- Parameters
proto – the protobuf message, when not given then create a new one via
get_null_proto()
-
sparse_constructor
(indices, values, shape)[source]¶ Sparse NdArray constructor, must be implemented by subclass
- Parameters
indices (
ndarray
) – the indices of the sparse arrayvalues (
ndarray
) – the values of the sparse arrayshape (
List
[int
]) – the shape of the dense array
- Return type
ndarray
- Returns