semvec/pypi-packages huggingface dataset:
WebHelpers2 2.1
WebHelpers2


**WebHelpers2** contains convenience functions to make HTML tags, process text,
format numbers, do basic statistics, work with collections, and more.
It's the successor to WebHelpers.

Version 2.1 fixes bugs and adds Python 3 support. The API and features are
unchanged since 2.0. This version is tested on Python 3.9, 3.10, 3.11, 3.12,
and 2.7.

The next version will drop Python 2 and older Python 3 versions. No new
helpers or API changes are expected. It will focus on updating the packaging
and documentation. It may delete some helpers that now have equivalents in
recent Python versions.

For support/questions/patches, please use the pylons-discuss_ mailing list.

.. _pylons-discuss: http://groups.google.com/group/pylons-discuss
semiring-torch 0.0.1
Semiring programming in PyTorch
Requires Python: >=3.8

# semiring_torch

Run your pytorch code on any semiring with a single line of code!
Semiring_torch is built on top of [autoray](https://github.com/jcmgray/autoray).

> Warning: this is a proof of concept. Expect bugs and missing features.

### Example

By using the logarithmic semiring, you can easily write numerically stable code. 
In the following example, we compute a matrix product in log-space.

<table>
<tr>
<th>Regular torch</th>
<th>semiring_torch</th>
</tr>
<tr>
<td>

```python
import torch

x1 = torch.tensor([[0.1, 0.6], [0.1, 0.4]])
x2 = torch.tensor([[0.5, 0.3], [0.2, 0.1]])
x1 = x1.log()
x2 = x2.log()
result = x1[:, :, None] + x2[None, :, :]
result = torch.logsumexp(result, dim=1)
result = result.exp()
```
</td>
<td>

```python
from autoray import numpy as torch
from semiring_torch import logarithmic_semiring

with logarithmic_semiring:
    x1 = torch.tensor([[0.1, 0.6], [0.1, 0.4]])
    x2 = torch.tensor([[0.5, 0.3], [0.2, 0.1]])
    result = x1 @ x2
```

</td>
</tr>
</table>

### Supported semirings
Currently only the logarithmic semiring is supported, but more semirings can be added easily.