Skip to main content

torch-sci

Test

Differentiable PyTorch functions to calculate scientific notation.

Installation

Bring your own PyTorch, then install this package:

pip install torch-sci

Usage

import torch

import torch_sci


x = torch.tensor(1234.0, requires_grad=True)
sig, exp = torch_sci.to_sci(x)
sig, exp
# => tensors: 1.234, 3.0

# some made up loss function, to test differentiability
loss = sig * exp
loss.backward()
assert x.grad != 0.0

torch_sci.from_sci(sig, exp)
# => tensor: 1234

# more test cases
torch_sci.to_sci(torch.tensor(-1234.0, requires_grad=True))
# => -1.234, 3
torch_sci.to_sci(torch.tensor(-0.1234, requires_grad=True))
# => -1.234, -1
torch_sci.to_sci(torch.tensor(0.0, requires_grad=True))
# => 0, -8 (common trick of + 1e-8 to avoid log 0)
torch_sci.to_sci(torch.tensor(0.1234, requires_grad=True))
# => 1.234, -1
torch_sci.to_sci(torch.tensor(1234.0, requires_grad=True))
# => 1.234, 3

Development

Setup

Install uv for dependency management if you haven't already. Then run:

# setup virtualenv
venv sync

Unit Tests

uv run pytest

Metadata

Release files for torch-sci 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-sci 1.0.0
File Size Uploaded Provenance Actions
torch_sci-1.0.0.tar.gz 83.2 kB Without provenance Details for torch_sci-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for torch-sci 1.0.0
File Interpreter ABI Platform Actions
torch_sci-1.0.0-py3-none-any.whl Python 3 none any Details for torch_sci-1.0.0-py3-none-any.whl

Total release size: 86.0 kB

Release files / torch_sci-1.0.0.tar.gz

Download URL torch_sci-1.0.0.tar.gz
Size 83.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b5aa493c89388088279566a4e0305d5b49cdedb5fac65416c34bbad40ecb7f56
BLAKE2b-256 checksum
How to use checksums
b7d8508d249c3e46905eb3fd02d40f88e33c232d166df52b1be425fc0e4e2307
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.9

Release files / torch_sci-1.0.0-py3-none-any.whl

Download URL torch_sci-1.0.0-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7467ffbeb3aac6ec9d9c0003f73583d33808dff2c401d51429eaa7fe5e01425a
BLAKE2b-256 checksum
How to use checksums
6a91ca8aae8f57fc0c7e7690da2ebea1d34e13ee871df254d224839c973fe9a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.9

Security for torch-sci 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page