jina.types.ndarray.sparse.pytorch¶
-
class
jina.types.ndarray.sparse.pytorch.
SparseNdArray
(transpose_indices=True, *args, **kwargs)[source]¶ Bases:
jina.types.ndarray.sparse.BaseSparseNdArray
Pytorch powered sparse ndarray, i.e. FloatTensor
- Parameters
transpose_indices (
bool
) – in torch, the input to LongTensor is NOT a list of index tuples.
If you want to write your indices this way, you should transpose before passing them to the sparse constructor
Note
To comply with Tensorflow, transpose_indices is set to True by default
-
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 dense array
- Return type
FloatTensor
- Returns