use of org.nd4j.linalg.api.shape.SparseDescriptor in project nd4j by deeplearning4j.
the class DirectSparseInfoProvider method createSparseInformation.
@Override
public DataBuffer createSparseInformation(int[] flags, long[] sparseOffsets, int[] hiddenDimensions, int underlyingRank) {
SparseDescriptor descriptor = new SparseDescriptor(flags, sparseOffsets, hiddenDimensions, underlyingRank);
if (!sparseCache.containsKey(descriptor)) {
if (counter.get() < MAX_ENTRIES) {
if (!sparseCache.containsKey(descriptor)) {
counter.incrementAndGet();
DataBuffer buffer = Shape.createSparseInformation(flags, sparseOffsets, hiddenDimensions, underlyingRank);
sparseCache.put(descriptor, buffer);
return buffer;
}
} else {
return Shape.createSparseInformation(flags, sparseOffsets, hiddenDimensions, underlyingRank);
}
}
return sparseCache.get(descriptor);
}
use of org.nd4j.linalg.api.shape.SparseDescriptor in project nd4j by deeplearning4j.
the class DirectSparseInfoProvider method createSparseInformation.
@Override
public DataBuffer createSparseInformation(int[] flags, long[] sparseOffsets, int[] hiddenDimensions, int underlyingRank) {
SparseDescriptor descriptor = new SparseDescriptor(flags, sparseOffsets, hiddenDimensions, underlyingRank);
if (!sparseCache.containsKey(descriptor)) {
if (counter.get() < MAX_ENTRIES) {
if (!sparseCache.containsKey(descriptor)) {
counter.incrementAndGet();
DataBuffer buffer = Shape.createSparseInformation(flags, sparseOffsets, hiddenDimensions, underlyingRank);
sparseCache.put(descriptor, buffer);
return buffer;
}
} else {
return Shape.createSparseInformation(flags, sparseOffsets, hiddenDimensions, underlyingRank);
}
}
return sparseCache.get(descriptor);
}
Aggregations