2019-06-06 14:21:15 +02:00
|
|
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @const
|
|
|
|
* @namespace
|
|
|
|
*/
|
|
|
|
var nd4j = nd4j || {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @const
|
|
|
|
* @namespace
|
|
|
|
*/
|
|
|
|
nd4j.graph = nd4j.graph || {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @enum
|
|
|
|
*/
|
|
|
|
nd4j.graph.VarType = {
|
|
|
|
VARIABLE: 0,
|
|
|
|
CONSTANT: 1,
|
|
|
|
ARRAY: 2,
|
|
|
|
PLACEHOLDER: 3
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable = function() {
|
|
|
|
/**
|
|
|
|
* @type {flatbuffers.ByteBuffer}
|
|
|
|
*/
|
|
|
|
this.bb = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {number}
|
|
|
|
*/
|
|
|
|
this.bb_pos = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {number} i
|
|
|
|
* @param {flatbuffers.ByteBuffer} bb
|
|
|
|
* @returns {nd4j.graph.FlatVariable}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.__init = function(i, bb) {
|
|
|
|
this.bb_pos = i;
|
|
|
|
this.bb = bb;
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.ByteBuffer} bb
|
|
|
|
* @param {nd4j.graph.FlatVariable=} obj
|
|
|
|
* @returns {nd4j.graph.FlatVariable}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.getRootAsFlatVariable = function(bb, obj) {
|
|
|
|
return (obj || new nd4j.graph.FlatVariable).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {nd4j.graph.IntPair=} obj
|
|
|
|
* @returns {nd4j.graph.IntPair|null}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.id = function(obj) {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 4);
|
|
|
|
return offset ? (obj || new nd4j.graph.IntPair).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Encoding=} optionalEncoding
|
|
|
|
* @returns {string|Uint8Array|null}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.name = function(optionalEncoding) {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 6);
|
|
|
|
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2019-09-04 08:36:11 +02:00
|
|
|
* @returns {nd4j.graph.DType}
|
2019-06-06 14:21:15 +02:00
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.dtype = function() {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 8);
|
2019-09-04 08:36:11 +02:00
|
|
|
return offset ? /** @type {nd4j.graph.DType} */ (this.bb.readInt8(this.bb_pos + offset)) : nd4j.graph.DType.INHERIT;
|
2019-06-06 14:21:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {number} index
|
|
|
|
* @returns {flatbuffers.Long}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.shape = function(index) {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
|
|
return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : this.bb.createLong(0, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.shapeLength = function() {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 10);
|
|
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {nd4j.graph.FlatArray=} obj
|
|
|
|
* @returns {nd4j.graph.FlatArray|null}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.ndarray = function(obj) {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 12);
|
|
|
|
return offset ? (obj || new nd4j.graph.FlatArray).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.device = function() {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 14);
|
|
|
|
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {nd4j.graph.VarType}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.variabletype = function() {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 16);
|
|
|
|
return offset ? /** @type {nd4j.graph.VarType} */ (this.bb.readInt8(this.bb_pos + offset)) : nd4j.graph.VarType.VARIABLE;
|
|
|
|
};
|
|
|
|
|
SameDiff execution, TF and memory management overhaul (#10)
* SameDiff execution memory management improvements, round 1
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Round 2
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Round 3
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Clear node outputs closed array references; Slight change to OpValidation internals to not rely on cached op outputs
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next step
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add WeakIdentityHashmap
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Session fixes for control ops and next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First steps for training session + in-line updating
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix losses and history during training
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* BiasAdd and other fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Don't use SDVariable.getArr() in TFGraphTestAllHelper (import tests)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First steps for new dependency tracking approach
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Start integrating dependency tracking for memory management
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Non-control op dependency tracking works/passes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Switch/merge
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix issue dependency tracking for initial variables/constants
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add check for aliases when determining if safe to close array
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First pass on new TF graph import class
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Import fixes, op fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and fixes for new TF import mapper
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Partial implementation of new dependency tracker
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* AbstractDependencyTracker for shared code
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Overhaul SameDiff graph execution (dependency tracking)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes, cleanup, next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Ad no-op memory manager, cleanup, fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix switch dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* INDArray.toString: no exception on closed arrays, just note closed
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix enter and exit dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* TensorArray memory management fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add unique ID for INDArray instances
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix memory management for NextIteration outputs in multi-iteration loops
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Remove (now unnecessary) special case handling for nested enters
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Handle control dependencies during execution; javadoc for memory managers
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup, polish, code comments, javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and more javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add memory validation for all TF import tests - ensure all arrays (except outputs) are released
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Clean up arrays waiting on unexecuted ops at the end of execution
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fixes for enter op memory managent in the context of multiple non-nested loops/frames
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix order of operation issues for dependency tracker
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Always clear op fields after execution to avoid leaks or unintended array reuse
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Re-implement dtype conversion
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix for control dependencies execution (dependency tracking)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix TF import overrides and filtering
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix for constant enter array dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* DL4J Fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More DL4J fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More polish and javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More logging level tweaks, small DL4J fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix to DL4J SameDiffLayer
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix empty array deserialization, add extra deserialization checks
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers control dep serialization fixes; test serialization as part of all TF import tests
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Variable control dependencies serialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix issue with removing inputs for ops
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers NDArray deserialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers NDArray deserialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Final cleanup/polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
2019-10-23 12:19:50 +02:00
|
|
|
/**
|
|
|
|
* @param {number} index
|
|
|
|
* @param {flatbuffers.Encoding=} optionalEncoding
|
|
|
|
* @returns {string|Uint8Array}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.controlDeps = function(index, optionalEncoding) {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 18);
|
|
|
|
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.controlDepsLength = function() {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 18);
|
|
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {number} index
|
|
|
|
* @param {flatbuffers.Encoding=} optionalEncoding
|
|
|
|
* @returns {string|Uint8Array}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.controlDepForOp = function(index, optionalEncoding) {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
|
|
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.controlDepForOpLength = function() {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 20);
|
|
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {number} index
|
|
|
|
* @param {flatbuffers.Encoding=} optionalEncoding
|
|
|
|
* @returns {string|Uint8Array}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.controlDepsForVar = function(index, optionalEncoding) {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 22);
|
|
|
|
return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.prototype.controlDepsForVarLength = function() {
|
|
|
|
var offset = this.bb.__offset(this.bb_pos, 22);
|
|
|
|
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
|
|
|
};
|
|
|
|
|
2019-06-06 14:21:15 +02:00
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.startFlatVariable = function(builder) {
|
SameDiff execution, TF and memory management overhaul (#10)
* SameDiff execution memory management improvements, round 1
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Round 2
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Round 3
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Clear node outputs closed array references; Slight change to OpValidation internals to not rely on cached op outputs
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next step
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add WeakIdentityHashmap
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Session fixes for control ops and next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First steps for training session + in-line updating
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix losses and history during training
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* BiasAdd and other fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Don't use SDVariable.getArr() in TFGraphTestAllHelper (import tests)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First steps for new dependency tracking approach
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Start integrating dependency tracking for memory management
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Non-control op dependency tracking works/passes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Switch/merge
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix issue dependency tracking for initial variables/constants
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add check for aliases when determining if safe to close array
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First pass on new TF graph import class
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Import fixes, op fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and fixes for new TF import mapper
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Partial implementation of new dependency tracker
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* AbstractDependencyTracker for shared code
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Overhaul SameDiff graph execution (dependency tracking)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes, cleanup, next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Ad no-op memory manager, cleanup, fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix switch dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* INDArray.toString: no exception on closed arrays, just note closed
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix enter and exit dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* TensorArray memory management fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add unique ID for INDArray instances
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix memory management for NextIteration outputs in multi-iteration loops
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Remove (now unnecessary) special case handling for nested enters
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Handle control dependencies during execution; javadoc for memory managers
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup, polish, code comments, javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and more javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add memory validation for all TF import tests - ensure all arrays (except outputs) are released
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Clean up arrays waiting on unexecuted ops at the end of execution
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fixes for enter op memory managent in the context of multiple non-nested loops/frames
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix order of operation issues for dependency tracker
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Always clear op fields after execution to avoid leaks or unintended array reuse
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Re-implement dtype conversion
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix for control dependencies execution (dependency tracking)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix TF import overrides and filtering
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix for constant enter array dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* DL4J Fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More DL4J fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More polish and javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More logging level tweaks, small DL4J fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix to DL4J SameDiffLayer
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix empty array deserialization, add extra deserialization checks
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers control dep serialization fixes; test serialization as part of all TF import tests
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Variable control dependencies serialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix issue with removing inputs for ops
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers NDArray deserialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers NDArray deserialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Final cleanup/polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
2019-10-23 12:19:50 +02:00
|
|
|
builder.startObject(10);
|
2019-06-06 14:21:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} idOffset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addId = function(builder, idOffset) {
|
|
|
|
builder.addFieldOffset(0, idOffset, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} nameOffset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addName = function(builder, nameOffset) {
|
|
|
|
builder.addFieldOffset(1, nameOffset, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
2019-09-04 08:36:11 +02:00
|
|
|
* @param {nd4j.graph.DType} dtype
|
2019-06-06 14:21:15 +02:00
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addDtype = function(builder, dtype) {
|
2019-09-04 08:36:11 +02:00
|
|
|
builder.addFieldInt8(2, dtype, nd4j.graph.DType.INHERIT);
|
2019-06-06 14:21:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} shapeOffset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addShape = function(builder, shapeOffset) {
|
|
|
|
builder.addFieldOffset(3, shapeOffset, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {Array.<flatbuffers.Long>} data
|
|
|
|
* @returns {flatbuffers.Offset}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.createShapeVector = function(builder, data) {
|
|
|
|
builder.startVector(8, data.length, 8);
|
|
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
|
|
builder.addInt64(data[i]);
|
|
|
|
}
|
|
|
|
return builder.endVector();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {number} numElems
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.startShapeVector = function(builder, numElems) {
|
|
|
|
builder.startVector(8, numElems, 8);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} ndarrayOffset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addNdarray = function(builder, ndarrayOffset) {
|
|
|
|
builder.addFieldOffset(4, ndarrayOffset, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {number} device
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addDevice = function(builder, device) {
|
|
|
|
builder.addFieldInt32(5, device, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {nd4j.graph.VarType} variabletype
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addVariabletype = function(builder, variabletype) {
|
|
|
|
builder.addFieldInt8(6, variabletype, nd4j.graph.VarType.VARIABLE);
|
|
|
|
};
|
|
|
|
|
SameDiff execution, TF and memory management overhaul (#10)
* SameDiff execution memory management improvements, round 1
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Round 2
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Round 3
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Clear node outputs closed array references; Slight change to OpValidation internals to not rely on cached op outputs
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next step
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add WeakIdentityHashmap
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Session fixes for control ops and next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First steps for training session + in-line updating
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix losses and history during training
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* BiasAdd and other fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Don't use SDVariable.getArr() in TFGraphTestAllHelper (import tests)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First steps for new dependency tracking approach
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Start integrating dependency tracking for memory management
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Non-control op dependency tracking works/passes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Switch/merge
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix issue dependency tracking for initial variables/constants
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add check for aliases when determining if safe to close array
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* First pass on new TF graph import class
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Import fixes, op fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and fixes for new TF import mapper
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Partial implementation of new dependency tracker
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* AbstractDependencyTracker for shared code
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Overhaul SameDiff graph execution (dependency tracking)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More fixes, cleanup, next steps
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Ad no-op memory manager, cleanup, fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix switch dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* INDArray.toString: no exception on closed arrays, just note closed
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix enter and exit dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* TensorArray memory management fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add unique ID for INDArray instances
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix memory management for NextIteration outputs in multi-iteration loops
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Remove (now unnecessary) special case handling for nested enters
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Handle control dependencies during execution; javadoc for memory managers
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup, polish, code comments, javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and more javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Add memory validation for all TF import tests - ensure all arrays (except outputs) are released
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Clean up arrays waiting on unexecuted ops at the end of execution
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fixes for enter op memory managent in the context of multiple non-nested loops/frames
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix order of operation issues for dependency tracker
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Always clear op fields after execution to avoid leaks or unintended array reuse
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Re-implement dtype conversion
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix for control dependencies execution (dependency tracking)
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix TF import overrides and filtering
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix for constant enter array dependency tracking
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* DL4J Fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More DL4J fixes
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Cleanup and polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More polish and javadoc
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* More logging level tweaks, small DL4J fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix to DL4J SameDiffLayer
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix empty array deserialization, add extra deserialization checks
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers control dep serialization fixes; test serialization as part of all TF import tests
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Variable control dependencies serialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Fix issue with removing inputs for ops
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers NDArray deserialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* FlatBuffers NDArray deserialization fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Small fix
Signed-off-by: AlexDBlack <blacka101@gmail.com>
* Final cleanup/polish
Signed-off-by: AlexDBlack <blacka101@gmail.com>
2019-10-23 12:19:50 +02:00
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} controlDepsOffset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addControlDeps = function(builder, controlDepsOffset) {
|
|
|
|
builder.addFieldOffset(7, controlDepsOffset, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {Array.<flatbuffers.Offset>} data
|
|
|
|
* @returns {flatbuffers.Offset}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.createControlDepsVector = function(builder, data) {
|
|
|
|
builder.startVector(4, data.length, 4);
|
|
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
|
|
builder.addOffset(data[i]);
|
|
|
|
}
|
|
|
|
return builder.endVector();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {number} numElems
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.startControlDepsVector = function(builder, numElems) {
|
|
|
|
builder.startVector(4, numElems, 4);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} controlDepForOpOffset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addControlDepForOp = function(builder, controlDepForOpOffset) {
|
|
|
|
builder.addFieldOffset(8, controlDepForOpOffset, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {Array.<flatbuffers.Offset>} data
|
|
|
|
* @returns {flatbuffers.Offset}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.createControlDepForOpVector = function(builder, data) {
|
|
|
|
builder.startVector(4, data.length, 4);
|
|
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
|
|
builder.addOffset(data[i]);
|
|
|
|
}
|
|
|
|
return builder.endVector();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {number} numElems
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.startControlDepForOpVector = function(builder, numElems) {
|
|
|
|
builder.startVector(4, numElems, 4);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} controlDepsForVarOffset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.addControlDepsForVar = function(builder, controlDepsForVarOffset) {
|
|
|
|
builder.addFieldOffset(9, controlDepsForVarOffset, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {Array.<flatbuffers.Offset>} data
|
|
|
|
* @returns {flatbuffers.Offset}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.createControlDepsForVarVector = function(builder, data) {
|
|
|
|
builder.startVector(4, data.length, 4);
|
|
|
|
for (var i = data.length - 1; i >= 0; i--) {
|
|
|
|
builder.addOffset(data[i]);
|
|
|
|
}
|
|
|
|
return builder.endVector();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {number} numElems
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.startControlDepsForVarVector = function(builder, numElems) {
|
|
|
|
builder.startVector(4, numElems, 4);
|
|
|
|
};
|
|
|
|
|
2019-06-06 14:21:15 +02:00
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @returns {flatbuffers.Offset}
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.endFlatVariable = function(builder) {
|
|
|
|
var offset = builder.endObject();
|
|
|
|
return offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {flatbuffers.Builder} builder
|
|
|
|
* @param {flatbuffers.Offset} offset
|
|
|
|
*/
|
|
|
|
nd4j.graph.FlatVariable.finishFlatVariableBuffer = function(builder, offset) {
|
|
|
|
builder.finish(offset);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Exports for Node.js and RequireJS
|
|
|
|
this.nd4j = nd4j;
|