clausal-torch
PyTorch predicates for Clausal Prolog.
Wraps PyTorch as Clausal Prolog predicates: tensors (creation, math,
shape operations, comparisons, conversions), nn module structure and
gradient utilities, nn.functional, probability distributions and
datasets.
Install
pip install clausal-torch
torch is pulled in as a dependency. Requires Python 3.13 or later.
Use
Import the predicates into a seam (.seam) module, as the package's own
tests do. A Clausal Prolog (.clausal) module reaches Python only through
the seam: put the imports in a .seam module and list it under
[tool.clausal] python_bridges in your project's pyproject.toml (see
Importing Prolog).
This test, from tests/fixtures/torch_comparison_tests.seam,
shows the shape of a call:
-import_from(torch, [tensor, eq, tensor_list])
test("eq element-wise") <- (
tensor([1.0, 2.0, 3.0], A),
tensor([1.0, 0.0, 3.0], B),
eq(A, B, C),
tensor_list(C, [True, False, True])
)
Documentation
- torch — PyTorch Tensor Operations
- torch_data — Datasets
- torch_distributions — Probability Distributions
- torch_functional — nn.functional
- torch_nn — Module Structure, Registries, and Gradient Utilities
License
MIT
Metadata
Release files for clausal-torch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clausal_torch-0.1.0.tar.gz | 28.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clausal_torch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.8 kB
Release files / clausal_torch-0.1.0.tar.gz
| Download URL | clausal_torch-0.1.0.tar.gz |
|---|---|
| Size | 28.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06eb1a6c1a0e2d9e4006bc3fd4864b80c536bfdf2d1e2bd0c94e889eec4dc8ee
|
|
BLAKE2b-256 checksum How to use checksums |
b9cccb0b3cca78f1f957fa2b01ebd745765a8f45d558079244b66653a42f90e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logRelease files / clausal_torch-0.1.0-py3-none-any.whl
| Download URL | clausal_torch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9c7fdda869a57b844ef07c676ffbf8c783addc6fa30f0b15852eebecd9e3bc5
|
|
BLAKE2b-256 checksum How to use checksums |
350edc47a08895622aaf9591adf94861e4c3ef2d679cd4391923cf21994f681f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency log