Skip to content

Commit

Permalink
Remove access to underlying contiguous TL buffer in Normalize op (#3281)
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
  • Loading branch information
klecki committed Aug 26, 2021
1 parent 0043f55 commit 600ffb8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dali/operators/math/normalize/normalize_utils.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -81,8 +81,11 @@ inline int64_t ReducedVolume(const TensorListShape<> &shape, span<const int> axe

template <typename T>
void UniformFill(TensorList<CPUBackend> &tl, const T &value) {
T *data = tl.mutable_data<T>();
std::fill(data, data + tl.size(), value);
const auto &shape = tl.shape();
for (int i = 0; i < shape.num_samples(); i++) {
T *data = tl.mutable_tensor<T>(i);
std::fill(data, data + shape.tensor_size(i), value);
}
}

/**
Expand Down

0 comments on commit 600ffb8

Please sign in to comment.