Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeat() does not work on array slice #7277

Closed
nicoulaj opened this Issue Mar 11, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@nicoulaj
Copy link

commented Mar 11, 2019

Issue Description

This test:

@Test
public void testBugRepeatOnSlicedArray() {

    // Create a 2D array (shape 5x5)
    INDArray array = Nd4j.arange(25).reshape(5, 5);

    // Get first column (shape 5x1)
    INDArray slice = array.get(NDArrayIndex.all(), NDArrayIndex.point(0));

    // Repeat column on sliced array (shape 5x3)
    INDArray repeatedSlice = slice.repeat(1, (long) 3);

    // Same thing but copy array first
    INDArray repeatedDup = slice.dup().repeat(1, (long) 3);

    // Check result
    assertEquals(repeatedSlice, repeatedDup);
}

throws:

FAILED: testBugRepeatOnSlicedArray
java.lang.AssertionError: expected [[[         0,         0,         0],
 [    5.0000,    5.0000,    5.0000],
 [   10.0000,   10.0000,   10.0000],
 [   15.0000,   15.0000,   15.0000],
 [   20.0000,   20.0000,   20.0000]]] but found [[[         0,         0,         0],
 [    1.0000,    1.0000,    1.0000],
 [    2.0000,    2.0000,    2.0000],
 [    3.0000,    3.0000,    3.0000],
 [    4.0000,    4.0000,    4.0000]]]
	at org.testng.Assert.fail(Assert.java:93)

Calling repeat() on an array slice procuces wrong results.

Version Information

  • Deeplearning4j version: sonatype repo 1.0.0 snapshot: 1.0.0-20190308.084722-15882
  • platform information (OS, etc): linux x86_64
  • CUDA version, if used: N/A
  • NVIDIA driver version, if in use: N/A

Aha! Link: https://skymindai.aha.io/features/ND4J-90

@AlexDBlack AlexDBlack self-assigned this Mar 13, 2019

AlexDBlack added a commit that referenced this issue Mar 13, 2019

AlexDBlack added a commit that referenced this issue Mar 18, 2019

[WIP] Various DL4J/ND4J fixes (#7293)
* Evaluation - segmentation support

* ROCBinary and ROCMultiClass segmentation support

* Fixes and EvaluationCalibration segmentation support

* ROC

* #7225 L2NormalizeVertex equals/hashCode fix

* #7268 Fix zeros constructor issue

* #7217 Fix (+ optimize) ConvolutionalIterationListener

* #7292 INDArray.reshape overload - enforce no view

* #7252 Remove Nd4j.emptyLike in favor of Nd4j.zerosLike

* #7277 Switch INDArray.repeat to native op to fix issue

* #7275 Nd4j.meshGrid dtype fix

* Switch Nd4j.tensorMmul to use custom op

* Small fixes

* Small fixes
@lock

This comment has been minimized.

Copy link

commented Apr 17, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 17, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.