Java Code Examples for org.nd4j.linalg.factory.Nd4j#createUninitialized()

The following examples show how to use org.nd4j.linalg.factory.Nd4j#createUninitialized() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpExecutionerTests.java    From nd4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testVPull2() {
    int indexes[] = new int[] {0, 2, 4};
    INDArray array = Nd4j.linspace(1, 25, 25).reshape(5, 5);
    INDArray assertion = Nd4j.createUninitialized(new int[] {3, 5}, 'c');
    for (int i = 0; i < 3; i++) {
        assertion.putRow(i, array.getRow(indexes[i]));
    }

    INDArray result = Nd4j.pullRows(array, 1, indexes, 'c');

    assertEquals(3, result.rows());
    assertEquals(5, result.columns());
    assertEquals(assertion, result);

    System.out.println(assertion.toString());
    System.out.println(result.toString());
}
 
Example 2
Source File: ReductionBpOpValidation.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testReduceSumAlongDim1BP() {
    //Reduction along dimension
    //Inputs/outputs as before - but note that the output is no longer a scalar

    //Note: when reducing [3,4] along dimension 1 -> 3 TADs of length 4
    //We have one epsilon/gradient for each of the 3 TADs -> dL/dOut length is 3

    for (boolean keepDims : new boolean[]{false, true}) {
        INDArray preReduceInput = Nd4j.linspace(1, 12, 12).reshape(3, 4);

        long[] reducedShape_1 = (keepDims ? new long[]{3, 1} : new long[]{3});
        INDArray dLdOut_1 = Nd4j.create(new double[]{1, 2, 3}, reducedShape_1);
        INDArray dLdInExpected_1 = Nd4j.createUninitialized(preReduceInput.shape());
        for (int i = 0; i < 4; i++) {
            dLdInExpected_1.putColumn(i, dLdOut_1);
        }

        INDArray dLdIn = Nd4j.createUninitialized(3, 4);

        String err = OpValidation.validate(new OpTestCase(new SumBp(preReduceInput, dLdOut_1, dLdIn, keepDims, 1))
                .expectedOutput(0, dLdInExpected_1));

        assertNull(err);
    }
}
 
Example 3
Source File: NativeBlasTests.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testBlasGemm6() {

    // we're skipping blas here
    if (Nd4j.getExecutioner().getClass().getSimpleName().toLowerCase().contains("cuda"))
        return;

    val A = Nd4j.linspace(1, 12, 12, DataType.DOUBLE).reshape('c', 4, 3).dup('f');
    val B = Nd4j.linspace(1, 12, 12, DataType.DOUBLE).reshape('c', 3, 4).dup('f');

    val exp = A.mmul(B);

    val res = Nd4j.createUninitialized(DataType.DOUBLE, new long[] {4, 4}, 'c');

    val matmul = DynamicCustomOp.builder("matmul")
            .addInputs(A, B)
            .addOutputs(res)
            .build();

    Nd4j.getExecutioner().exec(matmul);

    // ?
    assertEquals(exp, res);
}
 
Example 4
Source File: ReductionBpOpValidation.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testVarianceBP() {
    //If out = variance(in) then:
    //dL/dIn = dL/dOut * dOut/dIn
    //dOut/dIn_i = 2*(in_i-mean)/(n-1)
    //OR: n instead of n-1, if not bias corrected

    for (boolean biasCorrected : new boolean[]{true, false}) {
        for (boolean keepDims : new boolean[]{false, true}) {

            INDArray preReduceInput = Nd4j.linspace(1, 12, 12).reshape(3, 4);
            INDArray dLdOut;
            if (keepDims) {
                dLdOut = Nd4j.valueArrayOf(new long[]{1, 1}, 0.5);
            } else {
                dLdOut = Nd4j.scalar(0.5);
            }

            double var = preReduceInput.var(biasCorrected).getDouble(0);
            double mean = preReduceInput.meanNumber().doubleValue();

            long divisor = biasCorrected ? (preReduceInput.length() - 1) : preReduceInput.length();

            INDArray dLdInExp = preReduceInput.dup()
                    .subi(mean).muli(2.0 / divisor)
                    .muli(0.5); //* dL/dOut

            INDArray dLdIn = Nd4j.createUninitialized(3, 4);

            String err = OpValidation.validate(new OpTestCase(new VarianceBp(preReduceInput, dLdOut, dLdIn, biasCorrected, keepDims))
                    .expectedOutput(0, dLdInExp));
            assertNull(err);
        }
    }
}
 
