2019-06-06 14:21:15 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2015-2018 Skymind, Inc.
|
|
|
|
*
|
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
* terms of the Apache License, Version 2.0 which is available at
|
|
|
|
* https://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Created by agibsonccc on 1/28/16.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef NATIVEOPERATIONS_NATIVEOPEXCUTIONER_H
|
|
|
|
#define NATIVEOPERATIONS_NATIVEOPEXCUTIONER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <types/types.h>
|
2020-03-02 10:49:41 +01:00
|
|
|
#include <system/dll.h>
|
2019-06-06 14:21:15 +02:00
|
|
|
#include <ops/specials.h>
|
|
|
|
#include <ops/specials_sparse.h>
|
|
|
|
#include <execution/LaunchContext.h>
|
2019-11-13 15:15:18 +01:00
|
|
|
#include <array/ArrayOptions.h>
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Native op executioner:
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class ND4J_EXPORT NativeOpExecutioner {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParams
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfo
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execIndexReduceScalar(sd::LaunchContext *lc,
|
2020-03-10 14:29:09 +01:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParams,
|
2020-05-09 07:06:14 +02:00
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParamsVals
|
|
|
|
* @param y
|
|
|
|
* @param yShapeInfo
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfoBuffer
|
|
|
|
* @param dimension
|
|
|
|
* @param dimensionLength
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduce3Scalar(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParamsVals,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2020-03-10 14:29:09 +01:00
|
|
|
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParamsVals
|
|
|
|
* @param y
|
|
|
|
* @param yShapeInfo
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfo
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduce3(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParamsVals,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParamsVals
|
|
|
|
* @param y
|
|
|
|
* @param yShapeInfo
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfoBuffer
|
|
|
|
* @param dimension
|
|
|
|
* @param dimensionLength
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduce3(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParamsVals,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *xTadOnlyShapeInfo, const Nd4jLong *xTadOffsets,
|
|
|
|
const Nd4jLong *yTadOnlyShapeInfo, const Nd4jLong *yTadOffsets);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduce3All(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParamsVals,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *xTadShapeInfo, const Nd4jLong *xOffsets,
|
|
|
|
const Nd4jLong *yTadShapeInfo, const Nd4jLong *yOffsets);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParams
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfoBuffer
|
|
|
|
* @param dimension
|
|
|
|
* @param dimensionLength
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execIndexReduce(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParams,
|
2020-05-09 07:06:14 +02:00
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xStride
|
|
|
|
* @param result
|
|
|
|
* @param resultStride
|
|
|
|
* @param scalar
|
|
|
|
* @param extraParams
|
|
|
|
* @param n
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execScalar(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
const void *hScalar, const Nd4jLong *hSscalarShapeInfo,
|
|
|
|
const void *dScalar, const Nd4jLong *dSscalarShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
bool allowParallelism = true);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execScalarBool(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
const void *hScalar, const Nd4jLong *hSscalarShapeInfo,
|
|
|
|
const void *dScalar, const Nd4jLong *dSscalarShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
bool allowParallelism = true);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execScalarInt(sd::LaunchContext *lc,
|
2019-08-30 09:12:40 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
const void *hScalar, const Nd4jLong *hSscalarShapeInfo,
|
|
|
|
const void *dScalar, const Nd4jLong *dSscalarShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
bool allowParallelism = true);
|
2019-08-30 09:12:40 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execScalar(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
void const* hX, Nd4jLong const* hXShapeInfo,
|
|
|
|
void const* dX, Nd4jLong const* dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParams,
|
2020-05-09 07:06:14 +02:00
|
|
|
void *hZ, Nd4jLong const* hZShapeInfo,
|
|
|
|
void *dZ, Nd4jLong const* dZShapeInfo,
|
|
|
|
void const* hScalars, Nd4jLong const* hScalarShapeInfo,
|
|
|
|
void const* dScalars, Nd4jLong const* dScalarShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
Nd4jLong const* tadShapeInfo, Nd4jLong const* tadOffsets,
|
|
|
|
Nd4jLong const* tadShapeInfoZ, Nd4jLong const* tadOffsetsZ);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execScalarBool(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParams,
|
2020-05-09 07:06:14 +02:00
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
const void *hScalars, const Nd4jLong *hScalarShapeInfo,
|
|
|
|
const void *dScalars, const Nd4jLong *dScalarShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadShapeInfoZ, const Nd4jLong *tadOffsetsZ);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execScalarInt(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
const void *hScalars, const Nd4jLong *hScalarShapeInfo,
|
|
|
|
const void *dScalars, const Nd4jLong *dScalarShapeInfo,
|
|
|
|
int *dimension, int dimensionLength,
|
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadShapeInfoZ, const Nd4jLong *tadOffsetsZ);
|
2019-08-30 09:12:40 +02:00
|
|
|
|
|
|
|
|
2019-06-06 14:21:15 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param y
|
|
|
|
* @param yShapeInfo
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfo
|
|
|
|
* @param dimension
|
|
|
|
* @param dimensionLength
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execBroadcast(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
int *dimension, int dimensionLength,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfoZ,const Nd4jLong *tadOffsetsZ);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-10 14:29:09 +01:00
|
|
|
static void execBroadcast(sd::LaunchContext* lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2020-03-10 14:29:09 +01:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execInverseBroadcast(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *x, const Nd4jLong *xShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *y, const Nd4jLong *yShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *result, const Nd4jLong *resultShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *tadOnlyShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfoZ, const Nd4jLong *tadOffsetsZ);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execBroadcastBool(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
2020-03-10 14:29:09 +01:00
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2020-05-09 07:06:14 +02:00
|
|
|
void *extraParams,
|
2019-08-30 09:12:40 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *tadOnlyShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfoZ,const Nd4jLong *tadOffsetsZ);
|
2019-08-30 09:12:40 +02:00
|
|
|
|
2020-05-09 07:06:14 +02:00
|
|
|
static void execBroadcastBool(sd::LaunchContext* lc,
|
|
|
|
int opNum,
|
2020-03-10 14:29:09 +01:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
2020-05-09 07:06:14 +02:00
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams);
|
2020-03-10 14:29:09 +01:00
|
|
|
|
2020-05-09 07:06:14 +02:00
|
|
|
static void execInverseBroadcastBool(sd::LaunchContext *lc,
|
2019-08-30 09:12:40 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *x, const Nd4jLong *xShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *y, const Nd4jLong *yShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *result, const Nd4jLong *resultShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams,
|
2019-08-30 09:12:40 +02:00
|
|
|
int *dimension, int dimensionLength,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *tadOnlyShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfoZ, const Nd4jLong *tadOffsetsZ);
|
|
|
|
|
|
|
|
static void execBroadcastInt(sd::LaunchContext *lc,
|
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
int *dimension, int dimensionLength,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfoZ,const Nd4jLong *tadOffsetsZ);
|
|
|
|
|
|
|
|
static void execBroadcastInt(sd::LaunchContext* lc,
|
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
|
|
|
|
|
|
|
static void execInverseBroadcastInt(sd::LaunchContext *lc,
|
|
|
|
int opNum,
|
|
|
|
const void *x, const Nd4jLong *xShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *y, const Nd4jLong *yShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *result, const Nd4jLong *resultShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
int *dimension, int dimensionLength,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *tadOnlyShapeInfoZ, const Nd4jLong *tadOffsetsZ);
|
2020-03-10 14:29:09 +01:00
|
|
|
|
2019-06-06 14:21:15 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param dx
|
|
|
|
* @param xStride
|
|
|
|
* @param y
|
|
|
|
* @param yStride
|
|
|
|
* @param result
|
|
|
|
* @param resultStride
|
|
|
|
* @param extraParams
|
|
|
|
* @param n
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execPairwiseTransform(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execPairwiseBoolTransform(sd::LaunchContext *lc,
|
2019-08-30 09:12:40 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2019-08-30 09:12:40 +02:00
|
|
|
void *extraParams);
|
|
|
|
|
2020-05-09 07:06:14 +02:00
|
|
|
static void execPairwiseIntTransform(sd::LaunchContext *lc,
|
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams);
|
|
|
|
|
2019-06-06 14:21:15 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param dx
|
|
|
|
* @param xStride
|
|
|
|
* @param result
|
|
|
|
* @param resultStride
|
|
|
|
* @param extraParams
|
|
|
|
* @param n
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execTransformFloat(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execTransformAny(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
bool allowParallelism = true);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execTransformStrict(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParams,
|
2020-05-09 07:06:14 +02:00
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets);
|
|
|
|
|
|
|
|
static void execTransformSame(sd::LaunchContext *lc,
|
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execTransformBool(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets);
|
2019-06-06 14:21:15 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParams
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfo
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduceFloat(sd::LaunchContext *lc,
|
2019-06-06 14:21:15 +02:00
|
|
|
int opNum,
|
2020-05-09 07:06:14 +02:00
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
2019-06-06 14:21:15 +02:00
|
|
|
void *extraParams,
|
2020-05-09 07:06:14 +02:00
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2020-07-26 14:59:27 +02:00
|
|
|
int *dimension, int dimensionLength);
|
2020-05-09 07:06:14 +02:00
|
|
|
|
|
|
|
static void execReduceSame(sd::LaunchContext *lc,
|
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2020-07-26 14:59:27 +02:00
|
|
|
int *dimension, int dimensionLength);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduceBool(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2020-07-26 14:59:27 +02:00
|
|
|
int *dimension, int dimensionLength);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduceLong(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
2020-07-26 14:59:27 +02:00
|
|
|
int *dimension, int dimensionLength);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParams
|
|
|
|
* @return
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduceFloatScalar(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduceBoolScalar(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduceSameScalar(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduceLongScalar(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execReduce3TAD(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParamsVals,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeInfo,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeInfo,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
int *dimension, int dimensionLength,
|
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
const Nd4jLong *yTadShapeInfo, const Nd4jLong *yTadOffsets);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParams
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfoBuffer
|
|
|
|
* @param dimension
|
|
|
|
* @param dimensionLength
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execSummaryStats(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
int *dimension, int dimensionLength,
|
|
|
|
const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets,
|
|
|
|
bool biasCorrected);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParams
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfo
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execSummaryStats(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
bool biasCorrected);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param opNum
|
|
|
|
* @param x
|
|
|
|
* @param xShapeInfo
|
|
|
|
* @param extraParams
|
|
|
|
* @param result
|
|
|
|
* @param resultShapeInfo
|
|
|
|
*/
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execSummaryStatsScalar(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeInfo,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeInfo,
|
|
|
|
void *extraParams,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeInfo,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeInfo,
|
|
|
|
bool biasCorrected);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execRandom(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
Nd4jPointer state,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeBuffer,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeBuffer,
|
|
|
|
void *extraArguments);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execRandom(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
Nd4jPointer state,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeBuffer,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeBuffer,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeBuffer,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeBuffer,
|
|
|
|
void *extraArguments);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
static void execRandom(sd::LaunchContext *lc,
|
2020-05-09 07:06:14 +02:00
|
|
|
int opNum,
|
|
|
|
Nd4jPointer state,
|
|
|
|
const void *hX, const Nd4jLong *hXShapeBuffer,
|
|
|
|
const void *dX, const Nd4jLong *dXShapeBuffer,
|
|
|
|
const void *hY, const Nd4jLong *hYShapeBuffer,
|
|
|
|
const void *dY, const Nd4jLong *dYShapeBuffer,
|
|
|
|
void *hZ, const Nd4jLong *hZShapeBuffer,
|
|
|
|
void *dZ, const Nd4jLong *dZShapeBuffer,
|
|
|
|
void *extraArguments);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-09 07:06:14 +02:00
|
|
|
inline static void execSort(void *x, const Nd4jLong *xShapeInfo, bool descending) {
|
2020-03-02 10:49:41 +01:00
|
|
|
auto xType = sd::ArrayOptions::dataType(xShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
BUILD_SINGLE_SELECTOR(xType, sd::SpecialMethods, ::sortGeneric(x, xShapeInfo, descending), LIBND4J_TYPES);
|
2019-06-06 14:21:15 +02:00
|
|
|
}
|
|
|
|
|
2020-05-09 07:06:14 +02:00
|
|
|
static void execSort(void *x, const Nd4jLong *xShapeInfo, int *dimension, int dimensionLength, const Nd4jLong *tadShapeInfo, const Nd4jLong *tadOffsets, bool descending) {
|
2020-03-02 10:49:41 +01:00
|
|
|
auto xType = sd::ArrayOptions::dataType(xShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
BUILD_SINGLE_SELECTOR(xType, sd::SpecialMethods, ::sortTadGeneric(x, xShapeInfo, dimension, dimensionLength, tadShapeInfo, tadOffsets, descending), LIBND4J_TYPES);
|
2019-06-06 14:21:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline static void execSortCooIndices(Nd4jLong *indices, void *values, Nd4jLong length, int rank) {
|
2020-03-02 10:49:41 +01:00
|
|
|
sd::sparse::SparseUtils<Nd4jLong>::sortCooIndicesGeneric(indices, reinterpret_cast<Nd4jLong *>(values), length, rank);
|
2019-06-06 14:21:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-09 07:06:14 +02:00
|
|
|
inline static Nd4jLong encodeBitmap(void *dx, const Nd4jLong *xShapeInfo, Nd4jLong N, int *dz, float threshold) {
|
2020-03-02 10:49:41 +01:00
|
|
|
auto xType = sd::ArrayOptions::dataType(xShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
BUILD_SINGLE_SELECTOR(xType, return sd::SpecialMethods, ::encodeBitmapGeneric(dx, xShapeInfo, N, dz, threshold), FLOAT_TYPES);
|
2019-06-06 14:21:15 +02:00
|
|
|
}
|
|
|
|
|
2020-05-09 07:06:14 +02:00
|
|
|
inline static void decodeBitmap(const void *dx, Nd4jLong N, void *dz, const Nd4jLong *zShapeInfo) {
|
2020-03-02 10:49:41 +01:00
|
|
|
auto zType = sd::ArrayOptions::dataType(zShapeInfo);
|
2019-06-06 14:21:15 +02:00
|
|
|
|
2020-03-02 10:49:41 +01:00
|
|
|
BUILD_SINGLE_SELECTOR(zType, sd::SpecialMethods, ::decodeBitmapGeneric(dx, N, dz, zShapeInfo), FLOAT_TYPES);
|
2019-06-06 14:21:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //NATIVEOPERATIONS_NATIVEOPEXCUTIONER_H
|