{"id":17800170,"url":"https://github.com/karenullrich/pytorch-binary-converter","last_synced_at":"2025-09-08T15:35:30.738Z","repository":{"id":87601863,"uuid":"192343910","full_name":"KarenUllrich/pytorch-binary-converter","owner":"KarenUllrich","description":"Turning float tensors to binary tensors according to IEEE-754 standard.","archived":false,"fork":false,"pushed_at":"2019-06-17T16:03:58.000Z","size":30,"stargazers_count":37,"open_issues_count":2,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-03T04:42:37.566Z","etag":null,"topics":["binary","floating-point","ieee-754","ieee754","pytorch"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KarenUllrich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-17T12:36:18.000Z","updated_at":"2025-04-28T13:12:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"84cb5144-808e-436e-9a40-0a5a2718303b","html_url":"https://github.com/KarenUllrich/pytorch-binary-converter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KarenUllrich/pytorch-binary-converter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarenUllrich%2Fpytorch-binary-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarenUllrich%2Fpytorch-binary-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarenUllrich%2Fpytorch-binary-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarenUllrich%2Fpytorch-binary-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KarenUllrich","download_url":"https://codeload.github.com/KarenUllrich/pytorch-binary-converter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarenUllrich%2Fpytorch-binary-converter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274207223,"owners_count":25241381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary","floating-point","ieee-754","ieee754","pytorch"],"created_at":"2024-10-27T12:15:30.509Z","updated_at":"2025-09-08T15:35:30.714Z","avatar_url":"https://github.com/KarenUllrich.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binary Converter\n\nThis is a tool to turn pytorch's floats into binary tensors and back.\nThis code converts tensors of floats or bits into the respective other.\nWe use the IEEE-754 guideline [1] to convert. The default for conversion are\nbased on 32 bit / single precision floats: 8 exponent bits and 23 mantissa bits.\nOther common formats are\n\n\n|num total bits    | precision   | exponent bits |  mantissa bits   |    bias |\n|------------|-------------------|-------------------|-------------------|-------------------|  \n|64 bits     |    double         |     11         |    52       |    1023|\n|    32 bits  |       single      |         8      |       23    |        127|\n|    16 bits  |       half         |        5       |      10     |        15|\n\n\n\n### Usage\n\nTo turn a float tensor into a binary one\n\n    from binary_converter import float2bit\n    binary_tensor = float2bit(float_tensor, num_e_bits=8, num_m_bits=23, bias=127.)\n\nTo turn a binary tensor into a float one\n\n    from binary_converter import bit2float\n    float_tensor = bit2float(binary_tensor, num_e_bits=8, num_m_bits=23, bias=127.)\n\n\n### Requirements\n\nThis code has been tested with\n-   `python 3.6`\n-   `pytorch 1.1.0`\n\n### Maintenance\n\nPlease be warned that this repository is not going to be maintained regularly.\n\n\n### References\n\n[1] IEEE Computer Society (2008-08-29). IEEE Standard for Floating-Point\nArithmetic. IEEE Std 754-2008. IEEE. pp. 1–70. doi:10.1109/IEEESTD.2008.4610935.\nISBN 978-0-7381-5753-5. IEEE Std 754-2008\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarenullrich%2Fpytorch-binary-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarenullrich%2Fpytorch-binary-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarenullrich%2Fpytorch-binary-converter/lists"}