Example 5
Source File: LongShapeTests.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testLongShape_1() {
    val exp = new long[]{2, 5, 3, 3, 1, 16384, 1, 99};

    val array = Nd4j.createUninitialized(DataType.DOUBLE, 5, 3);
    val buffer = array.shapeInfoDataBuffer();

    val java = buffer.asLong();

    assertArrayEquals(exp, java);
    assertEquals(8, buffer.getElementSize());
}
 
Example 6
Source File: CustomOpsTests.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Ignore("2019/11/15 AS - https://github.com/eclipse/deeplearning4j/issues/8399")
@Test
public void testCropAndResize() {
    INDArray image = Nd4j.createUninitialized(DataType.FLOAT, 1, 2, 2, 1);
    INDArray boxes = Nd4j.createFromArray(new float[]{1,2,3,4}).reshape(1,4);
    INDArray box_indices = Nd4j.createFromArray(new int[]{1});
    INDArray crop_size = Nd4j.createFromArray(new int[]{1,2}).reshape(1,2);

    //Output shape mismatch - TF [2, 2, 1, 1] vs SD: [1, 2, 1, 1]
    INDArray output = Nd4j.create(DataType.FLOAT, 2,2,1,1);


    Nd4j.exec(new CropAndResize(image, boxes, box_indices, crop_size, CropAndResize.Method.BILINEAR, 0.5,
             output));
}
 
Example 7
Source File: OperationProfilerTests.java    From nd4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testCounter1() {
    INDArray array = Nd4j.createUninitialized(100);

    array.assign(10f);
    array.divi(2f);

    assertEquals(2, OpProfiler.getInstance().getInvocationsCount());
}
 
Example 8
Source File: CustomOpsTests.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testResizeArea1() {

    INDArray x = Nd4j.rand(DataType.FLOAT, 1, 2,3,4);
    INDArray z = Nd4j.createUninitialized(DataType.FLOAT, 1, 10, 10, 4);
    ResizeArea op = new ResizeArea(x, z, 10, 10, false);
    Nd4j.exec(op);
}
 
Example 9
Source File: Transforms.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
public static INDArray not(INDArray x) {
    val z = Nd4j.createUninitialized(DataType.BOOL, x.shape(), x.ordering());
    if (x.isB()) {
        Nd4j.getExecutioner().exec(new BooleanNot(x, z));
    } else {
        Nd4j.getExecutioner().exec(new ScalarNot(x, z, 0.0f));
    }
    return z;
}
 
Example 10
Source File: NativeRandom.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public INDArray nextFloat(char order, long[] shape) {
    INDArray array = Nd4j.createUninitialized(shape, order);
    UniformDistribution op = new UniformDistribution(array, 0.0, 1.0);
    Nd4j.getExecutioner().exec(op, this);

    return array;
}
 
Example 11
Source File: MaskedReductionUtil.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public static INDArray maskedPoolingConvolution(PoolingType poolingType, INDArray toReduce, INDArray mask, int pnorm, DataType dataType) {
    if(mask.rank() != 4){
        //TODO BETTER ERROR MESSAGE EXPLAINING FORMAT
        //TODO ALSO HANDLE LEGACY FORMAT WITH WARNING WHERE POSSIBLE
        throw new IllegalStateException("Expected rank 4 mask array: Got array with shape " + Arrays.toString(mask.shape()));
    }

    mask = mask.castTo(dataType);   //no-op if already correct dtype

    // [minibatch, channels, h, w] data with a mask array of shape [minibatch, 1, X, Y]
    // where X=(1 or inH) and Y=(1 or inW)

    //General case: must be equal or 1 on each dimension
    int[] dimensions = new int[4];
    int count = 0;
    for(int i=0; i<4; i++ ){
        if(toReduce.size(i) == mask.size(i)){
            dimensions[count++] = i;
        }
    }
    if(count < 4){
        dimensions = Arrays.copyOfRange(dimensions, 0, count);
    }

    switch (poolingType) {
        case MAX:
            //TODO This is ugly - replace it with something better... Need something like a Broadcast CAS op
            INDArray negInfMask;
            if(mask.dataType() == DataType.BOOL){
                negInfMask = Transforms.not(mask).castTo(dataType);
            } else {
                negInfMask = mask.rsub(1.0);
            }
            BooleanIndexing.replaceWhere(negInfMask, Double.NEGATIVE_INFINITY, Conditions.equals(1.0));

            INDArray withInf = Nd4j.createUninitialized(dataType, toReduce.shape());
            Nd4j.getExecutioner().exec(new BroadcastAddOp(toReduce, negInfMask, withInf, dimensions));
            //At this point: all the masked out steps have value -inf, hence can't be the output of the MAX op

            return withInf.max(2, 3);
        case AVG:
        case SUM:
            INDArray masked = Nd4j.createUninitialized(dataType, toReduce.shape());
            Nd4j.getExecutioner().exec(new BroadcastMulOp(toReduce, mask, masked, dimensions));

            INDArray summed = masked.sum(2, 3);
            if (poolingType == PoolingType.SUM) {
                return summed;
            }
            INDArray maskCounts = mask.sum(1,2,3);
            summed.diviColumnVector(maskCounts);
            return summed;

        case PNORM:
            //Similar to average and sum pooling: there's no N term here, so we can just set the masked values to 0
            INDArray masked2 = Nd4j.createUninitialized(dataType, toReduce.shape());
            Nd4j.getExecutioner().exec(new BroadcastMulOp(toReduce, mask, masked2, dimensions));

            INDArray abs = Transforms.abs(masked2, true);
            Transforms.pow(abs, pnorm, false);
            INDArray pNorm = abs.sum(2, 3);

            return Transforms.pow(pNorm, 1.0 / pnorm);
        default:
            throw new UnsupportedOperationException("Unknown or not supported pooling type: " + poolingType);
    }
}
 
Example 12
Source File: NormalDistribution.java    From nd4j with Apache License 2.0 4 votes vote down vote up
@Override
public INDArray sample(int[] shape) {
    final INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
    return sample(ret);
}
 
Example 13
Source File: LogNormalDistribution.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public LogNormalDistribution(double mean, double stddev, DataType datatype, long... shape){
    this(Nd4j.createUninitialized(datatype, shape), mean, stddev);
}
 
Example 14
Source File: Transforms.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public static INDArray xor(INDArray x, INDArray y) {
    INDArray z = Nd4j.createUninitialized(DataType.BOOL, x.shape(), x.ordering());
    Nd4j.getExecutioner().exec(new Xor(x, y, z, 0.0));
    return z;
}
 
