2019-06-06 15:21:15 +03:00
|
|
|
# automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
|
|
|
|
# namespace: graph
|
|
|
|
|
|
|
|
import flatbuffers
|
|
|
|
|
|
|
|
class FlatNode(object):
|
|
|
|
__slots__ = ['_tab']
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def GetRootAsFlatNode(cls, buf, offset):
|
|
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
|
|
x = FlatNode()
|
|
|
|
x.Init(buf, n + offset)
|
|
|
|
return x
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Init(self, buf, pos):
|
|
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Id(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Name(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.String(o + self._tab.Pos)
|
|
|
|
return None
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OpType(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OpNum(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Properties(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
|
|
|
if o != 0:
|
|
|
|
x = self._tab.Vector(o)
|
|
|
|
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
|
|
|
x = self._tab.Indirect(x)
|
|
|
|
from .FlatProperties import FlatProperties
|
|
|
|
obj = FlatProperties()
|
|
|
|
obj.Init(self._tab.Bytes, x)
|
|
|
|
return obj
|
|
|
|
return None
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def PropertiesLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Input(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def InputAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def InputLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def InputPaired(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
|
|
|
if o != 0:
|
|
|
|
x = self._tab.Vector(o)
|
|
|
|
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
|
|
|
x = self._tab.Indirect(x)
|
|
|
|
from .IntPair import IntPair
|
|
|
|
obj = IntPair()
|
|
|
|
obj.Init(self._tab.Bytes, x)
|
|
|
|
return obj
|
|
|
|
return None
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def InputPairedLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Output(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OutputAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OutputLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraParams(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraParamsAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraParamsLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraInteger(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraIntegerAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraIntegerLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraBools(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.BoolFlags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraBoolsAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.BoolFlags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraBoolsLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Dimensions(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def DimensionsAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def DimensionsLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Device(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ScopeId(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ScopeName(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.String(o + self._tab.Pos)
|
|
|
|
return None
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OutputNames(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
|
|
|
return ""
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OutputNamesLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OpName(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.String(o + self._tab.Pos)
|
|
|
|
return None
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OutputTypes(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OutputTypesAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int8Flags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def OutputTypesLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def Scalar(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
|
|
|
|
if o != 0:
|
|
|
|
x = self._tab.Indirect(o + self._tab.Pos)
|
|
|
|
from .FlatArray import FlatArray
|
|
|
|
obj = FlatArray()
|
|
|
|
obj.Init(self._tab.Bytes, x)
|
|
|
|
return obj
|
|
|
|
return None
|
|
|
|
|
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 21:19:50 +11:00
|
|
|
# FlatNode
|
|
|
|
def ControlDeps(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
|
|
|
return ""
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ControlDepsLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def VarControlDeps(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
|
|
|
return ""
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def VarControlDepsLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ControlDepFor(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
|
|
|
|
return ""
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ControlDepForLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
2020-01-30 18:46:12 +03:00
|
|
|
# FlatNode
|
|
|
|
def ExtraTypes(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
|
|
|
|
if o != 0:
|
|
|
|
a = self._tab.Vector(o)
|
|
|
|
return self._tab.Get(flatbuffers.number_types.Int8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraTypesAsNumpy(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int8Flags, o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# FlatNode
|
|
|
|
def ExtraTypesLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
def FlatNodeStart(builder): builder.StartObject(23)
|
2019-06-06 15:21:15 +03:00
|
|
|
def FlatNodeAddId(builder, id): builder.PrependInt32Slot(0, id, 0)
|
|
|
|
def FlatNodeAddName(builder, name): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
|
|
|
|
def FlatNodeAddOpType(builder, opType): builder.PrependInt8Slot(2, opType, 0)
|
|
|
|
def FlatNodeAddOpNum(builder, opNum): builder.PrependInt64Slot(3, opNum, 0)
|
|
|
|
def FlatNodeAddProperties(builder, properties): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(properties), 0)
|
|
|
|
def FlatNodeStartPropertiesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddInput(builder, input): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(input), 0)
|
|
|
|
def FlatNodeStartInputVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddInputPaired(builder, inputPaired): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(inputPaired), 0)
|
|
|
|
def FlatNodeStartInputPairedVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddOutput(builder, output): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(output), 0)
|
|
|
|
def FlatNodeStartOutputVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddExtraParams(builder, extraParams): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(extraParams), 0)
|
|
|
|
def FlatNodeStartExtraParamsVector(builder, numElems): return builder.StartVector(8, numElems, 8)
|
|
|
|
def FlatNodeAddExtraInteger(builder, extraInteger): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(extraInteger), 0)
|
|
|
|
def FlatNodeStartExtraIntegerVector(builder, numElems): return builder.StartVector(8, numElems, 8)
|
|
|
|
def FlatNodeAddExtraBools(builder, extraBools): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(extraBools), 0)
|
|
|
|
def FlatNodeStartExtraBoolsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
|
|
|
def FlatNodeAddDimensions(builder, dimensions): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(dimensions), 0)
|
|
|
|
def FlatNodeStartDimensionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddDevice(builder, device): builder.PrependInt32Slot(12, device, 0)
|
|
|
|
def FlatNodeAddScopeId(builder, scopeId): builder.PrependInt32Slot(13, scopeId, 0)
|
|
|
|
def FlatNodeAddScopeName(builder, scopeName): builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(scopeName), 0)
|
|
|
|
def FlatNodeAddOutputNames(builder, outputNames): builder.PrependUOffsetTRelativeSlot(15, flatbuffers.number_types.UOffsetTFlags.py_type(outputNames), 0)
|
|
|
|
def FlatNodeStartOutputNamesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddOpName(builder, opName): builder.PrependUOffsetTRelativeSlot(16, flatbuffers.number_types.UOffsetTFlags.py_type(opName), 0)
|
|
|
|
def FlatNodeAddOutputTypes(builder, outputTypes): builder.PrependUOffsetTRelativeSlot(17, flatbuffers.number_types.UOffsetTFlags.py_type(outputTypes), 0)
|
|
|
|
def FlatNodeStartOutputTypesVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
|
|
|
def FlatNodeAddScalar(builder, scalar): builder.PrependUOffsetTRelativeSlot(18, flatbuffers.number_types.UOffsetTFlags.py_type(scalar), 0)
|
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 21:19:50 +11:00
|
|
|
def FlatNodeAddControlDeps(builder, controlDeps): builder.PrependUOffsetTRelativeSlot(19, flatbuffers.number_types.UOffsetTFlags.py_type(controlDeps), 0)
|
|
|
|
def FlatNodeStartControlDepsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddVarControlDeps(builder, varControlDeps): builder.PrependUOffsetTRelativeSlot(20, flatbuffers.number_types.UOffsetTFlags.py_type(varControlDeps), 0)
|
|
|
|
def FlatNodeStartVarControlDepsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
|
|
def FlatNodeAddControlDepFor(builder, controlDepFor): builder.PrependUOffsetTRelativeSlot(21, flatbuffers.number_types.UOffsetTFlags.py_type(controlDepFor), 0)
|
|
|
|
def FlatNodeStartControlDepForVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
2020-01-30 18:46:12 +03:00
|
|
|
def FlatNodeAddExtraTypes(builder, extraTypes): builder.PrependUOffsetTRelativeSlot(22, flatbuffers.number_types.UOffsetTFlags.py_type(extraTypes), 0)
|
|
|
|
def FlatNodeStartExtraTypesVector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
2019-06-06 15:21:15 +03:00
|
|
|
def FlatNodeEnd(builder): return builder.EndObject()
|