Skip to content

Add resnet20#25

Open
stamcenter wants to merge 17 commits into
fhe-benchmarking:mainfrom
stamcenter:add-resnet20
Open

Add resnet20#25
stamcenter wants to merge 17 commits into
fhe-benchmarking:mainfrom
stamcenter:add-resnet20

Conversation

@stamcenter

Copy link
Copy Markdown
Contributor

Adding the second pull request which contains the resnet-20 model as the reference for cifar10. It also include a modification to the harness that allow it to set mlp as default model for mnist and resnet20 as default model for cifar10.

@code-perspective code-perspective self-requested a review June 15, 2026 05:32

@code-perspective code-perspective left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I was able to run this.

Can you rebase against main? Please only keep the cifar-10 and resnet20 models in this PR.

For reference, I got the measurement files (roughly takes 2 hours to run with the cifar-10 dataset load time).

{
  "model_name": "resnet20",
  "dataset_name": "cifar10",
  "Timing": {
    "Test dataset generation": "28.5534s",
    "Key Generation": "167.453s",
    "Encrypted model preprocessing": "0.0102s",
    "Input generation": "6.0968s",
    "Input preprocessing": "0.0073s",
    "Input encryption": "1.4808s",
    "Encrypted computation": "5256.1713s",
    "Result decryption": "1.0469s",
    "Result postprocessing": "0.0072s",
    "Total": "5460.8268s"
  },
  "Bandwidth": {
    "Public and evaluation keys": "50.4G",
    "Encrypted input": "28.0M",
    "Encrypted results": "8.0M"
  },
  "Server Reported": {}
}

Comment on lines +501 to +506
std::sort(rotation_positions.begin(), rotation_positions.end());
auto new_end = std::remove(rotation_positions.begin(), rotation_positions.end(), 0);
new_end = std::unique(rotation_positions.begin(), rotation_positions.end());
unique(rotation_positions.begin(), rotation_positions.end());
rotation_positions.erase(new_end, rotation_positions.end());
std::sort(rotation_positions.begin(), rotation_positions.end());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In C++20 standard libraries, std::unique is marked [[nodiscard]], which triggers compiler errors when the return value is ignored. Additionally, std::unique and std::remove only reorder elements without actually resizing the underlying vector.

Let's clean this up using standard erase-remove and erase-unique idioms

std::sort(rotation_positions.begin(), rotation_positions.end());
        rotation_positions.erase(std::unique(rotation_positions.begin(), rotation_positions.end()), rotation_positions.end());
        rotation_positions.erase(std::remove(rotation_positions.begin(), rotation_positions.end(), 0), rotation_positions.end());

Comment on lines +8 to +10
int main(){
return 0;
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code to pack the weights can be added in this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants