Skip to main content

some useful code

Project description

This is a project for later lazy work! Only support for python3, ☹️, but maybe you can try in python2

Install

命令行直接安装

pip install poros

从代码库安装

git clone https://github.com/diqiuzhuanzhuan/poros.git
cd poros
python setup install

Some code is created by myself, and some code is inspired by others, such as allennlp etc.

poros_chars

Provide a set of small functions

usage:

  • convert Chinese words into Arabic numbers:
from poros.poros_chars import chinese_to_arabic
>>> print(chinese_to_arabic.NumberAdapter.convert("四千三百万"))
43000000

poros_loss

Provide some loss functions, such as gravity loss, and dice loss usage:

from poros.poros_loss import GravityLoss
>>> gl = GravityLoss()
        # [1, 2]
>>> input_a = torch.tensor([[1.0, 1]], requires_grad=True)
>>> input_b = torch.tensor([[1.0, 1]], requires_grad=True)
>>> target = torch.tensor([[4.0]])
>>> output = gl(input_a, input_b, target)
>>> torch.testing.assert_close(output, target)

clustering

from poros.poros_cluster import *

Thanks

PyCharm, Mircosoft Visual Studio Code

Project details


Download files

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

Source Distribution

poros-0.0.73.tar.gz (41.9 kB view details)

Uploaded Source

Built Distribution

poros-0.0.73-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

Details for the file poros-0.0.73.tar.gz.

File metadata

  • Download URL: poros-0.0.73.tar.gz
  • Upload date:
  • Size: 41.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.65.0 CPython/3.7.6

File hashes

Hashes for poros-0.0.73.tar.gz
Algorithm Hash digest
SHA256 65809c773d020753fd7ba93a53257f787469edb86793de6fc5628182ce03ae6c
MD5 4db1c6d2af4cc921e0b3e1993381af35
BLAKE2b-256 a71b07fd0a7f450de4cdcd9567dd7771aa6ca755147e3791a94a7e4cb70eac12

See more details on using hashes here.

File details

Details for the file poros-0.0.73-py3-none-any.whl.

File metadata

  • Download URL: poros-0.0.73-py3-none-any.whl
  • Upload date:
  • Size: 51.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.65.0 CPython/3.7.6

File hashes

Hashes for poros-0.0.73-py3-none-any.whl
Algorithm Hash digest
SHA256 9461c8036f6f78193e3e05795eb969cd4de0658e2a33772d5c08d0cb0296c1c2
MD5 1ccc70d89bd0e091111633dbee25ee96
BLAKE2b-256 e437ca3d2900c4cba0ddfbe08c60f380f2456454873ba7797318dbb99ddafe06

See more details on using hashes here.

Supported by

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