[WIP] More fixes (#73)
* special tests for ConstantTadHelper/ConstantShapeHelper Signed-off-by: raver119 <raver119@gmail.com> * release methods for data buffers Signed-off-by: raver119 <raver119@gmail.com> * delete temporary buffer Java side Signed-off-by: raver119 <raver119@gmail.com> * delete temporary buffer Java side Signed-off-by: raver119 <raver119@gmail.com>master
parent
ce9c372974
commit
59a006ce29
|
@ -1699,6 +1699,7 @@ public:
|
|||
nd4j::ConstantDataBuffer* constantBuffer(nd4j::DataType dtype, double *data, int length);
|
||||
nd4j::ConstantDataBuffer* constantBuffer(nd4j::DataType dtype, nd4j::ConstantDescriptor *descriptor);
|
||||
|
||||
void deleteShapeBuffer(Nd4jPointer ptr);
|
||||
|
||||
const char* runLightBenchmarkSuit(bool printOut);
|
||||
const char* runFullBenchmarkSuit(bool printOut);
|
||||
|
|
|
@ -2700,6 +2700,11 @@ nd4j::ConstantDataBuffer* NativeOps::shapeBuffer(int rank, Nd4jLong *shape, Nd4j
|
|||
return buffer;
|
||||
}
|
||||
|
||||
void NativeOps::deleteShapeBuffer(Nd4jPointer ptr) {
|
||||
auto buffer = reinterpret_cast<nd4j::ConstantDataBuffer*>(ptr);
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
nd4j::ConstantDataBuffer* NativeOps::constantBuffer(nd4j::DataType dtype, Nd4jLong *data, int length) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -3241,6 +3241,11 @@ nd4j::ConstantDataBuffer* NativeOps::shapeBuffer(int rank, Nd4jLong *shape, Nd4j
|
|||
return buffer;
|
||||
}
|
||||
|
||||
void NativeOps::deleteShapeBuffer(Nd4jPointer ptr) {
|
||||
auto buffer = reinterpret_cast<nd4j::ConstantDataBuffer*>(ptr);
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
nd4j::ConstantDataBuffer* NativeOps::constantBuffer(nd4j::DataType dtype, Nd4jLong *data, int length) {
|
||||
return nd4j::ConstantHelper::getInstance()->constantBuffer(ConstantDescriptor(data, length), dtype);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <ShapeDescriptor.h>
|
||||
#include <array/ConstantDataBuffer.h>
|
||||
#include <memory/Workspace.h>
|
||||
#include <op_boilerplate.h>
|
||||
|
||||
namespace nd4j {
|
||||
|
||||
|
@ -64,6 +65,31 @@ namespace nd4j {
|
|||
Nd4jLong* createFromExisting(Nd4jLong *shapeInfo, bool destroyOriginal = true);
|
||||
|
||||
bool checkBufferExistenceForShapeInfo(ShapeDescriptor &descriptor);
|
||||
|
||||
|
||||
/**
|
||||
* This method returns number of cached TAD shapes/offsets on specific device
|
||||
* @return
|
||||
*/
|
||||
FORCEINLINE int cachedEntriesForDevice(int deviceId) {
|
||||
if (deviceId > _cache.size())
|
||||
throw std::runtime_error("deviceId > number of actual devices");
|
||||
|
||||
return _cache[deviceId].size();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns total number of cached TAD shapes/offsets on all devices
|
||||
* @return
|
||||
*/
|
||||
FORCEINLINE int totalCachedEntries() {
|
||||
int total = 0;
|
||||
|
||||
for (int e = 0; e < _cache.size(); e++)
|
||||
total += _cache[e].size();
|
||||
|
||||
return total;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define DEV_TESTS_CONSTANTTADHELPER_H
|
||||
|
||||
#include <dll.h>
|
||||
#include <op_boilerplate.h>
|
||||
#include <pointercast.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
@ -45,11 +46,43 @@ namespace nd4j {
|
|||
|
||||
static ConstantTadHelper* getInstance();
|
||||
|
||||
/**
|
||||
* These methods calculate Tensor-Along-Dimension(s) shape and offsets
|
||||
*
|
||||
* @param originalShape
|
||||
* @param dimensions
|
||||
* @param keepUnitiesInShape
|
||||
* @return
|
||||
*/
|
||||
TadPack& tadForDimensions(const Nd4jLong *originalShape, const std::vector<int> &dimensions, const bool keepUnitiesInShape = false);
|
||||
TadPack& tadForDimensions(const Nd4jLong *originalShape, int* dimensions, int dimLength, const bool keepUnitiesInShape = false);
|
||||
TadPack& tadForDimensions(const Nd4jLong *originalShape, int dimensions, const bool keepUnitiesInShape = false);
|
||||
TadPack& tadForDimensions(ShapeDescriptor &descriptor, std::vector<int> &dimensions, const bool keepUnitiesInShape = false);
|
||||
TadPack& tadForDimensions(TadDescriptor &descriptor);
|
||||
|
||||
/**
|
||||
* This method returns number of cached TAD shapes/offsets on specific device
|
||||
* @return
|
||||
*/
|
||||
FORCEINLINE int cachedEntriesForDevice(int deviceId) {
|
||||
if (deviceId > _cache.size())
|
||||
throw std::runtime_error("deviceId > number of actual devices");
|
||||
|
||||
return _cache[deviceId].size();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns total number of cached TAD shapes/offsets on all devices
|
||||
* @return
|
||||
*/
|
||||
FORCEINLINE int totalCachedEntries() {
|
||||
int total = 0;
|
||||
|
||||
for (int e = 0; e < _cache.size(); e++)
|
||||
total += _cache[e].size();
|
||||
|
||||
return total;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,42 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class ConstantTadHelperTests : public testing::Test {
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
TEST_F(ConstantShapeHelperTests, test_cachedAmount_1) {
|
||||
auto ttlBefore = ConstantShapeHelper::getInstance()->totalCachedEntries();
|
||||
|
||||
auto arrayA = NDArrayFactory::create<bool>('c', {7, 11, 17, 23, 31, 43});
|
||||
|
||||
auto ttlMiddle = ConstantShapeHelper::getInstance()->totalCachedEntries();
|
||||
|
||||
auto arrayB = NDArrayFactory::create<bool>('c', {7, 11, 17, 23, 31, 43});
|
||||
|
||||
auto ttlAfter = ConstantShapeHelper::getInstance()->totalCachedEntries();
|
||||
|
||||
ASSERT_TRUE(ttlBefore <= ttlMiddle);
|
||||
ASSERT_EQ(ttlMiddle, ttlAfter);
|
||||
}
|
||||
|
||||
TEST_F(ConstantTadHelperTests, test_cachedAmount_1) {
|
||||
auto arrayA = NDArrayFactory::create<bool>('c', {7, 11, 17, 23, 31, 43});
|
||||
auto ttlBefore = ConstantTadHelper::getInstance()->totalCachedEntries();
|
||||
|
||||
auto packAA = ConstantTadHelper::getInstance()->tadForDimensions(arrayA.shapeInfo(), {3, 4});
|
||||
|
||||
auto ttlMiddle = ConstantTadHelper::getInstance()->totalCachedEntries();
|
||||
|
||||
auto packAB = ConstantTadHelper::getInstance()->tadForDimensions(arrayA.shapeInfo(), {3, 4});
|
||||
|
||||
auto ttlAfter = ConstantTadHelper::getInstance()->totalCachedEntries();
|
||||
|
||||
ASSERT_TRUE(ttlBefore <= ttlMiddle);
|
||||
ASSERT_EQ(ttlMiddle, ttlAfter);
|
||||
}
|
||||
|
||||
TEST_F(ConstantShapeHelperTests, basic_test_1) {
|
||||
auto ptr = ShapeBuilders::createShapeInfo(nd4j::DataType::BFLOAT16, 'f', {5, 10, 15});
|
||||
ShapeDescriptor descriptor(ptr);
|
||||
|
|
|
@ -1120,6 +1120,8 @@ public abstract class NativeOps extends Pointer {
|
|||
// GraphState creation
|
||||
public abstract Pointer getGraphState(long id);
|
||||
|
||||
public abstract void deleteShapeBuffer(Pointer state);
|
||||
|
||||
public abstract void deleteGraphState(Pointer state);
|
||||
|
||||
public abstract int estimateThreshold(PointerPointer extraPointers, Pointer x, LongPointer xShapeInfo, int N, float threshold);
|
||||
|
|
|
@ -2586,7 +2586,11 @@ public class CudaExecutioner extends DefaultOpExecutioner {
|
|||
public DataBuffer createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, boolean empty) {
|
||||
val dbf = (Nd4jCuda.ConstantDataBuffer) nativeOps.shapeBuffer(shape.length, new LongPointer(shape), new LongPointer(stride), dtype.toInt(), order, elementWiseStride, empty);
|
||||
|
||||
return new CudaLongDataBuffer(dbf.primary(), dbf.special(), Shape.shapeInfoLength(shape.length));
|
||||
val result = new CudaLongDataBuffer(dbf.primary(), dbf.special(), Shape.shapeInfoLength(shape.length));
|
||||
|
||||
nativeOps.deleteShapeBuffer(dbf);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3047,6 +3047,7 @@ public static class NativeOps extends org.nd4j.nativeblas.NativeOps {
|
|||
public native ConstantDataBuffer constantBuffer(@Cast("nd4j::DataType") int dtype, double[] data, int length);
|
||||
public native ConstantDataBuffer constantBuffer(@Cast("nd4j::DataType") int dtype, ConstantDescriptor descriptor);
|
||||
|
||||
public native void deleteShapeBuffer(@Cast("Nd4jPointer") Pointer ptr);
|
||||
|
||||
public native @Cast("char*") String runLightBenchmarkSuit(@Cast("bool") boolean printOut);
|
||||
public native @Cast("char*") String runFullBenchmarkSuit(@Cast("bool") boolean printOut);
|
||||
|
@ -3698,18 +3699,18 @@ public static class NativeOps extends org.nd4j.nativeblas.NativeOps {
|
|||
private native void allocate(byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @StdVector double[] data);
|
||||
|
||||
/**
|
||||
* this constructor creates new array using given buffer (without memory allocating) and shape information stored in shape
|
||||
* this constructor creates new array using given buffer (without memory allocation) and shape information stored in shape
|
||||
*/
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context, isBuffAlloc); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context, isBuffAlloc); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context, isBuffAlloc); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype);
|
||||
|
||||
|
@ -8034,9 +8035,10 @@ public static final int PREALLOC_SIZE = 33554432;
|
|||
@Namespace("shape") public static native int outerArrayIndexes(@Cast("Nd4jLong*") long[] maxIdxs, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") long[] maxShapeInfo, @Cast("const Nd4jLong*") long[] minShapeInfo, @Const int[] dimsToExclude/*=nullptr*/);
|
||||
@Namespace("shape") public static native int outerArrayIndexes(@Cast("Nd4jLong*") long[] maxIdxs, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") long[] maxShapeInfo, @Cast("const Nd4jLong*") long[] minShapeInfo);
|
||||
|
||||
// calculate offsets of max-array, these output offsets correspond to one minIdx index of min-array which is sub-array of max-array
|
||||
// calculate offsets of max-array, these offsets correspond to one minIdx index of min-array which is sub-array of max-array
|
||||
// maxOffsets - will contain calculated offsets of max-array, buffer for maxOffsets should be allocated beforehand
|
||||
// dimsToExclude - should be sorted in increasing order
|
||||
// memBuff - auxiliary memory buffer (size = 2 * max_rank) for coordinates and increments storing, should be passed from outside
|
||||
// memBuff - auxiliary memory buffer (size = 2 * max_rank) for coordinates and increments storing, should be allocated beforehand
|
||||
@Namespace("shape") public static native int outerArrayOffsets(@Cast("Nd4jLong*") LongPointer maxOffsets, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") LongPointer maxShapeInfo, @Cast("const Nd4jLong*") LongPointer minShapeInfo, @Cast("Nd4jLong*") LongPointer memBuff, @Const IntPointer dimsToExclude/*=nullptr*/);
|
||||
@Namespace("shape") public static native int outerArrayOffsets(@Cast("Nd4jLong*") LongPointer maxOffsets, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") LongPointer maxShapeInfo, @Cast("const Nd4jLong*") LongPointer minShapeInfo, @Cast("Nd4jLong*") LongPointer memBuff);
|
||||
@Namespace("shape") public static native int outerArrayOffsets(@Cast("Nd4jLong*") LongBuffer maxOffsets, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") LongBuffer maxShapeInfo, @Cast("const Nd4jLong*") LongBuffer minShapeInfo, @Cast("Nd4jLong*") LongBuffer memBuff, @Const IntBuffer dimsToExclude/*=nullptr*/);
|
||||
|
@ -8946,6 +8948,7 @@ public static final int PREALLOC_SIZE = 33554432;
|
|||
|
||||
// #endif /* SHAPE_H_ */
|
||||
|
||||
|
||||
// Parsed from array/ShapeList.h
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -2162,7 +2162,11 @@ public class NativeOpExecutioner extends DefaultOpExecutioner {
|
|||
public DataBuffer createShapeInfo(long[] shape, long[] stride, long elementWiseStride, char order, DataType dtype, boolean empty) {
|
||||
val dbf = (Nd4jCpu.ConstantDataBuffer) loop.shapeBuffer(shape.length, new LongPointer(shape), new LongPointer(stride), dtype.toInt(), order, elementWiseStride, empty);
|
||||
|
||||
return new LongBuffer(dbf.primary(), Shape.shapeInfoLength(shape.length));
|
||||
val result = new LongBuffer(dbf.primary(), Shape.shapeInfoLength(shape.length));
|
||||
|
||||
loop.deleteShapeBuffer(dbf);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3047,6 +3047,7 @@ public static class NativeOps extends org.nd4j.nativeblas.NativeOps {
|
|||
public native ConstantDataBuffer constantBuffer(@Cast("nd4j::DataType") int dtype, double[] data, int length);
|
||||
public native ConstantDataBuffer constantBuffer(@Cast("nd4j::DataType") int dtype, ConstantDescriptor descriptor);
|
||||
|
||||
public native void deleteShapeBuffer(@Cast("Nd4jPointer") Pointer ptr);
|
||||
|
||||
public native @Cast("char*") String runLightBenchmarkSuit(@Cast("bool") boolean printOut);
|
||||
public native @Cast("char*") String runFullBenchmarkSuit(@Cast("bool") boolean printOut);
|
||||
|
@ -3698,18 +3699,18 @@ public static class NativeOps extends org.nd4j.nativeblas.NativeOps {
|
|||
private native void allocate(byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @StdVector double[] data);
|
||||
|
||||
/**
|
||||
* this constructor creates new array using given buffer (without memory allocating) and shape information stored in shape
|
||||
* this constructor creates new array using given buffer (without memory allocation) and shape information stored in shape
|
||||
*/
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context, isBuffAlloc); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongPointer shape, @Cast("nd4j::DataType") int dtype);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context, isBuffAlloc); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector LongBuffer shape, @Cast("nd4j::DataType") int dtype);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/) { super((Pointer)null); allocate(buffer, order, shape, dtype, context, isBuffAlloc); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype, LaunchContext context/*=nd4j::LaunchContext::defaultContext()*/, @Cast("const bool") boolean isBuffAlloc/*=false*/);
|
||||
public NDArray(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype) { super((Pointer)null); allocate(buffer, order, shape, dtype); }
|
||||
private native void allocate(Pointer buffer, byte order, @Cast("Nd4jLong*") @StdVector long[] shape, @Cast("nd4j::DataType") int dtype);
|
||||
|
||||
|
@ -8034,9 +8035,10 @@ public static final int PREALLOC_SIZE = 33554432;
|
|||
@Namespace("shape") public static native int outerArrayIndexes(@Cast("Nd4jLong*") long[] maxIdxs, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") long[] maxShapeInfo, @Cast("const Nd4jLong*") long[] minShapeInfo, @Const int[] dimsToExclude/*=nullptr*/);
|
||||
@Namespace("shape") public static native int outerArrayIndexes(@Cast("Nd4jLong*") long[] maxIdxs, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") long[] maxShapeInfo, @Cast("const Nd4jLong*") long[] minShapeInfo);
|
||||
|
||||
// calculate offsets of max-array, these output offsets correspond to one minIdx index of min-array which is sub-array of max-array
|
||||
// calculate offsets of max-array, these offsets correspond to one minIdx index of min-array which is sub-array of max-array
|
||||
// maxOffsets - will contain calculated offsets of max-array, buffer for maxOffsets should be allocated beforehand
|
||||
// dimsToExclude - should be sorted in increasing order
|
||||
// memBuff - auxiliary memory buffer (size = 2 * max_rank) for coordinates and increments storing, should be passed from outside
|
||||
// memBuff - auxiliary memory buffer (size = 2 * max_rank) for coordinates and increments storing, should be allocated beforehand
|
||||
@Namespace("shape") public static native int outerArrayOffsets(@Cast("Nd4jLong*") LongPointer maxOffsets, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") LongPointer maxShapeInfo, @Cast("const Nd4jLong*") LongPointer minShapeInfo, @Cast("Nd4jLong*") LongPointer memBuff, @Const IntPointer dimsToExclude/*=nullptr*/);
|
||||
@Namespace("shape") public static native int outerArrayOffsets(@Cast("Nd4jLong*") LongPointer maxOffsets, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") LongPointer maxShapeInfo, @Cast("const Nd4jLong*") LongPointer minShapeInfo, @Cast("Nd4jLong*") LongPointer memBuff);
|
||||
@Namespace("shape") public static native int outerArrayOffsets(@Cast("Nd4jLong*") LongBuffer maxOffsets, @Cast("const Nd4jLong") long minIdx, @Cast("const Nd4jLong*") LongBuffer maxShapeInfo, @Cast("const Nd4jLong*") LongBuffer minShapeInfo, @Cast("Nd4jLong*") LongBuffer memBuff, @Const IntBuffer dimsToExclude/*=nullptr*/);
|
||||
|
@ -8946,6 +8948,7 @@ public static final int PREALLOC_SIZE = 33554432;
|
|||
|
||||
// #endif /* SHAPE_H_ */
|
||||
|
||||
|
||||
// Parsed from helpers/OpArgsHolder.h
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -15715,8 +15718,8 @@ public static final int TAD_THRESHOLD = TAD_THRESHOLD();
|
|||
* Input arrays:
|
||||
* 0: input with shape [batchSize x inSize], batchSize - batch size, inSize - number of features
|
||||
* 1: previous cell output [batchSize x numUnits], that is at previous time step t-1
|
||||
* 2: RU weights - [(nIn+nOut), 2*numUnits] - reset and update gates (input/recurrent weights)
|
||||
* 3: C weights - [(nIn+nOut), numUnits] - cell gate (input/recurrent weights)
|
||||
* 2: RU weights - [(inSize+numUnits), 2*numUnits] - reset and update gates (input/recurrent weights)
|
||||
* 3: C weights - [(inSize+numUnits), numUnits] - cell gate (input/recurrent weights)
|
||||
* 4: reset and update biases, [2*numUnits] - reset and update gates
|
||||
* 5: cell biases, [numUnits]
|
||||
*
|
||||
|
@ -18005,14 +18008,13 @@ public static final int TAD_THRESHOLD = TAD_THRESHOLD();
|
|||
/**
|
||||
* This operation adjusts image hue by delta
|
||||
* Input arrays:
|
||||
* 0 - 1D or 3D input array, must have 3 channels.
|
||||
* 1 - optional scalar, delta value
|
||||
* 0 - input array with rank >= 3, must have at least one dimension equal 3, that is dimension containing channels.
|
||||
*
|
||||
* T arguments:
|
||||
* 0 - optional delta value
|
||||
* 0 - delta value
|
||||
*
|
||||
* Int arguments:
|
||||
* 0 - optional argument, isNHWC. false by default.
|
||||
* 0 - optional argument, corresponds to dimension with 3 channels
|
||||
*/
|
||||
// #if NOT_EXCLUDED(OP_adjust_hue)
|
||||
@Namespace("nd4j::ops") public static class adjust_hue extends DeclarableOp {
|
||||
|
@ -18035,14 +18037,13 @@ public static final int TAD_THRESHOLD = TAD_THRESHOLD();
|
|||
/**
|
||||
* This operation adjusts image saturation by delta
|
||||
* Input arrays:
|
||||
* 0 - 1D or 3D input array, must have 3 channels.
|
||||
* 1 - optional scalar, delta value
|
||||
* 0 - input array with rank >= 3, must have at least one dimension equal 3, that is dimension containing channels.
|
||||
*
|
||||
* T arguments:
|
||||
* 0 - optional delta value
|
||||
* 0 - saturation factor
|
||||
*
|
||||
* Int arguments:
|
||||
* 0 - optional argument, isNHWC. false by default.
|
||||
* 0 - optional argument, corresponds to dimension with 3 channels
|
||||
*/
|
||||
// #if NOT_EXCLUDED(OP_adjust_saturation)
|
||||
@Namespace("nd4j::ops") public static class adjust_saturation extends DeclarableOp {
|
||||
|
|
Loading…
Reference in New Issue