Skip to main content

Python bindings for the Tensor-library

Project description

tensorx-python

Python bindings for the Tensor-library

  • C++20
  • CMake
  • Python3
  • pybind11
  • scikit-build-core

Example:

import tensorx
print(tensorx)

import tensorx._tensorx
print(tensorx._tensorx)

print("add_ints:", tensorx.add_ints(2, 3))

print("make_tensor:")
tensorx.make_tensor()

t0 = tensorx.Tensor()
print("t0.rank:", t0.rank, "t0.dims:", t0.dims, "t0.length:", t0.length)
print("t0:", t0)

s = tensorx.scalar(3.14)
print("s:", s)
print("s.rank:", s.rank, "s.dims:", s.dims, "s.length:", s.length)
print("s.get:", s.get())     # 3.14
s.set(2.71)
print("s.set(2.71)->s.get:", s.get())     # 2.71

t1 = tensorx.Tensor(2, (2, 3))
print("t1.rank:", t1.rank, "t1.dims:", t1.dims, "t1.length:", t1.length)
print("t1:", t1)

t2 = tensorx.Tensor(2, 3, 4)
print("t2.rank:", t2.rank, "t2.dims:", t2.dims, "t2.length:", t2.length)
print("t2:", t2)

v = tensorx.from_list([1, 2, 3])
print("v:", v)

m = tensorx.from_list([
    [1,2,3],
    [4,5,6],
    [7,8,9]
])
print("m:", m)
print("m.rank:", m.rank, "m.dims:", m.dims, "m.length:", m.length)
print("m.get(1, 1):", m.get(1, 1))

Add Tensor-library:

git submodule add -b c++mappings git@github.com:alarxx/Tensor-library.git

Install Docker: Root:

apt install docker.io
sudo systemctl enable docker # autostart
sudo systemctl start docker
sudo systemctl status docker
sudo usermod -aG docker $USER

User:

su -c "sudo usermod -aG docker $USER"
newgrp docker
docker version
docker ps

apt install python3 python3-full python3-pip python3-venv
#sudo apt install python3.8
python3 --version
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --upgrade build
python -m pip install -U twine
python -m pip install -U cibuildwheel

Build with hatchling vs. scikit_build_core (CMake).

Generating distribution archives from pyproject.toml file with configuration metadata:

python -m build
  • .tar.gz - source distribution
  • .whl - built distribution

Try to install locally:

python -m pip install --force-reinstall dist/*.whl
  • --force-reinstall - if version didn't change

Uninstall local tensorx-python:

python -m pip uninstall tensorx-python

Inside tensorx/ should be shared libraries (.so)

unzip -l dist/*.whl

Cross-platform build:

cibuildwheel --output-dir dist

Upload to PyPI:

python -m twine upload dist/*

Разобраться с manylinux:

export CIBW_REPAIR_WHEEL_COMMAND_LINUX='LD_LIBRARY_PATH=/opt/opencv/lib64 auditwheel repair -w {dest_dir} {wheel}'


export CIBW_BEFORE_BUILD_LINUX='set -eux; find /opt/opencv -maxdepth 3 -type f -name "libopencv_core.so*" -o -name "libopencv_imgproc.so*" -o -name "libopencv_imgcodecs.so*" -o -name "libopencv_highgui.so*" || true; find /opt/opencv -maxdepth 3 -type d -print;'

export CIBW_SKIP="*-musllinux_*"

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tensorx_python-0.0.4-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tensorx_python-0.0.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tensorx_python-0.0.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tensorx_python-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tensorx_python-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tensorx_python-0.0.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tensorx_python-0.0.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file tensorx_python-0.0.4-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tensorx_python-0.0.4-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e1f1590e7bc1d25b3bc089fcbb8ee83a923f43468e54038506b9a4981f5469e4
MD5 82b81740711bbf245bb54c467be743df
BLAKE2b-256 be719363c4ab2b54a5a4a922b39afbb180e5fc9b428067248b4b215b64a11887

See more details on using hashes here.

File details

Details for the file tensorx_python-0.0.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tensorx_python-0.0.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 637a162ba8649021678666003858df91c4600e32ecaab4301e3ee4e069979615
MD5 f2de7d916111165094433db40dc158d8
BLAKE2b-256 8640c2d0962c57d72e9e3d0a4461cbb999ab6c0415a5b3743573403f89b6678a

See more details on using hashes here.

File details

Details for the file tensorx_python-0.0.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tensorx_python-0.0.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 19b052045ce266aad622d13f9079e1845a5af6685ca3a123605e11a7f8180861
MD5 ca5ce00d506977b9e2c102aa379cda98
BLAKE2b-256 d29559a0261142cb7ce5e41b900376c39997c217c91ea8bf9ec4685e9df9e864

See more details on using hashes here.

File details

Details for the file tensorx_python-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tensorx_python-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 973f8670e743f19064d59adefea2282fa8c8735bcd94e83f90adf24e35fab4f8
MD5 bdab6c0eb9031496ea07686c6ec43d3d
BLAKE2b-256 3992ddce9834ebe9a24d2e5891ed4671f89e137bc8133a032e31cd854d6061be

See more details on using hashes here.

File details

Details for the file tensorx_python-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tensorx_python-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c26148b6de29d5ea998ee9eb0e26c5604f90d14fd9a56dada9656bcb917ee39d
MD5 2083d774a99986b07ec3d64a8a0d8212
BLAKE2b-256 f14fba74dc581127c3e82540e9ae2f6a2c785e2cebc0a04906921b229c8ddec4

See more details on using hashes here.

File details

Details for the file tensorx_python-0.0.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tensorx_python-0.0.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 70d2836ebb8968de93146cbfff6633c8a8fcbe6bf8a714699af18e1eabfffdf3
MD5 cc3096fc278a596a90c788ce455b4f56
BLAKE2b-256 7fb2634c73d107ad1e03e92377a5d4ba7c3ca2778b4594b50fe07f48ebf9f481

See more details on using hashes here.

File details

Details for the file tensorx_python-0.0.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tensorx_python-0.0.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2d8dfe1f1d3e6fbe234de0b3085c18ebf8f166a4fab7e3fd704182e43af5de3f
MD5 f99255ab41bc3b178e43cb154bbdc74a
BLAKE2b-256 041aa65faa5fa53d4e8e064456ff2ac336d14fecffbed77ccae73dc41a29ad18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page