Skip to content

Commit

Permalink
Update logspace_kernel.cu
Browse files Browse the repository at this point in the history
  • Loading branch information
BrilliantYuKaimin committed Mar 22, 2022
1 parent 95ea530 commit bee1fb2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions paddle/phi/kernels/gpu/logspace_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <cmath>
#include "paddle/fluid/platform/device/gpu/gpu_primitives.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
Expand All @@ -30,17 +29,17 @@ __global__ void LogspaceKernelInner(

for (; index < size; index += blockDim.x * gridDim.x) {
if (index < size / 2) {
out[index] = static_cast<T>(std::pow(base, start + step * index));
out[index] = static_cast<T>(pow(base, start + step * index));
} else {
out[index] =
static_cast<T>(std::pow(base, stop - step * (size - index - 1)));
static_cast<T>(pow(base, stop - step * (size - index - 1)));
}
}
}

template <typename T>
__global__ void LogspaceSpecialKernel(T start, T base, T* out) {
out[0] = static_cast<T>(std::pow(base, start));
out[0] = static_cast<T>(pow(base, start));
}

template <typename T, typename Context>
Expand Down

0 comments on commit bee1fb2

Please sign in to comment.