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

ND4J: Create empty arrays only once in Nd4j.empty(DataType) #7168

AlexDBlack opened this issue Feb 14, 2019 · 2 comments · Fixed by #7340


Copy link

commented Feb 14, 2019

Empty arrays are immutable. There's no point creating them more than once per datatype.
So let's have ND4J.empty(DataType) create them only one and return the same object for subsequent calls.

Aha! Link:


This comment has been minimized.

Copy link

commented Feb 14, 2019

Hm, but technically that's exactly what happens:

  1. data buffer isn't created
  2. shapeInfo buffer is created/filled only once per data type. Subsequent calls will use the same shapeinfo

So, we obviously can make it work in a factory way, but it won't bring us too much performance gains.

@agibsonccc agibsonccc added the ND4J label Mar 18, 2019

@AlexDBlack AlexDBlack self-assigned this Mar 27, 2019

AlexDBlack added a commit that referenced this issue Mar 27, 2019
AlexDBlack added a commit that referenced this issue Mar 28, 2019
[WIP] Misc DL4J/ND4J/DataVec Issues (#7340)
* Add FirstDigitTransform (Benfords law) + tests

* Javadoc, polish

* #7325 Fix SameDiff.asFlatPrint

* Refactor DataVec readers to remove hard-coded use of Files, in favor of streams

* Add StreamInputSplit (partly complete)

* More tests, fixes

* Fixes for model import test failures

* DataVec fixes after earlier changes

* Another DataVec fix

* #7355 SameDiff array reuse fix

* #7343 SameDiff method for Pad op

* #7305 Fix getColumn on row vector (returning scalar, not view)

* #7168 Empty arrays - create only once

* #7002 Remove newFormat arg/field

* #7352 MultiLayerNetwork.output(DataSetIterator) validation

* Fixes

* Small fixes

* SameDiff variables: Switch to LinkedHashMap for consitent iteration order

* Fix validation NPE for LogFileWriter

* Reduce3 fixes

* Small test fix

* Small test fix

* Fix bad test

* Small test threshold tweak

* OpProfiler fix: null x array (random ops etc)

* Fix issue with array order not matching flattening order when Nd4j.ordering() == f - Nd4j.createFromArray

This comment has been minimized.

Copy link

commented Apr 27, 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 27, 2019

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