Example 15
Source File: ValidateCudnnDropout.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Test
    public void testCudnnDropoutSimple() {
        for (int[] shape : new int[][]{{10, 10}, {5, 2, 5, 2}}) {

            Nd4j.getRandom().setSeed(12345);
            INDArray in = Nd4j.ones(shape);
            double pRetain = 0.25;
            double valueIfKept = 1.0 / pRetain;

            CudnnDropoutHelper d = new CudnnDropoutHelper(DataType.DOUBLE);

            INDArray out = Nd4j.createUninitialized(shape);
            d.applyDropout(in, out, pRetain);

            int countZero = Nd4j.getExecutioner().execAndReturn(new MatchCondition(out, Conditions.equals(0.0))).z().getInt(0);
            int countNonDropped = Nd4j.getExecutioner().execAndReturn(new MatchCondition(out, Conditions.equals(valueIfKept))).z().getInt(0);
//            System.out.println(countZero);
//            System.out.println(countNonDropped);

            assertTrue(String.valueOf(countZero), countZero >= 5 && countZero <= 90);
            assertTrue(String.valueOf(countNonDropped), countNonDropped >= 5 && countNonDropped <= 95);
            assertEquals(100, countZero + countNonDropped);

            //Test repeatability:
            for (int i = 0; i < 10; i++) {
                Nd4j.getRandom().setSeed(12345);
                d.setRngStates(null);
                d.setMask(null);

                INDArray outNew = Nd4j.createUninitialized(shape);
                d.applyDropout(in, outNew, pRetain);

                assertEquals(out, outNew);
            }

            //Test backprop:
            INDArray gradAtOut = Nd4j.ones(shape);
            INDArray gradAtInput = Nd4j.createUninitialized(shape);
            d.backprop(gradAtOut, gradAtInput);
            Nd4j.getExecutioner().commit();

            //If dropped: expect 0. Otherwise: expect 1/pRetain, i.e., output for 1s input
            assertEquals(out, gradAtInput);
        }
    }
 
Example 16
Source File: WordVectorSerializer.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public static <T extends SequenceElement> WeightLookupTable<T> readLookupTable(InputStream stream)
        throws IOException {
    WeightLookupTable<T> weightLookupTable = null;
    AbstractCache<VocabWord> vocabCache = new AbstractCache<>();
    final int startSyn0 = 4;
    boolean headerRead = false;
    int numWords = -1, layerSize = -1, totalNumberOfDocs = -1;
    try {
        INDArray syn0 = null;
        int index = 0;
        for (String line : IOUtils.readLines(stream)) {
            String[] tokens = line.split(" ");
            if (!headerRead) {
                // reading header as "NUM_WORDS VECTOR_SIZE NUM_DOCS"
                numWords = Integer.parseInt(tokens[0]);
                layerSize = Integer.parseInt(tokens[1]);
                totalNumberOfDocs = Integer.parseInt(tokens[2]);
                log.debug("Reading header - words: {}, layerSize: {}, totalNumberOfDocs: {}",
                        numWords, layerSize, totalNumberOfDocs);
                headerRead = true;
                weightLookupTable = new InMemoryLookupTable.Builder().cache(vocabCache).vectorLength(layerSize).build();
            } else {
                String label = ReadHelper.decodeB64(tokens[0]);
                int freq = Integer.parseInt(tokens[1]);
                int rows = Integer.parseInt(tokens[2]);
                int cols = Integer.parseInt(tokens[3]);

                if (syn0 == null)
                    syn0  = Nd4j.createUninitialized(rows, cols);

                int i = startSyn0;
                for (int r = 0; r < rows; ++r) {
                    double[] vector = new double[cols];
                    for (int c = 0;  c < cols; ++c) {
                        vector[c] = Double.parseDouble(tokens[i]);
                        ++i;
                    }
                    syn0.putRow(r, Nd4j.create(vector));
                }

                VocabWord vw = new VocabWord(freq, label);
                vw.setIndex(index);
                weightLookupTable.getVocabCache().addToken((T)vw);
                weightLookupTable.getVocabCache().addWordToIndex(index, label);
                ++index;
            }
        }
        ((InMemoryLookupTable<T>) weightLookupTable).setSyn0(syn0);
    }
    finally {
        stream.close();
    }
    return weightLookupTable;
}
 
Example 17
Source File: BinomialDistribution.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
public BinomialDistribution(int trials, double probability, DataType dt, long[] shape){
    this(Nd4j.createUninitialized(dt, shape), trials, probability);
}
 
