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

ND4J: INDArray.get(interval(x,y)) on rank 1 array returns rank 2 array #6347

Closed
AlexDBlack opened this Issue Sep 3, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@AlexDBlack
Copy link
Member

AlexDBlack commented Sep 3, 2018

Increasing the rank of the array doesn't make sense for the 1D input case.

    @Test
    public void testInterval1d(){
        INDArray arr = Nd4j.linspace(1, 10, 10).reshape(10);
        INDArray subset = arr.get(NDArrayIndex.interval(5,10));
        INDArray exp = Nd4j.trueVector(new double[]{6,7,8,9,10});

        assertArrayEquals(new long[]{5}, subset.shape());
        assertEquals(exp, subset);
    }

Note also that the equality is actually passing here too, but I don't think it should - expected has shape [5] but subset has shape [1,5]

@raver119

This comment has been minimized.

Copy link
Contributor

raver119 commented Sep 3, 2018

I think we should just update Nd4j code, and retire old logic of 2D vectors/scalars.

AlexDBlack added a commit that referenced this issue Oct 3, 2018

AlexDBlack added a commit that referenced this issue Oct 4, 2018

More Misc DL4J/ND4J Fixes (#6510)
* #6483 ClassPathResource non-JAR directory fix

* #6362 Add system properties for DL4J and ND4J temporary file locations

* #6347 Fix NDArray.get() on 1d with single interval

* #6276 Make MLN/CG.clearLayerStates() public

* Trigger CI

* Test fixes

* Re-add model guesser method still needed downstream
@lock

This comment has been minimized.

Copy link

lock bot commented Nov 3, 2018

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 Nov 3, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.