{"id":19091599,"url":"https://github.com/juliagusak/flopco-pytorch","last_synced_at":"2025-04-30T11:10:22.183Z","repository":{"id":50936230,"uuid":"214253912","full_name":"juliagusak/flopco-pytorch","owner":"juliagusak","description":"FLOPs and other statistics COunter for Pytorch neural networks","archived":false,"fork":false,"pushed_at":"2021-05-27T11:09:41.000Z","size":31,"stargazers_count":23,"open_issues_count":3,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T11:17:54.593Z","etag":null,"topics":["cnn","flops","macs","neural-networks","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliagusak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-10T18:14:50.000Z","updated_at":"2023-11-05T20:56:59.000Z","dependencies_parsed_at":"2022-09-19T09:30:17.639Z","dependency_job_id":null,"html_url":"https://github.com/juliagusak/flopco-pytorch","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliagusak%2Fflopco-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliagusak%2Fflopco-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliagusak%2Fflopco-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliagusak%2Fflopco-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliagusak","download_url":"https://codeload.github.com/juliagusak/flopco-pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249494043,"owners_count":21281659,"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","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":["cnn","flops","macs","neural-networks","pytorch"],"created_at":"2024-11-09T03:13:55.134Z","updated_at":"2025-04-18T12:33:09.439Z","avatar_url":"https://github.com/juliagusak.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"FlopCo\n=====\n\nFlopCo is a Python library that aims to make FLOPs and MACs counting simple and accessible for Pytorch neural networks.\nMoreover FlopCo allows to collect other useful model statistics, such as number of parameters, shapes of layer inputs/outputs, etc.\n\nRequirements\n-----\n- numpy\n- pytorch\n\nInstallation\n-----\n```pip install flopco-pytorch ```\n\nQuick start\n-----\n```python\nfrom flopco import FlopCo\nfrom torchvision.models import resnet50\n\ndevice = 'cuda'\nmodel = resnet50().to(device)\n\n# Estimate model statistics by making one forward pass througth the model, \n# for the input image of size 3 x 224 x 224\n\nstats = FlopCo(model, img_size = (1, 3, 224, 224), device = device)\n\nprint(stats.total_macs, stats.relative_flops)\n```\n\nList of estimated statistics includes:\n- total number of FLOPs/MACs/parameters\n- number of FLOPs/MACs/parameters for each layer\n- relative number of FLOPs/MACs/parameters for each layer\n- input/output shapes for each layer\n\nBy default for statistics counting nn.Conv2d and nn.Linear layers  are used. \nTo include more layer types in computation, pass ```instances``` to the constructor\n\n```python\nstats = FlopCo(model,\n               img_size = (1, 3, 224, 224),\n               device = device,\n               instances = [nn.Conv2d, nn.Linear,\\\n                            nn.BatchNorm2d, nn.ReLU,\\\n                            nn.MaxPool2d, nn.AvgPool2d,\\\n                            nn.Softmax]\n               )\n ```\n\nLicense\n-----\n\nProject is distributed under [MIT License](https://github.com/juliagusak/flopco-pytorch/blob/master/LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliagusak%2Fflopco-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliagusak%2Fflopco-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliagusak%2Fflopco-pytorch/lists"}