Example 18
Source File: JCublasNDArrayFactory.java    From nd4j with Apache License 2.0 4 votes vote down vote up
@Override
public INDArray pullRows(INDArray source, INDArray destination, int sourceDimension, int[] indexes) {
    if (Nd4j.getExecutioner() instanceof GridExecutioner)
        ((GridExecutioner) Nd4j.getExecutioner()).flushQueue();

    if (indexes == null || indexes.length < 1)
        throw new IllegalStateException("Indexes can't be null or zero-length");

    long[] shape = null;
    if (sourceDimension == 1)
        shape = new long[] {indexes.length, source.shape()[sourceDimension]};
    else if (sourceDimension == 0)
        shape = new long[] {source.shape()[sourceDimension], indexes.length};
    else
        throw new UnsupportedOperationException("2D input is expected");

    INDArray ret = destination;
    if(ret == null){
        ret = Nd4j.createUninitialized(shape, order);
    } else {
        if(!Arrays.equals(shape, destination.shape())){
            throw new IllegalStateException("Cannot pull rows into destination array: expected destination array of" +
                    " shape " + Arrays.toString(shape) + " but got destination array of shape " + Arrays.toString(destination.shape()));
        }
    }

    AtomicAllocator allocator = AtomicAllocator.getInstance();
    CudaContext context = allocator.getFlowController().prepareAction(ret, source);

    Pointer x = AtomicAllocator.getInstance().getPointer(source, context);
    Pointer xShape = AtomicAllocator.getInstance().getPointer(source.shapeInfoDataBuffer(), context);
    Pointer z = AtomicAllocator.getInstance().getPointer(ret, context);
    Pointer zShape = AtomicAllocator.getInstance().getPointer(ret.shapeInfoDataBuffer(), context);

    PointerPointer extras = new PointerPointer(AddressRetriever.retrieveHostPointer(ret.shapeInfoDataBuffer()),
            context.getOldStream(), allocator.getDeviceIdPointer());

    val tempIndexes = new CudaLongDataBuffer(indexes.length);
    AtomicAllocator.getInstance().memcpyBlocking(tempIndexes, new LongPointer(ArrayUtil.toLongArray(indexes)), indexes.length * 8, 0);

    Pointer pIndex = AtomicAllocator.getInstance().getPointer(tempIndexes, context);

    TADManager tadManager = Nd4j.getExecutioner().getTADManager();

    Pair<DataBuffer, DataBuffer> tadBuffers = tadManager.getTADOnlyShapeInfo(source, new int[] {sourceDimension});
    Pair<DataBuffer, DataBuffer> zTadBuffers = tadManager.getTADOnlyShapeInfo(ret, new int[] {sourceDimension});

    Pointer tadShapeInfo = AtomicAllocator.getInstance().getPointer(tadBuffers.getFirst(), context);
    Pointer zTadShapeInfo = AtomicAllocator.getInstance().getPointer(zTadBuffers.getFirst(), context);

    DataBuffer offsets = tadBuffers.getSecond();
    Pointer tadOffsets = AtomicAllocator.getInstance().getPointer(offsets, context);

    Pointer zTadOffsets = AtomicAllocator.getInstance().getPointer(zTadBuffers.getSecond(), context);

    if (ret.data().dataType() == DataBuffer.Type.DOUBLE) {
        nativeOps.pullRowsDouble(extras, (DoublePointer) x, (LongPointer) xShape, (DoublePointer) z,
                (LongPointer) zShape, indexes.length, (LongPointer) pIndex, (LongPointer) tadShapeInfo,
                new LongPointerWrapper(tadOffsets), (LongPointer) zTadShapeInfo, new LongPointerWrapper(zTadOffsets));
    } else if (ret.data().dataType() == DataBuffer.Type.FLOAT) {
        nativeOps.pullRowsFloat(extras, (FloatPointer) x, (LongPointer) xShape, (FloatPointer) z,
                (LongPointer) zShape, indexes.length, (LongPointer) pIndex, (LongPointer) tadShapeInfo,
                new LongPointerWrapper(tadOffsets), (LongPointer) zTadShapeInfo, new LongPointerWrapper(zTadOffsets));
    } else {
        nativeOps.pullRowsHalf(extras, (ShortPointer) x, (LongPointer) xShape, (ShortPointer) z, (LongPointer) zShape,
                indexes.length, (LongPointer) pIndex, (LongPointer) tadShapeInfo, new LongPointerWrapper(tadOffsets),
                (LongPointer) zTadShapeInfo, new LongPointerWrapper(zTadOffsets));
    }

    allocator.registerAction(context, ret, source);

    return ret;
}
 
