Skip to main content

tencat is a python package that offers functionality to slice sparse tensors

Project description

Tencat is a Python library that offers basic sparse tensor slicing capabilities.

Installation

Use the package manager pip to install tencat.

pip install tencat

Usage

Tencat implements the coordinate format in SparseTensor using a (N,d) ndarray as indices, a (N,) ndarray as values and an optional d length size tuple.

import tencat

nnz = 100 # Number of nonzero elements
ndim = 4 # Number of dimensions

indices = np.randint(100,(nnz,ndim)) # Create random indices
values = np.random.rand(nnz,) # create random elements

dense_shape = np.amax(indices,axis=0) + np.random.randint(5,size=(ndim,))

sparse_tc = tc.SparseTensor(indices,values,dense_shape)

sliced_tc = sparse_tc.slice((1,5,6,4),(3,2,10,5))

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tencat, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size tencat-0.2-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size tencat-0.2.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page