{"id":15639078,"url":"https://github.com/rasbt/cyclemoid-pytorch","last_synced_at":"2025-08-01T17:37:18.004Z","repository":{"id":42503367,"uuid":"476117321","full_name":"rasbt/cyclemoid-pytorch","owner":"rasbt","description":"Cyclemoid implementation for PyTorch","archived":false,"fork":false,"pushed_at":"2022-04-02T14:17:36.000Z","size":1948,"stargazers_count":90,"open_issues_count":5,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-22T10:52:05.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rasbt.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}},"created_at":"2022-03-31T02:08:28.000Z","updated_at":"2025-06-23T22:27:22.000Z","dependencies_parsed_at":"2022-08-31T20:32:27.303Z","dependency_job_id":null,"html_url":"https://github.com/rasbt/cyclemoid-pytorch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rasbt/cyclemoid-pytorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fcyclemoid-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fcyclemoid-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fcyclemoid-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fcyclemoid-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasbt","download_url":"https://codeload.github.com/rasbt/cyclemoid-pytorch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasbt%2Fcyclemoid-pytorch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268268587,"owners_count":24223095,"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-08-01T02:00:08.611Z","response_time":67,"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":[],"created_at":"2024-10-03T11:24:34.903Z","updated_at":"2025-08-01T17:37:17.982Z","avatar_url":"https://github.com/rasbt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n![](docs/logo.png)\n\nThis is an implementation of the cyclemoid activation function for PyTorch. \n\n\n\nThe cyclemoid function achieved state-of-the-art results in a recent benchmark with other popular activation functions as shown below:\n\n\n\n![](docs/results.png)\n\n\n\n\n\n**Note that this is a figure from the paper submitted on April 1st, 2022. An arxiv preprint will be uploaded soon.**\n\n\n\n## Installation\n\n\n\nYou can install the cyclemoid-pytorch package via\n\n```python\npip install cyclemoid_pytorch\n```\n\n\n\n## Usage\n\nThis package implements a `CycleMoid` class and a `cyclemoid` function. You can use these are drop-in replacements for any activation in PyTorch. For example\n\n\n\n```python\nfrom cyclemoid_pytorch import CycleMoid\n\ntorch.nn.Sequential(\n    # ...,\n    CycleMoid(), # instead of torch.nn.ReLU()\n    # ...\n    )\n```\n\nor\n\n```python\nfrom cyclemoid_pytorch import cyclemoid\n\n# ...\ndef forward(self, x):\n    # ...\n    x = cyclemoid(x) # instead of torch.sigmoid(x)\n```\n\n\n\n## Visualization\n\n\n\n```python\nimport matplotlib.pyplot as plt\nimport torch\nfrom cyclemoid_pytorch import cyclemoid\n\nx = torch.arange(-5, 5, 0.01)\ny = cyclemoid(x)\nplt.plot(x, y)\n```\n\n![](docs/plot.png)\n\n\n\n## Demo\n\n\n\nFor a concrete usage, check out the [demo notebook](docs/demo.ipynb).\n\n\n\n\n\n## Appendix\n\nYou can now also use the cyclemoid activation in Keras.\n\n```python\nimport tensorflow as tf\nfrom cyclemoid_pytorch.easteregg import CycleMoid\n\n\ntf.keras.utils.get_custom_objects()['cyclemoid'] = CycleMoid\n\nmodel = tf.keras.Sequential(\n    [\n        tf.keras.Input(...),\n        tf.keras.layers.Conv2D(..., activation=\"cyclemoid\"),\n        # ... \n    ]\n)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasbt%2Fcyclemoid-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasbt%2Fcyclemoid-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasbt%2Fcyclemoid-pytorch/lists"}