Example 19
Source File: NormalDistribution.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Override
public INDArray sample(int[] shape) {
    final INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
    return sample(ret);
}
 
Example 20
Source File: CudaExecutioner.java    From deeplearning4j with Apache License 2.0 4 votes vote down vote up
@Override
public INDArray exec(ReduceOp op) {
    checkForCompression(op);

    if(op instanceof BaseReduceOp && ((BaseReduceOp)op).isEmptyReduce()){
        //Edge case for TF import compatibility: [x,y].reduce(empty) = [x,y]
        //Note that "empty" axis is NOT the same as length 0, as in INDArray.sum(new int[0]), which means "all dimensions"
        if(op.z() != null){
            Preconditions.checkState(op.x().equalShapes(op.z()), "For empty reductions, result (z) array must have same shape as x shape." +
                    " Got: x=%ndShape, z=%ndShape", op.x(), op.z());
            op.z().assign(op.x());
            return op.z();
        } else {
            op.setZ(op.x().dup());
            return op.z();
        }
    }

    val dimension = op.dimensions().toIntVector();

    if (extraz.get() == null)
        extraz.set(new PointerPointer(32));

    val maxShape = Shape.getMaxShape(op.x(),op.y());

    val wholeDims = Shape.wholeArrayDimension(dimension) || op.x().rank() == dimension.length || dimension.length == 0;
    val retShape = Shape.reductionShape(op.y() == null ? op.x() : op.x().length() > op.y().length() ? op.x() : op.y(), dimension, true, op.isKeepDims());

    if (op.x().isVector() && op.x().length() == ArrayUtil.prod(retShape) && ArrayUtil.prodLong(retShape) > 1 && op.y() == null)
        return op.noOp();

    val dtype = op.resultType();
    INDArray ret = null;
    if (op.z() == null || op.z() == op.x()) {
        if (op.isComplexAccumulation()) {
            val xT = op.x().tensorsAlongDimension(dimension);
            val yT = op.y().tensorsAlongDimension(dimension);

            // we intentionally want to set it to 0.0
            ret = Nd4j.createUninitialized(dtype, new long[] {xT, yT});
        } else {
            if (op.y() != null) {
                //2 options here: either pairwise, equal sizes - OR every X TAD vs. entirety of Y
                if (op.x().length() == op.y().length()) {
                    //Pairwise
                    if (!wholeDims && op.x().tensorsAlongDimension(dimension) != op.y().tensorsAlongDimension(dimension)) {
                        throw new ND4JIllegalStateException("Number of TADs along dimension don't match: (x shape = " +
                                Arrays.toString(op.x().shape()) + ", y shape = " + Arrays.toString(op.y().shape()) +
                                ", dimension = " + Arrays.toString(dimension) + ")");
                    }
                } else {
                    if (dimension.length == 0)
                        throw new ND4JIllegalStateException("TAD vs TAD comparison requires dimension (or other comparison mode was supposed to be used?)");

                    //Every X TAD vs. entirety of Y
                    val xTADSize = op.x().length() / op.x().tensorsAlongDimension(dimension);

                    if (xTADSize != op.y().length()) {
                        throw new ND4JIllegalStateException("Size of TADs along dimension don't match for pairwise execution:" +
                                " (x TAD size = " + xTADSize + ", y size = " + op.y().length());
                    }
                }
            }

            // in case of regular accumulation we don't care about array state before op
            ret = Nd4j.create(dtype, retShape);
        }
        op.setZ(ret);
    } else {
        // compare length

        if (op.z().length() != (retShape.length == 0 ? 1 : ArrayUtil.prodLong(retShape)))
            throw new ND4JIllegalStateException("Shape of target array for reduction [" + Arrays.toString(op.z().shape()) + "] doesn't match expected [" + Arrays.toString(retShape) + "]");
    }

    long st = profilingConfigurableHookIn(op);
    naiveExec(op, dimension);

    profilingConfigurableHookOut(op, null, st);

    return op.z();
}