Skip to content

Commit

Permalink
Add more details of the input format.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamATD authored Feb 26, 2023
1 parent cff912b commit 7a14e31
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,34 @@ This is the implementation of [this paper](https://eprint.iacr.org/2021/673), wh

## Input Format

The input has two part which are data and weight in the matrix.
To run the program, the command is
```bash
# run_file is the name of executable file.
# in_file is the file containing the data and weight matrix, please refer to the details below.
# config_file is the file containing config (scale and zero-point) of the model. In this implementation,
# we don't use this file because we compute the scale and zero-point directly from the data in each
# layer, so it's okay to put an empty file here.
# ou_file is the prediction result of this picture.
# exp_result is the experiment results filled in the table. For the definition of the table header,
# please refer to the file `src/global_var.hpp`.
# pic_cnt is the number of pictures to be predicted. For details please refer to the following section.

${run_file} ${in_file} ${config_file} ${ou_file} ${pic_cnt} > ${exp_result}
```

### The format of `in_file`

### Data Part
In the current code, we only allow one picture and one matrix to be put in this file. If `pic_cnt` > 1, then the code will internally duplicate the data for corresponding times. Thus to test different pictures, you might need to adjust the code of loading the input.

This part is the picture data, a vector reshaped from its original matrix by
#### Data Part

This part is for a picture data, a vector reshaped from its original matrix by

![formula1](https://render.githubusercontent.com/render/math?math=ch_{in}%20%5Ccdot%20h\times%20w)

where ![formula2](https://render.githubusercontent.com/render/math?math=ch_{in}) is the number of channel, ![formula3](https://render.githubusercontent.com/render/math?math=h) is the height, ![formula4](https://render.githubusercontent.com/render/math?math=w) is the width.

### Weight Part
#### Weight Part

This part is the set of parameters in the neural network, which contains

Expand All @@ -40,6 +57,9 @@ This part is the set of parameters in the neural network, which contains

- fully-connected bias of size ![formula15](https://render.githubusercontent.com/render/math?math=ch_{out}).

### The format of `config_file`
Typically this is a file to record scale and zero-point for the data in each layer. However, in our current implementation, those are computed directly from the those data. Therefore, you can just leave it blank.

## Experiment Script
### Clone the repo
To run the code, make sure you clone with
Expand Down Expand Up @@ -81,4 +101,4 @@ Here we implement a [hyrax polynomial commitment](https://eprint.iacr.org/2017/1

- [Hyrax](https://github.com/hyraxZK/hyraxZK.git)

- [mcl](https://github.com/herumi/mcl)
- [mcl](https://github.com/herumi/mcl)

0 comments on commit 7a14e31

Please sign in to comment.