Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ class TfqNoisySamplesOp : public tensorflow::OpKernel {
num_threads, std::vector<long>(output_dim_batch_size, 0));

for (int i = 0; i < output_dim_batch_size; i++) {
int p_reps = (num_samples + num_threads - 1) / num_threads;
uint64_t p_reps =
(static_cast<uint64_t>(num_samples) + num_threads - 1) / num_threads;
Comment thread
mhucka marked this conversation as resolved.
Outdated
offset_prefix_sum[0][i] = rep_offsets[0][i] + p_reps;
for (int j = 1; j < num_threads; j++) {
offset_prefix_sum[j][i] += offset_prefix_sum[j - 1][i];
Expand Down
7 changes: 4 additions & 3 deletions tensorflow_quantum/core/src/util_balance_trajectory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ void BalanceTrajectory(const int& num_samples, const int& num_threads,

int prev_max_height = -1;
for (size_t j = 0; j < (*thread_offsets)[0].size(); j++) {
int run_ceiling = ((num_samples + num_threads - 1) / num_threads);
int num_lo = num_threads * run_ceiling - num_samples;
int num_hi = num_threads - num_lo;
uint64_t run_ceiling =
((static_cast<uint64_t>(num_samples) + num_threads - 1) / num_threads);
uint64_t num_lo = num_threads * run_ceiling - num_samples;
uint64_t num_hi = num_threads - num_lo;
Comment thread
mhucka marked this conversation as resolved.
Outdated
int cur_max = prev_max_height;
for (int i = 0; i < num_threads; i++) {
if (height[i] == cur_max && num_lo) {
Expand Down
Loading