-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set half precision for numpy arrays #87
base: dev
Are you sure you want to change the base?
Conversation
@@ -74,7 +75,7 @@ def get_windows(carrays_dir, outDir, chrom_list, win, label_file_path, mode, npz | |||
n_r = 10 ** 5 | |||
last_t = time() | |||
i = 1 | |||
padding = np.zeros(shape=(padding_len, n_channels), dtype=np.float32) | |||
padding = np.zeros(shape=(padding_len, n_channels), dtype=np.half) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this precision sufficient? I would keep the former.
>>> np.finfo(np.float32).precision
6
>>> np.finfo(np.half).precision
3
``
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the result on the test data it seems to be sufficient, but I need to try it on the real data.
@@ -32,7 +32,7 @@ def get_snv_number(query_seq_list, reference_base): | |||
stop_pos = chrLen | |||
reference_sequence = twobit.TwoBitFile(itwobit) | |||
snv_list = ['BQ', 'SNV', 'MAPQ'] | |||
snv_array = np.zeros(shape=(stop_pos, len(snv_list)), dtype=np.float32) | |||
snv_array = np.zeros(shape=(stop_pos, len(snv_list)), dtype=np.half) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw aren't all channel values counts only?
SonarCloud Quality Gate failed. |
It reduces the file size for numpy arrays by setting half precision.