chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 24.01.18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_INPUTLIST_H
|
||||
#define LIBND4J_INPUTLIST_H
|
||||
|
||||
#include <system/common.h>
|
||||
#include <system/op_boilerplate.h>
|
||||
#include <types/pair.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT ArgumentsList {
|
||||
protected:
|
||||
std::vector<Pair> _arguments;
|
||||
|
||||
public:
|
||||
explicit ArgumentsList() = default;
|
||||
ArgumentsList(std::initializer_list<Pair> arguments);
|
||||
ArgumentsList(std::initializer_list<int> arguments);
|
||||
|
||||
~ArgumentsList() = default;
|
||||
|
||||
/**
|
||||
* This method returns number of argument pairs available
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* This method returns Pair at specified index
|
||||
*
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
Pair &at(int index);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_INPUTLIST_H
|
||||
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* *
|
||||
* *
|
||||
* * This program and the accompanying materials are made available under the
|
||||
* * terms of the Apache License, Version 2.0 which is available at
|
||||
* * https://www.apache.org/licenses/LICENSE-2.0.
|
||||
* *
|
||||
* * See the NOTICE file distributed with this work for additional
|
||||
* * information regarding copyright ownership.
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* * License for the specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
* *
|
||||
* * SPDX-License-Identifier: Apache-2.0
|
||||
* *****************************************************************************
|
||||
*/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_CONTEXT_H
|
||||
#define LIBND4J_CONTEXT_H
|
||||
#include <system/common.h>
|
||||
#include <array/NDArray.h>
|
||||
#include <execution/Engine.h>
|
||||
#include <graph/ContextPrototype.h>
|
||||
#include <graph/Variable.h>
|
||||
#include <graph/VariableSpace.h>
|
||||
#include <memory/Workspace.h>
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
/**
|
||||
* This class defines input desired for any given node/operation within graph
|
||||
*/
|
||||
class SD_LIB_EXPORT Context : public ContextPrototype {
|
||||
protected:
|
||||
memory::Workspace* _workspace = nullptr;
|
||||
VariableSpace* _variableSpace = nullptr;
|
||||
std::pair<LongType, LongType> _executionTime;
|
||||
random::RandomBuffer* _rng = nullptr;
|
||||
|
||||
DataType _dataType = FLOAT32;
|
||||
// branch for divergent_op
|
||||
int _branch = 0;
|
||||
|
||||
// temporary context for standalone ops execution
|
||||
LaunchContext* _context = nullptr;
|
||||
|
||||
std::vector<DataType> _dataTypes;
|
||||
|
||||
// fields for fast execution (out-of-graph ops use)
|
||||
std::vector<NDArray*> _fastpath_in;
|
||||
std::vector<NDArray*> _fastpath_out;
|
||||
std::vector<NDArray*> _intermediateResults;
|
||||
std::vector<NDArray*> _handles;
|
||||
|
||||
bool _helpersAllowed = true;
|
||||
|
||||
// in some cases we might be able to skip shape function for validation purposes
|
||||
bool _shapeFunctionOverride = false;
|
||||
|
||||
// special flag used during conversion from Graph exec to FastPath exec
|
||||
bool _forbidFastPath = false;
|
||||
|
||||
public:
|
||||
Context(ContextPrototype* prototype, VariableSpace* variableSpace);
|
||||
explicit Context(int nodeId, VariableSpace* variableSpace = nullptr);
|
||||
Context(int nodeId, VariableSpace* variableSpace, bool isInplace);
|
||||
|
||||
// default destructor
|
||||
~Context();
|
||||
|
||||
// these methods are for execution timing
|
||||
void setOuterTime(LongType time);
|
||||
void setInnerTime(LongType time);
|
||||
LongType getOuterTime();
|
||||
LongType getInnerTime();
|
||||
|
||||
DataType dataType() override;
|
||||
|
||||
DataType dataType(int index) override;
|
||||
void setDataType(int index, DataType type) override;
|
||||
// these methods are related to Workspace abstraction
|
||||
bool hasWorkspaceProvided();
|
||||
void attachWorkspace(memory::Workspace* workspace);
|
||||
void forgetWorkspace();
|
||||
|
||||
// these methods return full-time workspace
|
||||
memory::Workspace* getWorkspace();
|
||||
memory::Workspace* workspace();
|
||||
memory::Workspace* fWorkspace();
|
||||
|
||||
// this method returns workspace for temporary allocations
|
||||
memory::Workspace* tWorkspace();
|
||||
|
||||
// this method returns workspace for object allocations
|
||||
memory::Workspace* oWorkspace();
|
||||
|
||||
void setVariableSpace(VariableSpace* variableSpace);
|
||||
|
||||
random::RandomBuffer* getRNG();
|
||||
void setRNG(random::RandomBuffer* rng);
|
||||
|
||||
void setTargetEngine(samediff::Engine engine);
|
||||
|
||||
VariableSpace* getVariableSpace();
|
||||
|
||||
LaunchContext* launchContext();
|
||||
|
||||
// these fields define, if we can execute specific node in-place, without generating new array
|
||||
|
||||
// these variables are only for Divergent Nodes
|
||||
int getBranch();
|
||||
void setBranch(int branch);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Stash* getStash();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void trackList(NDArrayList* list);
|
||||
|
||||
/**
|
||||
* This method returns variable for a given input index for this block
|
||||
* @param idx
|
||||
* @return
|
||||
*/
|
||||
Variable* getVariable(int idx);
|
||||
Variable* variable(int idx);
|
||||
|
||||
/**
|
||||
* This method is shortcut to getVariable(int idx);
|
||||
*
|
||||
* + it check fastpath for array availability (preferred)
|
||||
* @return
|
||||
*/
|
||||
NDArray* getNDArray(int idx);
|
||||
NDArray* array(int idx);
|
||||
|
||||
/**
|
||||
* An intermediate results
|
||||
* is a performance optimization
|
||||
* meant for use with backpropagation.
|
||||
* There are many ops where a part of the forward
|
||||
* pass is used as a component of the backward pass.
|
||||
* By storing this in the context
|
||||
* it can be passed down to a backward op.
|
||||
* @param idx the index of the intermediate result
|
||||
* @return
|
||||
*/
|
||||
NDArray *intermediateResult(int idx) {
|
||||
return _intermediateResults.at(idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an intermediate result as described
|
||||
* in {@link #intermediateResult(int)}
|
||||
* @param array the intermediate result to add
|
||||
*/
|
||||
void addIntermediateResult(NDArray *array) {
|
||||
_intermediateResults.push_back(array);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the number of intermediate results
|
||||
* in this context.
|
||||
* @return
|
||||
*/
|
||||
int numIntermediates() {
|
||||
return _intermediateResults.size();
|
||||
}
|
||||
|
||||
bool hasIntermediateResults() {
|
||||
return numIntermediates() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method fetches variable from VariableSpace DIRECTLY
|
||||
* @param p
|
||||
* @return
|
||||
*/
|
||||
Variable* variable(int node, int index);
|
||||
Variable* variable(std::pair<int, int>& p);
|
||||
Variable* variable(std::initializer_list<int> p);
|
||||
|
||||
void pushNDArrayToVariableSpace(int nodeId, int index, NDArray* array, bool removable = true);
|
||||
void pushNDArrayToVariableSpace(std::pair<int, int>& pair, NDArray* array, bool removable = true);
|
||||
|
||||
void pushNDArrayListToVariableSpace(int nodeId, int index, NDArrayList* list, bool track = true);
|
||||
void pushNDArrayListToVariableSpace(std::pair<int, int>& pair, NDArrayList* list, bool track = true);
|
||||
|
||||
bool isValueAvailable(int idx = 0);
|
||||
|
||||
Variable* ensureVariable(int idx = 0);
|
||||
|
||||
unsigned long width() override;
|
||||
|
||||
unsigned long outputWidth();
|
||||
|
||||
// methods used in java interop
|
||||
/**
|
||||
* This method checks if Context uses fastpath variable access
|
||||
* @return
|
||||
*/
|
||||
bool isFastPath();
|
||||
|
||||
/**
|
||||
* Method allows to forbid FastPath execution
|
||||
* @param reallyForbid
|
||||
*/
|
||||
void forbidFastPath(bool reallyForbid);
|
||||
|
||||
|
||||
std::vector<NDArray*>& fastpath_in();
|
||||
std::vector<NDArray*>& fastpath_out();
|
||||
|
||||
|
||||
|
||||
std::vector<NDArray*>& intermediateResults() {
|
||||
return _intermediateResults;
|
||||
}
|
||||
|
||||
void pushIntermediateResult(NDArray* array) {
|
||||
_intermediateResults.push_back(array);
|
||||
}
|
||||
|
||||
void setIntermediateResult(int idx, NDArray* array) {
|
||||
if(static_cast<int>(intermediateResults().size()) < idx) {
|
||||
intermediateResults().resize(idx + 1);
|
||||
}
|
||||
|
||||
_intermediateResults[idx] = array;
|
||||
}
|
||||
|
||||
void setInputArrays(int numArrays,NDArray** array, bool removable = false);
|
||||
|
||||
void setInputArray(int index, NDArray* array, bool removable = false);
|
||||
|
||||
|
||||
void setOutputArray(int index, NDArray* array, bool removable = false);
|
||||
|
||||
|
||||
void setOutputArrays(int numArrays,NDArray** array, bool removable = false);
|
||||
|
||||
void setTArguments(double* arguments, int numberOfArguments);
|
||||
void setIArguments(LongType* arguments, int numberOfArguments);
|
||||
void setBArguments(bool* arguments, int numberOfArguments);
|
||||
void setDArguments(DataType* arguments, int numberOfArguments);
|
||||
|
||||
void setTArguments(const std::vector<double>& tArgs);
|
||||
void setIArguments(const std::vector<LongType>& tArgs);
|
||||
void setBArguments(const std::vector<bool>& tArgs);
|
||||
void setDArguments(const std::vector<DataType>& dArgs);
|
||||
|
||||
/**
|
||||
* This method purges fastpath in/out contents and releases all the handles.
|
||||
*
|
||||
* PLEASE NOTE: I/T/B/D args will stay intact
|
||||
*/
|
||||
void clearFastPath();
|
||||
|
||||
void setCudaContext(Pointer cudaStream, Pointer reductionPointer, Pointer allocationPointer);
|
||||
|
||||
void allowHelpers(bool reallyAllow);
|
||||
bool helpersAllowed();
|
||||
|
||||
void setShapeFunctionOverride(bool reallyOverride);
|
||||
bool shapeFunctionOverride();
|
||||
|
||||
samediff::ExecutionMode executionMode();
|
||||
void setExecutionMode(samediff::ExecutionMode executionMode);
|
||||
|
||||
bool isTraining();
|
||||
bool isInference();
|
||||
|
||||
NDArray* outputArray(int idx);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_BLOCK_H
|
||||
@@ -0,0 +1,141 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef ND4J_CONTEXT_PROTOTYPE_H
|
||||
#define ND4J_CONTEXT_PROTOTYPE_H
|
||||
#include <array/DataType.h>
|
||||
#include <execution/Engine.h>
|
||||
#include <execution/ExecutionMode.h>
|
||||
#include <graph/RandomGenerator.h>
|
||||
#include <ops/declarable/OpDescriptor.h>
|
||||
#include <system/Environment.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
class SD_LIB_EXPORT ContextPrototype {
|
||||
protected:
|
||||
// int ids of the input nodes
|
||||
std::vector<std::pair<int, int>> _inputs;
|
||||
int _nodeId;
|
||||
std::vector<double> _tArgs;
|
||||
std::vector<LongType> _iArgs;
|
||||
std::vector<bool> _bArgs;
|
||||
std::vector<LongType> _axis;
|
||||
std::vector<DataType> _dArgs;
|
||||
#ifndef __JAVACPP_HACK__
|
||||
std::vector<std::string> _sArgs;
|
||||
#endif
|
||||
bool _isInplace;
|
||||
|
||||
// opNum for legacy XYZ ops
|
||||
int _opNum = -1;
|
||||
uint64_t _rootSeed;
|
||||
RandomGenerator _randomGenerator;
|
||||
|
||||
std::vector<DataType> _dataTypes;
|
||||
|
||||
ops::OpDescriptor* _opDescriptor;
|
||||
bool _useONEDNN = Environment::getInstance().isUseONEDNN();
|
||||
|
||||
// target engine for execution
|
||||
samediff::Engine _engine = DEFAULT_ENGINE;
|
||||
|
||||
samediff::ExecutionMode _execMode = samediff::ExecutionMode::MODE_UNDEFINED;
|
||||
|
||||
public:
|
||||
explicit ContextPrototype(ops::OpDescriptor* opDescriptor = nullptr, int nodeId = 1, bool inPlace = false);
|
||||
~ContextPrototype() = default;
|
||||
|
||||
int getNodeId();
|
||||
int nodeId();
|
||||
|
||||
// this method returns true, if inputs are defined
|
||||
bool hasVariablesFilled();
|
||||
|
||||
void setOpDescriptor(ops::OpDescriptor* opDescriptor);
|
||||
|
||||
virtual DataType dataType();
|
||||
virtual DataType dataType(int index);
|
||||
virtual void setDataType(int index, DataType type);
|
||||
|
||||
bool isInplace();
|
||||
void markInplace(bool reallyInplace);
|
||||
|
||||
void pickInput(int input);
|
||||
void pickInput(int input, int index);
|
||||
void pickInput(std::pair<int, int>& p);
|
||||
void fillInputs(std::initializer_list<int> inputs);
|
||||
void fillInputs(std::vector<int>& inputs);
|
||||
std::vector<std::pair<int, int>>* inputs();
|
||||
|
||||
std::vector<double>* getTArguments();
|
||||
std::vector<LongType>* getIArguments();
|
||||
std::vector<bool>* getBArguments();
|
||||
std::vector<DataType>* getDArguments();
|
||||
#ifndef __JAVACPP_HACK__
|
||||
std::vector<std::string>* getSArguments();
|
||||
#endif
|
||||
std::vector<LongType>* getAxis();
|
||||
|
||||
samediff::Engine engine();
|
||||
|
||||
size_t numT();
|
||||
size_t numI();
|
||||
size_t numB();
|
||||
size_t numD();
|
||||
|
||||
std::pair<int, int>* input(int idx);
|
||||
|
||||
int opNum();
|
||||
void setOpNum(int opNum);
|
||||
|
||||
bool isUseONEDNN() { return _useONEDNN; }
|
||||
void setUseONEDNN(bool useONEDNN) { _useONEDNN = useONEDNN; }
|
||||
|
||||
/**
|
||||
* This method returns number of inputs available in this block
|
||||
* @return
|
||||
*/
|
||||
virtual unsigned long width();
|
||||
|
||||
// just a clone
|
||||
ContextPrototype* clone();
|
||||
|
||||
template <typename N>
|
||||
ContextPrototype* asT();
|
||||
|
||||
RandomGenerator& randomGenerator() { return _randomGenerator; }
|
||||
RandomGenerator const& getRng() const { return _randomGenerator; }
|
||||
void setRng(RandomGenerator const& anotherRng) { _randomGenerator = anotherRng; }
|
||||
void setRandomGenerator(RandomGenerator const& anotherRng) { _randomGenerator = anotherRng; }
|
||||
uint64_t randomSeed() const { return _rootSeed; }
|
||||
void setRandomSeed(uint64_t seed) { _rootSeed = seed; }
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // ND4J_CONTEXT_PROTOTYPE_H
|
||||
@@ -0,0 +1,97 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_EXECUTION_RESULT
|
||||
#define LIBND4J_EXECUTION_RESULT
|
||||
#include <flatbuffers/flatbuffers.h>
|
||||
#include <graph/Variable.h>
|
||||
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class ExecutionResult {
|
||||
private:
|
||||
std::vector<Variable *> _variables;
|
||||
SD_MAP_IMPL<std::string, Variable *> _stringIdMap;
|
||||
SD_MAP_IMPL<std::pair<int, int>, Variable *> _pairIdMap;
|
||||
|
||||
// this flag is used to optionally release variables
|
||||
bool _releasable = false;
|
||||
|
||||
public:
|
||||
ExecutionResult(const ::graph::FlatResult *flatResult);
|
||||
ExecutionResult(std::initializer_list<Variable *> variables);
|
||||
ExecutionResult() = default;
|
||||
~ExecutionResult();
|
||||
|
||||
/**
|
||||
* This method adds variable pointer to result
|
||||
*/
|
||||
void emplace_back(Variable *variable);
|
||||
|
||||
/**
|
||||
* This method returns Variable by its position in output
|
||||
*/
|
||||
Variable *at(int position);
|
||||
|
||||
/**
|
||||
* This method returns Variable by its string id
|
||||
*/
|
||||
Variable *byId(std::string &id);
|
||||
|
||||
/**
|
||||
* This method returns Variable by its string id
|
||||
*/
|
||||
Variable *byId(const char *str);
|
||||
|
||||
/**
|
||||
* This method returns Variable by its numeric id:index pair
|
||||
*/
|
||||
Variable *byId(std::pair<int, int> &id);
|
||||
|
||||
/**
|
||||
* This method returns Variable by its numeric id with index 0
|
||||
*/
|
||||
Variable *byId(int id);
|
||||
|
||||
/**
|
||||
* This method returns number of elements stored in this entity
|
||||
* @return
|
||||
*/
|
||||
LongType size();
|
||||
|
||||
#ifndef __JAVACPP_HACK__
|
||||
/**
|
||||
* This method converts ExecutionResult entity to FlatResult
|
||||
*/
|
||||
flatbuffers::Offset<::graph::FlatResult> asFlatResult(flatbuffers::FlatBufferBuilder &builder);
|
||||
#endif
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_EXECUTORCONFIGURATION_H
|
||||
#define LIBND4J_EXECUTORCONFIGURATION_H
|
||||
#include <graph/generated/config_generated.h>
|
||||
#include <system/common.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT ExecutorConfiguration {
|
||||
public:
|
||||
::graph::ProfilingMode _profilingMode;
|
||||
::graph::ExecutionMode _executionMode;
|
||||
::graph::OutputMode _outputMode;
|
||||
bool _timestats;
|
||||
LongType _footprintForward = 0L;
|
||||
LongType _footprintBackward = 0L;
|
||||
::graph::Direction _direction = ::graph::Direction_FORWARD_ONLY;
|
||||
|
||||
explicit ExecutorConfiguration(const ::graph::FlatConfiguration *conf = nullptr);
|
||||
~ExecutorConfiguration() = default;
|
||||
|
||||
ExecutorConfiguration *clone();
|
||||
|
||||
#ifndef __JAVACPP_HACK__
|
||||
flatbuffers::Offset<::graph::FlatConfiguration> asFlatConfiguration(flatbuffers::FlatBufferBuilder &builder);
|
||||
#endif
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_EXECUTORCONFIGURATION_H
|
||||
@@ -0,0 +1,46 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 22.11.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_FLATUTILS_H
|
||||
#define LIBND4J_FLATUTILS_H
|
||||
#include <array/NDArray.h>
|
||||
#include <graph/generated/array_generated.h>
|
||||
#include <graph/generated/node_generated.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT FlatUtils {
|
||||
public:
|
||||
static std::pair<int, int> fromIntPair(::graph::IntPair* pair);
|
||||
|
||||
static std::pair<LongType, LongType> fromLongPair(::graph::LongPair* pair);
|
||||
|
||||
static NDArray* fromFlatArray(const ::graph::FlatArray* flatArray);
|
||||
|
||||
static flatbuffers::Offset<::graph::FlatArray> toFlatArray(flatbuffers::FlatBufferBuilder& builder, NDArray& array);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_FLATUTILS_H
|
||||
@@ -0,0 +1,87 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 16/11/17.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_FLOWPATH_H
|
||||
#define LIBND4J_FLOWPATH_H
|
||||
#include <graph/FrameState.h>
|
||||
#include <graph/NodeState.h>
|
||||
#include <graph/profiling/GraphProfile.h>
|
||||
#include <system/op_boilerplate.h>
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT FlowPath {
|
||||
private:
|
||||
SD_MAP_IMPL<int, NodeState> _states;
|
||||
SD_MAP_IMPL<LongType, FrameState> _frames;
|
||||
|
||||
void ensureNode(int nodeId);
|
||||
void ensureFrame(int nodeId);
|
||||
|
||||
GraphProfile _profile;
|
||||
|
||||
public:
|
||||
FlowPath() = default;
|
||||
~FlowPath() = default;
|
||||
|
||||
void setInnerTime(int nodeId, LongType time);
|
||||
void setOuterTime(int nodeId, LongType time);
|
||||
|
||||
LongType innerTime(int nodeId);
|
||||
LongType outerTime(int nodeId);
|
||||
|
||||
bool isNodeActive(int nodeId);
|
||||
void markNodeActive(int nodeId, bool isActive);
|
||||
|
||||
bool wasExecuted(int nodeId);
|
||||
void markExecuted(int nodeId, bool wasExecuted);
|
||||
|
||||
int branch(int nodeId);
|
||||
void markBranch(int nodeId, int index);
|
||||
|
||||
// Frame-related methods
|
||||
|
||||
void registerFrame(LongType frameId);
|
||||
void forgetFrame(LongType frameId);
|
||||
|
||||
bool isFrameActive(LongType frameId);
|
||||
void markFrameActive(LongType frameId, bool isActive);
|
||||
|
||||
bool isRewindPlanned(LongType frameId);
|
||||
void planRewind(LongType frameId, bool reallyRewind);
|
||||
|
||||
int getRewindPosition(LongType frameId);
|
||||
void setRewindPosition(LongType frameId, int position);
|
||||
void setRewindPositionOnce(LongType frameId, int position);
|
||||
|
||||
void incrementNumberOfCycles(LongType frameId);
|
||||
LongType getNumberOfCycles(LongType frameId);
|
||||
|
||||
GraphProfile* profile();
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_FLOWPATH_H
|
||||
@@ -0,0 +1,109 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 06.02.2018.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_FRAMESTATE_H
|
||||
#define LIBND4J_FRAMESTATE_H
|
||||
|
||||
#include <system/common.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT FrameState {
|
||||
private:
|
||||
std::string _name;
|
||||
LongType _id = 0;
|
||||
int _numberOfCycles = 0;
|
||||
bool _activated = false;
|
||||
|
||||
bool _rewindPlanned = false;
|
||||
int _rewindPosition = -1;
|
||||
|
||||
public:
|
||||
FrameState(LongType id = 0);
|
||||
~FrameState() = default;
|
||||
|
||||
/**
|
||||
* This method returns number of cycles passed for this Frame
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getNumberOfCycles();
|
||||
|
||||
/**
|
||||
* This method increments number of cycles by 1 for this Frame
|
||||
*/
|
||||
void incrementNumberOfCycles();
|
||||
|
||||
/**
|
||||
* This method returns TRUE is frame was activated at LoopCond
|
||||
* @return
|
||||
*/
|
||||
bool wasActivated();
|
||||
|
||||
/**
|
||||
* This method allows to toggle activated state of this Frame
|
||||
* @param reallyActivated
|
||||
*/
|
||||
void markActivated(bool reallyActivated);
|
||||
|
||||
/**
|
||||
* This method returns of this Frame (if it's set)
|
||||
* @return
|
||||
*/
|
||||
std::string& getFrameName();
|
||||
|
||||
/**
|
||||
* This method returns TRUE if reset is planned for this Frame
|
||||
* @return
|
||||
*/
|
||||
bool isRewindPlanned();
|
||||
|
||||
/**
|
||||
* This method allows you to toggle flag for planned rewind
|
||||
* @param reallyPlanning
|
||||
*/
|
||||
void planRewind(bool reallyPlanning);
|
||||
|
||||
/**
|
||||
* This method returns planned reset position for given Frame
|
||||
* @return
|
||||
*/
|
||||
int getRewindPosition();
|
||||
|
||||
/**
|
||||
* This method allows to set rewind position for this Frame
|
||||
* @param pos
|
||||
*/
|
||||
void setRewindPosition(int pos);
|
||||
|
||||
/**
|
||||
* This method allows to set rewind position for this Frame, but only if it wasn't set earlier
|
||||
* @param pos
|
||||
*/
|
||||
void setRewindPositionOnce(int pos);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_FRAMESTATE_H
|
||||
@@ -0,0 +1,220 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_GRAPH_H
|
||||
#define LIBND4J_GRAPH_H
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <graph/ExecutorConfiguration.h>
|
||||
#include <graph/Node.h>
|
||||
#include <graph/Scope.h>
|
||||
#include <graph/Stash.h>
|
||||
#include <graph/Variable.h>
|
||||
#include <graph/VariableSpace.h>
|
||||
#include <graph/generated/config_generated.h>
|
||||
#include <graph/generated/graph_generated.h>
|
||||
#include <graph/generated/node_generated.h>
|
||||
#include <ops/declarable/OpDescriptor.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
class SD_LIB_EXPORT Graph {
|
||||
protected:
|
||||
ExecutorConfiguration *_configuration;
|
||||
VariableSpace *_variableSpace;
|
||||
Stash *_stash;
|
||||
|
||||
// this list holds references to Node ptrs, which should be free'd in Graph destructor
|
||||
std::vector<Node *> _handles;
|
||||
|
||||
// vector holds ID's of top nodes only
|
||||
std::vector<int> *_nodes;
|
||||
SD_MAP_IMPL<int, Node *> *_mapped;
|
||||
|
||||
SD_MAP_IMPL<int, std::vector<Node *> *> *_onion;
|
||||
SD_MAP_IMPL<int, Node *> _unmapped;
|
||||
std::vector<int> _unmappedMap; // macOS?
|
||||
|
||||
std::mutex _mutexPreprocessing;
|
||||
std::atomic<bool> _built;
|
||||
|
||||
std::vector<int> _output;
|
||||
std::vector<int> _autos;
|
||||
|
||||
SD_MAP_IMPL<int, Scope *> _mappedScopes;
|
||||
std::vector<Scope *> _scopes;
|
||||
|
||||
void expandOnion(int newLayer);
|
||||
|
||||
void injectNode(Node *node);
|
||||
|
||||
void pushToOutputOnce(int id);
|
||||
|
||||
void printOutNode(Node *node);
|
||||
|
||||
void prepareOutputs();
|
||||
|
||||
public:
|
||||
Graph(const ::graph::FlatGraph *flatGraph = nullptr, VariableSpace *variableSpace = nullptr);
|
||||
|
||||
~Graph();
|
||||
|
||||
// this method applies toposort to nodes
|
||||
void toposortNodes();
|
||||
|
||||
// method that'll print out graph
|
||||
Status validate();
|
||||
|
||||
// this method will build structured representation of graph
|
||||
Status buildGraph();
|
||||
|
||||
// this method will return estimated memory size (in bytes) required for 1 full graph execution round
|
||||
LongType estimateRequiredMemory();
|
||||
|
||||
// this method returns number of root nodes in this graph
|
||||
int rootNodes();
|
||||
|
||||
// this method returns total number of nodes in this graph
|
||||
int totalNodes();
|
||||
|
||||
int numberOfPlaceholders();
|
||||
|
||||
std::vector<Variable *> *getPlaceholders();
|
||||
|
||||
/**
|
||||
* This method returns pointer to thread_local VariableSpace
|
||||
* @return
|
||||
*/
|
||||
VariableSpace *getVariableSpace();
|
||||
|
||||
/**
|
||||
* This method adds given node to the graph
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
void addNode(Node *node);
|
||||
|
||||
/**
|
||||
* This method returns layered representation of the graph
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
SD_MAP_IMPL<int, std::vector<Node *> *> *getOnion();
|
||||
|
||||
/**
|
||||
* This method returns map of all nodes of the graph
|
||||
* @return
|
||||
*/
|
||||
SD_MAP_IMPL<int, Node *> *getMapped();
|
||||
|
||||
/**
|
||||
* This method returns outputs of this graph
|
||||
* @return
|
||||
*/
|
||||
std::vector<Variable *> *fetchOutputs();
|
||||
|
||||
/**
|
||||
* This method returns pointer to ExecutorConfiguration
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ExecutorConfiguration *getExecutorConfiguration();
|
||||
|
||||
/**
|
||||
* This method returns all nodes at once (order is NOT guaranteed)
|
||||
* @return
|
||||
*/
|
||||
std::vector<Node *> *getAllNodes();
|
||||
|
||||
/**
|
||||
* This method prints out Graph op-by-op, and respective inputs
|
||||
*/
|
||||
void printOut();
|
||||
|
||||
/**
|
||||
* This method returns OpScope ptr specified with id
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Scope *scopeById(int id);
|
||||
|
||||
/**
|
||||
* This method returns TRUE if specified ID refers to OpScope, and false otherwise
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
bool hasScope(int id);
|
||||
|
||||
/**
|
||||
* This method returns clone of the graph
|
||||
*/
|
||||
Graph *clone();
|
||||
|
||||
/**
|
||||
* This method returns clone of the graph, backed by VariableProxy instead of VariableSpace
|
||||
*/
|
||||
Graph *cloneWithProxy();
|
||||
|
||||
/**
|
||||
* This method removes reference to VariableSpace from this Graph
|
||||
*/
|
||||
void forgetVariableSpace();
|
||||
|
||||
/**
|
||||
* This method returns Node with given Id
|
||||
*/
|
||||
Node *nodeById(int nodeId);
|
||||
|
||||
/**
|
||||
* This method returns True if node with given ID exists, False otherwise
|
||||
* @param nodeId
|
||||
* @return
|
||||
*/
|
||||
bool hasNode(int nodeId);
|
||||
|
||||
/**
|
||||
* This method returns hash of given Graph instance
|
||||
*/
|
||||
LongType hashCode();
|
||||
|
||||
/**
|
||||
* PLEASE NOTE: This method will be moved to private section
|
||||
*/
|
||||
void tagInplaceNodes();
|
||||
|
||||
void replaceState(VariableSpace *state, ExecutorConfiguration *configuration);
|
||||
|
||||
SD_INLINE std::vector<int> *nodes() { return _nodes; }
|
||||
|
||||
|
||||
SD_INLINE std::vector<int> *output() { return &_output; }
|
||||
|
||||
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_GRAPH_H
|
||||
@@ -0,0 +1,79 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_GRAPHEXECUTIONER_H
|
||||
#define LIBND4J_GRAPHEXECUTIONER_H
|
||||
#include <graph/ExecutionResult.h>
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
#include <graph/ResultWrapper.h>
|
||||
#include <graph/Variable.h>
|
||||
#include <graph/VariableSpace.h>
|
||||
#include <graph/generated/graph_generated.h>
|
||||
#include <graph/generated/node_generated.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define TF_INPUT "Placeholder"
|
||||
#define TF_CONST "Const"
|
||||
#define TF_VAR "VariableV2"
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
class SD_LIB_EXPORT GraphExecutioner {
|
||||
protected:
|
||||
public:
|
||||
|
||||
|
||||
static Status executeFlatNode(Graph *graph, Node *node, VariableSpace *variableSpace);
|
||||
|
||||
/**
|
||||
* This method executes given Graph
|
||||
* @return
|
||||
*/
|
||||
static Status execute(Graph *graph, VariableSpace *variableSpace = nullptr);
|
||||
|
||||
/**
|
||||
* This method executes graph stored at given FlatBuffers pointer
|
||||
*
|
||||
* @param pointer Pointer to FlatBuffer
|
||||
* @return pointer to FlatBuffer with result
|
||||
*/
|
||||
static ResultWrapper *executeFlatBuffer(Pointer pointer);
|
||||
|
||||
static flatbuffers::Offset<::graph::FlatResult> execute(Graph *graph, flatbuffers::FlatBufferBuilder &builder,
|
||||
const ::graph::FlatInferenceRequest *request);
|
||||
|
||||
static Graph *importFromTensorFlow(const char *fileName);
|
||||
|
||||
static Graph *importFromFlatBuffers(const char *filename);
|
||||
|
||||
static Graph *importFromFlatPointer(Pointer ptr);
|
||||
};
|
||||
|
||||
long getFileSize(const char *filename);
|
||||
uint8_t *readFlatBuffers(const char *filename);
|
||||
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_GRAPHEXECUTIONER_H
|
||||
@@ -0,0 +1,92 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <exceptions/unknown_graph_exception.h>
|
||||
#include <graph/Graph.h>
|
||||
#include <helpers/SimpleReadWriteLock.h>
|
||||
#include <helpers/logger.h>
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT GraphHolder {
|
||||
private:
|
||||
SD_MAP_IMPL<LongType, Graph*> _graphF;
|
||||
|
||||
SD_MAP_IMPL<LongType, SimpleReadWriteLock> _locks;
|
||||
|
||||
GraphHolder() = default;
|
||||
~GraphHolder() = default;
|
||||
|
||||
public:
|
||||
static GraphHolder& getInstance();
|
||||
|
||||
void registerGraph(LongType graphId, Graph* graph);
|
||||
|
||||
Graph* cloneGraph(LongType graphId);
|
||||
|
||||
Graph* pullGraph(LongType graphId);
|
||||
|
||||
void forgetGraph(LongType graphId);
|
||||
|
||||
void dropGraph(LongType graphId);
|
||||
|
||||
void dropGraphAny(LongType graphId);
|
||||
|
||||
bool hasGraph(LongType graphId);
|
||||
|
||||
bool hasGraphAny(LongType graphId);
|
||||
|
||||
flatbuffers::Offset<::graph::FlatResult> execute(LongType graphId, flatbuffers::FlatBufferBuilder& builder,
|
||||
const ::graph::FlatInferenceRequest* request);
|
||||
|
||||
void replaceGraph(LongType graphId, Graph* graph);
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
SD_INLINE void lockWrite(LongType graphId) {
|
||||
if (_locks.count(graphId) == 0) return;
|
||||
|
||||
_locks[graphId].lockWrite();
|
||||
}
|
||||
|
||||
SD_INLINE void unlockWrite(LongType graphId) {
|
||||
if (_locks.count(graphId) == 0) return;
|
||||
|
||||
_locks[graphId].unlockWrite();
|
||||
}
|
||||
|
||||
SD_INLINE void lockRead(LongType graphId) {
|
||||
if (_locks.count(graphId) == 0) return;
|
||||
|
||||
_locks[graphId].lockRead();
|
||||
}
|
||||
|
||||
SD_INLINE void unlockRead(LongType graphId) {
|
||||
if (_locks.count(graphId) == 0) return;
|
||||
|
||||
_locks[graphId].unlockRead();
|
||||
}
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,139 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 23.01.18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_GRAPHSTATE_H
|
||||
#define LIBND4J_GRAPHSTATE_H
|
||||
|
||||
#include <graph/ArgumentsList.h>
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Scope.h>
|
||||
#include <graph/VariableSpace.h>
|
||||
#include <ops/declarable/DeclarableOp.h>
|
||||
#include <system/op_boilerplate.h>
|
||||
#include <types/pair.h>
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
class SD_LIB_EXPORT GraphState {
|
||||
protected:
|
||||
// id of this GraphState instance
|
||||
LongType _id = 0;
|
||||
|
||||
// map of scopes. OpScope id is used as key, since it's referred in calls later anyway
|
||||
SD_MAP_IMPL<int, Scope*> _scopes;
|
||||
|
||||
// this variable space holds temp references
|
||||
VariableSpace _variableSpace;
|
||||
|
||||
Graph* _graph;
|
||||
|
||||
public:
|
||||
explicit GraphState(LongType id);
|
||||
~GraphState();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LongType id();
|
||||
|
||||
/**
|
||||
* This method adds scope to this state tracker
|
||||
*
|
||||
* @param scopeId
|
||||
* @return
|
||||
*/
|
||||
Status registerScope(int scopeId);
|
||||
|
||||
/**
|
||||
* This method cheks if scope with given ID exists
|
||||
*
|
||||
* @param scopeId - ID of the scope
|
||||
* @return - TRUE if scope exists, FALSE otherwise
|
||||
*/
|
||||
bool hasScope(int scopeId);
|
||||
|
||||
/**
|
||||
* This method removes specified scope from this state tracker
|
||||
*
|
||||
* @param scopeId
|
||||
* @return
|
||||
*/
|
||||
Status forgetScope(int scopeId);
|
||||
|
||||
/**
|
||||
* This method adds given op to the end of specified scope
|
||||
* PLEASE NOTE: This method is used for tests mostly
|
||||
*
|
||||
* @param scopeId
|
||||
* @param op
|
||||
* @return
|
||||
*/
|
||||
Status attachOpToScope(int scopeId, int nodeId, ops::DeclarableOp* op, ArgumentsList inputs);
|
||||
|
||||
/**
|
||||
* This method returns pointer to the scope with given id
|
||||
*
|
||||
* @param scopeId - id of the scope
|
||||
*/
|
||||
Scope* getScope(int scopeId);
|
||||
|
||||
Graph* graph();
|
||||
|
||||
/**
|
||||
* This method adds given op to the end of specified scope
|
||||
*
|
||||
* @param scopeId
|
||||
* @param opNum
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
Status attachOpToScope(int scopeId, LongType opNum, int type, ArgumentsList inputs);
|
||||
|
||||
/**
|
||||
* This method adds return statement to specified scope
|
||||
*
|
||||
* PLEASE NOTE: should be used only in body scopes
|
||||
*
|
||||
* @param scopeId
|
||||
* @param nodeId
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
Status defineReturn(int scopeId, int nodeId, ArgumentsList args);
|
||||
|
||||
/**
|
||||
* This method returns current variable space of this state holder
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
VariableSpace* variableSpace();
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_GRAPHSTATE_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by GS <sgazeos@gmail.com> 3/7/2018
|
||||
//
|
||||
|
||||
#ifndef __H__GRAPH_UTILS__
|
||||
#define __H__GRAPH_UTILS__
|
||||
#include "../ops/declarable/DeclarableOp.h"
|
||||
#include "../ops/declarable/OpDescriptor.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
class SD_LIB_EXPORT GraphUtils {
|
||||
public:
|
||||
typedef std::vector<ops::OpDescriptor> OpList;
|
||||
|
||||
public:
|
||||
static bool filterOperations(OpList& ops);
|
||||
static std::string makeCommandLine(OpList& ops);
|
||||
static int runPreprocessor(char const* input, char const* output);
|
||||
};
|
||||
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#ifndef DEV_TESTS_INFERENCEREQUEST_H
|
||||
#define DEV_TESTS_INFERENCEREQUEST_H
|
||||
#include <graph/Variable.h>
|
||||
#include <system/common.h>
|
||||
#include <system/op_boilerplate.h>
|
||||
|
||||
#include "ExecutorConfiguration.h"
|
||||
#include "graph/generated/request_generated.h"
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT InferenceRequest {
|
||||
private:
|
||||
LongType _id;
|
||||
std::vector<Variable *> _variables;
|
||||
std::vector<Variable *> _deletables;
|
||||
|
||||
ExecutorConfiguration *_configuration = nullptr;
|
||||
|
||||
void insertVariable(Variable *variable);
|
||||
|
||||
public:
|
||||
InferenceRequest(LongType graphId, ExecutorConfiguration *configuration = nullptr);
|
||||
~InferenceRequest();
|
||||
|
||||
void appendVariable(int id, NDArray *array);
|
||||
void appendVariable(int id, int index, NDArray *array);
|
||||
void appendVariable(std::string &name, NDArray *array);
|
||||
void appendVariable(std::string &name, int id, int index, NDArray *array);
|
||||
void appendVariable(Variable *variable);
|
||||
|
||||
#ifndef __JAVACPP_HACK__
|
||||
flatbuffers::Offset<::graph::FlatInferenceRequest> asFlatInferenceRequest(flatbuffers::FlatBufferBuilder &builder);
|
||||
#endif
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // DEV_TESTS_INFERENCEREQUEST_H
|
||||
@@ -0,0 +1,54 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by yurii@skymind.io on 24.10.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_INTERVALS_H
|
||||
#define LIBND4J_INTERVALS_H
|
||||
|
||||
#include <system/common.h>
|
||||
|
||||
#include <initializer_list>
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
|
||||
class SD_LIB_EXPORT Intervals {
|
||||
private:
|
||||
std::vector<std::vector<LongType>> _content;
|
||||
|
||||
public:
|
||||
// default constructor
|
||||
Intervals();
|
||||
|
||||
// constructor
|
||||
Intervals(const std::initializer_list<std::vector<LongType>>& content);
|
||||
Intervals(const std::vector<std::vector<LongType>>& content);
|
||||
|
||||
// accessing operator
|
||||
std::vector<LongType> operator[](const LongType i) const;
|
||||
|
||||
// returns size of _content
|
||||
int size() const;
|
||||
};
|
||||
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_INTERVALS_H
|
||||
@@ -0,0 +1,232 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_GNODE_H
|
||||
#define LIBND4J_GNODE_H
|
||||
#include <array/NDArray.h>
|
||||
#include <graph/generated/node_generated.h>
|
||||
#include <ops/declarable/DeclarableOp.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
|
||||
#include "Context.h"
|
||||
#include "array/NDArray.h"
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
class Graph;
|
||||
|
||||
class SD_LIB_EXPORT Node {
|
||||
protected:
|
||||
// TODO: this field must be removed
|
||||
DataType _dataType;
|
||||
|
||||
::graph::OpType _opType;
|
||||
ContextPrototype *_protoContext = nullptr;
|
||||
LongType _opNum;
|
||||
int _id;
|
||||
std::vector<std::pair<int, int>> _input;
|
||||
std::vector<std::pair<int, int>> _output;
|
||||
std::vector<LongType> _dimensions;
|
||||
|
||||
std::vector<int> _referencedBy;
|
||||
|
||||
LongType *_dim = nullptr;
|
||||
std::string _name;
|
||||
|
||||
// this variable points to onion layer within graph
|
||||
int _layer = -1;
|
||||
|
||||
// many ops require extra parameters to run
|
||||
double *_extraParams = nullptr;
|
||||
|
||||
|
||||
|
||||
bool _hasExternalOutputs;
|
||||
bool _hasExternalInputs;
|
||||
bool _hasInternalOutputs;
|
||||
bool _hasInternalInputs;
|
||||
|
||||
// this field is used to check, if op should be used in-place (so it can/will modify its inputs)
|
||||
bool _isInplace = false;
|
||||
|
||||
// this field is used to delete attached customOp
|
||||
bool _isDeductable = false;
|
||||
|
||||
::graph::OpClass _opClass;
|
||||
|
||||
// these fields are used to store embedded CustomOps and Graph in case of Graph-in-Graph scenario
|
||||
Graph *_graph = nullptr;
|
||||
ops::DeclarableOp *_customOp = nullptr;
|
||||
|
||||
// each node can be active or inactive, if used with divergents, like IF statements
|
||||
bool _active = true;
|
||||
|
||||
// these fields contain information about OpScope these ops are related to
|
||||
int _scope_id = 0;
|
||||
std::string _scope_name;
|
||||
|
||||
// TODO: these 3 fields should be removed
|
||||
int _rewindNode = -1;
|
||||
std::pair<int, int> _rewindLayer = {-1, -1};
|
||||
LongType _frameId = -1;
|
||||
|
||||
public:
|
||||
explicit Node(ops::DeclarableOp *customOp, int id = 0, std::initializer_list<int> input = {},
|
||||
std::initializer_list<int> output = {}, std::initializer_list<int> dimensions = {}, float scalar = 0.0f,
|
||||
std::initializer_list<double> tArgs = {}, std::initializer_list<int> iArgs = {});
|
||||
explicit Node(::graph::OpType opType = ::graph::OpType_TRANSFORM_SAME, int opNum = 0, int id = 0, std::initializer_list<int> input = {},
|
||||
std::initializer_list<int> output = {}, std::initializer_list<int> dimensions = {}, float scalar = 0.0f,
|
||||
std::initializer_list<double> tArgs = {}, std::initializer_list<int> iArgs = {});
|
||||
explicit Node(const ::graph::FlatNode *node);
|
||||
~Node();
|
||||
|
||||
bool equals(Node *other);
|
||||
|
||||
DataType dataType();
|
||||
ContextPrototype *protoContext();
|
||||
::graph::OpType opType();
|
||||
LongType opNum();
|
||||
int id();
|
||||
std::vector<std::pair<int, int>> *input();
|
||||
std::vector<std::pair<int, int>> *output();
|
||||
|
||||
LongType getFrameId();
|
||||
void setFrameId(LongType frameId);
|
||||
|
||||
int getRewindNode();
|
||||
void setRewindNode(int nodeId);
|
||||
|
||||
std::pair<int, int> &getRewindLayer();
|
||||
void setRewindLayer(int layerId, int stepId = 0);
|
||||
|
||||
void setId(int id);
|
||||
|
||||
double *extraParams();
|
||||
|
||||
bool isMultiInput();
|
||||
bool isMultiOutput();
|
||||
|
||||
int getLayer();
|
||||
void setLayer(int layer);
|
||||
|
||||
bool isDivergencePoint();
|
||||
void setActive(bool reallyActive);
|
||||
bool isActive();
|
||||
|
||||
bool hasExternalOutputs();
|
||||
bool hasExternalInputs();
|
||||
bool hasInternalOutputs();
|
||||
bool hasInternalInputs();
|
||||
|
||||
std::vector<LongType> *getDimensions();
|
||||
LongType *getDimensionsPtr();
|
||||
|
||||
void pickOutputOnce(int outputId);
|
||||
void pickOutput(int outputId);
|
||||
void pickOutput(int nodeId, int outputId);
|
||||
void pickExternalOutput(int outputId);
|
||||
void pickInput(int inputId);
|
||||
void pickInput(int nodeId, int outputId);
|
||||
void pickInput(std::pair<int, int> &id);
|
||||
|
||||
bool isDeductable();
|
||||
void setDeductable(bool reallyDeductable);
|
||||
|
||||
void setName(std::string *name);
|
||||
void setName(const std::string &name);
|
||||
std::string *getName();
|
||||
std::string *name();
|
||||
|
||||
int totalReferences();
|
||||
void addReference(int nodeId);
|
||||
|
||||
void setContextPrototype(ContextPrototype *block);
|
||||
ContextPrototype *getContextPrototype();
|
||||
bool hasBlockAttached();
|
||||
|
||||
void setCustomOp(ops::DeclarableOp *customOp = nullptr);
|
||||
ops::DeclarableOp *getCustomOp();
|
||||
bool hasCustomOp();
|
||||
|
||||
void setGraph(Graph *graph = nullptr);
|
||||
Graph *getGraph();
|
||||
bool hasGraphEmbedded();
|
||||
|
||||
bool isInplace();
|
||||
void markInplace(bool reallyInplace);
|
||||
|
||||
::graph::OpClass getOpClass();
|
||||
|
||||
// these methods are used for internal profiling
|
||||
void setOuterTime(LongType time);
|
||||
void setInnerTime(LongType time);
|
||||
|
||||
// methods related to scopes
|
||||
bool isScoped();
|
||||
void setScopeInfo(int id, const char *name = nullptr);
|
||||
int scopeId();
|
||||
std::string *scopeName();
|
||||
|
||||
void setOpType(::graph::OpType opType);
|
||||
|
||||
// clone Node
|
||||
Node *clone();
|
||||
|
||||
template <typename T>
|
||||
Node *asT();
|
||||
|
||||
SD_INLINE void pullValues(Node *other) {
|
||||
//if (this->_protoContext != nullptr) delete _protoContext;
|
||||
|
||||
this->_dataType = other->dataType();
|
||||
this->_protoContext = other->protoContext()->clone();
|
||||
this->_hasExternalInputs = other->hasExternalInputs();
|
||||
this->_hasExternalOutputs = other->hasExternalOutputs();
|
||||
this->_hasInternalInputs = other->hasInternalInputs();
|
||||
this->_hasInternalOutputs = other->hasInternalOutputs();
|
||||
|
||||
this->markInplace(other->isInplace());
|
||||
this->setActive(other->isActive());
|
||||
this->setScopeInfo(other->scopeId(), other->scopeName()->c_str());
|
||||
this->setLayer(other->getLayer());
|
||||
this->setDeductable(other->isDeductable());
|
||||
|
||||
if (this->_customOp != nullptr && _isDeductable) delete this->_customOp;
|
||||
|
||||
for (auto v : *other->input()) this->_input.emplace_back(v);
|
||||
|
||||
for (auto v : *other->output()) this->_output.emplace_back(v);
|
||||
|
||||
for (auto v : *other->getDimensions()) this->_dimensions.emplace_back(v);
|
||||
}
|
||||
|
||||
static ops::DeclarableOp *buildOpByType(::graph::OpType opType, int numInputs, int numIArgs, int numTArgs, int opNum,
|
||||
NDArray *scalar);
|
||||
static void deleteOpByType(::graph::OpType opType, void *op);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_GNODE_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 16/11/17.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_NODESTATE_H
|
||||
#define LIBND4J_NODESTATE_H
|
||||
|
||||
#include <system/common.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT NodeState {
|
||||
private:
|
||||
// inner time spent on specific node
|
||||
LongType _inner = 0;
|
||||
|
||||
// outer time spent on specific node
|
||||
LongType _outer = 0;
|
||||
|
||||
// flag that shows if node is active or disabled (i.e. after Switch op)
|
||||
bool _active = true;
|
||||
|
||||
bool _executed = false;
|
||||
|
||||
// active divergence branch
|
||||
int _branch = 0;
|
||||
|
||||
int _id = 0;
|
||||
|
||||
public:
|
||||
NodeState(int id = 0);
|
||||
~NodeState() = default;
|
||||
|
||||
void setInnerTime(LongType time);
|
||||
void setOuterTime(LongType time);
|
||||
|
||||
LongType innerTime();
|
||||
LongType outerTime();
|
||||
|
||||
void markActive(bool isActive);
|
||||
bool isActive();
|
||||
|
||||
int branch();
|
||||
void markBranch(int index);
|
||||
|
||||
bool wasExecuted();
|
||||
void markExecuted(bool wasExecuted);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_NODESTATE_H
|
||||
@@ -0,0 +1,20 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
// This file redirects to RandomGenerator.h which contains the actual implementation
|
||||
#include <graph/RandomGenerator.h>
|
||||
@@ -0,0 +1,410 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef LIBND4J_GRAPH_RNG_H
|
||||
#define LIBND4J_GRAPH_RNG_H
|
||||
|
||||
#include <array/DataTypeUtils.h>
|
||||
#include <helpers/logger.h>
|
||||
#include <math/templatemath.h>
|
||||
#include <system/op_boilerplate.h>
|
||||
#include <types/u32.h>
|
||||
#include <types/u64.h>
|
||||
#include <chrono>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
#if defined(__CUDACC__)
|
||||
#ifndef __JAVACPP_HACK__
|
||||
|
||||
class SD_LIB_EXPORT CudaManagedRandomGenerator {
|
||||
private:
|
||||
protected:
|
||||
void *devHolder;
|
||||
|
||||
public:
|
||||
void *operator new(size_t len) {
|
||||
void *ptr;
|
||||
auto res = cudaHostAlloc(&ptr, len, cudaHostAllocDefault);
|
||||
if (res != 0) THROW_EXCEPTION("CudaManagedRandomGenerator: failed to allocate memory");
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void operator delete(void *ptr) { cudaFreeHost(ptr); }
|
||||
};
|
||||
|
||||
class SD_LIB_EXPORT RandomGenerator : public CudaManagedRandomGenerator {
|
||||
private:
|
||||
u64 _rootState;
|
||||
u64 _nodeState;
|
||||
|
||||
static SD_INLINE LongType currentMilliseconds();
|
||||
|
||||
public:
|
||||
SD_INLINE RandomGenerator(LongType rootSeed = 0, LongType nodeSeed = 0);
|
||||
SD_INLINE SD_HOST void setStates(LongType rootSeed, LongType nodeState = 0);
|
||||
|
||||
template <typename T>
|
||||
SD_INLINE SD_HOST_DEVICE T relativeT(LongType index, T from, T to);
|
||||
|
||||
template <typename T>
|
||||
SD_INLINE SD_HOST_DEVICE T relativeT(LongType index);
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE int relativeInt(LongType index);
|
||||
SD_INLINE SD_HOST_DEVICE LongType relativeLong(LongType index);
|
||||
SD_INLINE SD_HOST_DEVICE void rewindH(uint64_t steps);
|
||||
|
||||
SD_INLINE SD_HOST void setSeed(int seed) { _nodeState._ulong = static_cast<uint64_t>(seed); }
|
||||
SD_INLINE SD_HOST void setSeed(uint64_t seed) { _nodeState._ulong = seed; }
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE LongType rootState() { return _rootState._long; }
|
||||
SD_INLINE SD_HOST_DEVICE LongType nodeState() { return _nodeState._long; }
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE uint32_t xoroshiro32(uint64_t index);
|
||||
SD_INLINE SD_HOST_DEVICE uint64_t xoroshiro64(uint64_t index);
|
||||
};
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
class SD_LIB_EXPORT RandomGenerator {
|
||||
private:
|
||||
u64 _rootState;
|
||||
u64 _nodeState;
|
||||
|
||||
static SD_INLINE LongType currentMilliseconds();
|
||||
|
||||
public:
|
||||
SD_INLINE RandomGenerator(LongType rootSeed = 0, LongType nodeSeed = 0);
|
||||
SD_INLINE SD_HOST void setStates(LongType rootSeed, LongType nodeState = 0);
|
||||
|
||||
template <typename T>
|
||||
SD_INLINE SD_HOST_DEVICE T relativeT(LongType index, T from, T to);
|
||||
|
||||
template <typename T>
|
||||
SD_INLINE SD_HOST_DEVICE T relativeT(LongType index);
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE int relativeInt(LongType index);
|
||||
SD_INLINE SD_HOST_DEVICE LongType relativeLong(LongType index);
|
||||
SD_INLINE SD_HOST_DEVICE void rewindH(uint64_t steps);
|
||||
|
||||
SD_INLINE SD_HOST void setSeed(int seed) { _nodeState._ulong = static_cast<uint64_t>(seed); }
|
||||
SD_INLINE SD_HOST void setSeed(uint64_t seed) { _nodeState._ulong = seed; }
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE LongType rootState() { return _rootState._long; }
|
||||
SD_INLINE SD_HOST_DEVICE LongType nodeState() { return _nodeState._long; }
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE uint32_t xoroshiro32(uint64_t index);
|
||||
SD_INLINE SD_HOST_DEVICE uint64_t xoroshiro64(uint64_t index);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Implementation of member functions (common for both CUDA and non-CUDA versions)
|
||||
|
||||
SD_INLINE RandomGenerator::RandomGenerator(LongType rootSeed, LongType nodeSeed) {
|
||||
_rootState._long = (rootSeed == 0) ? currentMilliseconds() : rootSeed;
|
||||
_nodeState._long = (nodeSeed != 0) ? nodeSeed : 1298567341LL;
|
||||
}
|
||||
|
||||
SD_INLINE void RandomGenerator::setStates(LongType rootSeed, LongType nodeSeed) {
|
||||
_rootState._long = (rootSeed == 0) ? currentMilliseconds() : rootSeed;
|
||||
_nodeState._long = (nodeSeed != 0) ? nodeSeed : 1298567341LL;
|
||||
}
|
||||
|
||||
SD_INLINE LongType RandomGenerator::currentMilliseconds() {
|
||||
auto s = std::chrono::system_clock::now().time_since_epoch();
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(s).count();
|
||||
}
|
||||
|
||||
// Template specializations for relativeT
|
||||
|
||||
#ifdef HAS_FLOAT32
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE float RandomGenerator::relativeT<float>(LongType index) {
|
||||
u32 u;
|
||||
u._u32 = (0x3f800000 | (this->xoroshiro32(index) >> 9));
|
||||
return u._f32 - 1.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_DOUBLE
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE double RandomGenerator::relativeT<double>(LongType index) {
|
||||
#ifdef __DOUBLE_RNG__
|
||||
u64 u;
|
||||
u._ulong = ((UINT64_C(0x3FF) << 52) | (this->xoroshiro64(index) >> 12));
|
||||
return u._double - 1.0;
|
||||
#else
|
||||
return (double)relativeT<float>(index);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Use unsigned long instead of uint64_t to avoid redefinition issues
|
||||
#ifdef HAS_UINT64
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE unsigned long RandomGenerator::relativeT<unsigned long>(LongType index) {
|
||||
return this->xoroshiro64(index);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_UINT32
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE uint32_t RandomGenerator::relativeT<uint32_t>(LongType index) {
|
||||
return this->xoroshiro32(index);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_INT32
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE int RandomGenerator::relativeT<int>(LongType index) {
|
||||
auto r = static_cast<int>(relativeT<uint32_t>(index));
|
||||
return r <= DataTypeUtils::max<int>() ? r : r % DataTypeUtils::max<int>();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_INT64
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE LongType RandomGenerator::relativeT<LongType>(LongType index) {
|
||||
auto r = static_cast<sd::LongType>(relativeT<unsigned long>(index));
|
||||
return r <= DataTypeUtils::max<LongType>() ? r : r % DataTypeUtils::max<LongType>();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Additional template specializations for integer types with single parameter
|
||||
#ifdef HAS_INT8
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE int8_t RandomGenerator::relativeT<int8_t>(LongType index) {
|
||||
// Return a value between 0 and max for int8_t
|
||||
float t = this->relativeT<float>(index);
|
||||
return static_cast<int8_t>(t * DataTypeUtils::max<int8_t>());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_UINT8
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE uint8_t RandomGenerator::relativeT<uint8_t>(LongType index) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return static_cast<uint8_t>(t * DataTypeUtils::max<uint8_t>());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_INT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE int16_t RandomGenerator::relativeT<int16_t>(LongType index) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return static_cast<int16_t>(t * DataTypeUtils::max<int16_t>());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_UINT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE uint16_t RandomGenerator::relativeT<uint16_t>(LongType index) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return static_cast<uint16_t>(t * DataTypeUtils::max<uint16_t>());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_BOOL
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE bool RandomGenerator::relativeT<bool>(LongType index) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return t > 0.5f;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_FLOAT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE float16 RandomGenerator::relativeT<float16>(LongType index) {
|
||||
return static_cast<float16>(relativeT<float>(index));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_BFLOAT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE bfloat16 RandomGenerator::relativeT<bfloat16>(LongType index) {
|
||||
return static_cast<bfloat16>(relativeT<float>(index));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Generic template for relativeT with range parameters
|
||||
template <typename T>
|
||||
SD_INLINE SD_HOST_DEVICE T RandomGenerator::relativeT(LongType index, T from, T to) {
|
||||
auto t = this->relativeT<T>(index);
|
||||
return from + T(t * (to - from));
|
||||
}
|
||||
|
||||
// Specializations for relativeT with range parameters
|
||||
#ifdef HAS_INT64
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE LongType RandomGenerator::relativeT(LongType index, LongType from, LongType to) {
|
||||
auto t = this->relativeT<double>(index);
|
||||
return from + LongType(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_INT32
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE int RandomGenerator::relativeT(LongType index, int from, int to) {
|
||||
auto t = this->relativeT<float>(index);
|
||||
return from + int(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Template specializations for integer types with range parameters
|
||||
#ifdef HAS_INT8
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE int8_t RandomGenerator::relativeT(LongType index, int8_t from, int8_t to) {
|
||||
// Use float for intermediate calculation to get proper distribution
|
||||
float t = this->relativeT<float>(index);
|
||||
return from + static_cast<int8_t>(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_UINT8
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE uint8_t RandomGenerator::relativeT(LongType index, uint8_t from, uint8_t to) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return from + static_cast<uint8_t>(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_INT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE int16_t RandomGenerator::relativeT(LongType index, int16_t from, int16_t to) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return from + static_cast<int16_t>(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_UINT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE uint16_t RandomGenerator::relativeT(LongType index, uint16_t from, uint16_t to) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return from + static_cast<uint16_t>(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_BOOL
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE bool RandomGenerator::relativeT(LongType index, bool from, bool to) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return t > 0.5f ? to : from;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_FLOAT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE float16 RandomGenerator::relativeT(LongType index, float16 from, float16 to) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return from + static_cast<float16>(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_BFLOAT16
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE bfloat16 RandomGenerator::relativeT(LongType index, bfloat16 from, bfloat16 to) {
|
||||
float t = this->relativeT<float>(index);
|
||||
return from + static_cast<bfloat16>(t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_FLOAT32
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE float RandomGenerator::relativeT(LongType index, float from, float to) {
|
||||
auto t = this->relativeT<float>(index);
|
||||
return from + (t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_DOUBLE
|
||||
template <>
|
||||
SD_INLINE SD_HOST_DEVICE double RandomGenerator::relativeT(LongType index, double from, double to) {
|
||||
auto t = this->relativeT<double>(index);
|
||||
return from + (t * (to - from));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Generic fallback template - only compiled if no specialization exists
|
||||
template <typename T>
|
||||
SD_INLINE SD_HOST_DEVICE T RandomGenerator::relativeT(LongType index) {
|
||||
return static_cast<T>(relativeT<float>(index));
|
||||
}
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE int RandomGenerator::relativeInt(LongType index) {
|
||||
#ifdef HAS_UINT32
|
||||
auto r = static_cast<int>(relativeT<uint32_t>(index));
|
||||
return r <= DataTypeUtils::max<int>() ? r : r % DataTypeUtils::max<int>();
|
||||
#else
|
||||
return 0; // Fallback if no uint32_t
|
||||
#endif
|
||||
}
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE LongType RandomGenerator::relativeLong(LongType index) {
|
||||
#ifdef HAS_UINT64
|
||||
auto r = static_cast<LongType>(relativeT<unsigned long>(index));
|
||||
return r <= DataTypeUtils::max<LongType>() ? r : r % DataTypeUtils::max<LongType>();
|
||||
#else
|
||||
return 0; // Fallback if no uint64_t
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
static SD_INLINE SD_HOST_DEVICE uint32_t rotl(const uint32_t x, int k) { return (x << k) | (x >> (32 - k)); }
|
||||
static SD_INLINE SD_HOST_DEVICE uint64_t rotl(const uint64_t x, int k) { return (x << k) | (x >> (64 - k)); }
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE uint32_t RandomGenerator::xoroshiro32(uint64_t index) {
|
||||
auto s0 = _rootState._ulong;
|
||||
auto s1 = _nodeState._ulong;
|
||||
|
||||
s0 |= ((index + 2) * (s1 + 24243287));
|
||||
s1 ^= ((index + 2) * (s0 + 723829));
|
||||
|
||||
unsigned long val = s1 ^ s0;
|
||||
int *pHalf = reinterpret_cast<int *>(&val);
|
||||
|
||||
return rotl(*pHalf * 0x9E3779BB, 5) * 5;
|
||||
}
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE uint64_t RandomGenerator::xoroshiro64(uint64_t index) {
|
||||
uint64_t upper = ((uint64_t)xoroshiro32(index)) << 32;
|
||||
// Use direct bit manipulation instead of sd_rotl to avoid template issues
|
||||
uint64_t rotated = (index << 32) | (index >> 32);
|
||||
uint32_t lower = xoroshiro32(rotated);
|
||||
return upper + lower;
|
||||
}
|
||||
|
||||
SD_INLINE SD_HOST_DEVICE void RandomGenerator::rewindH(uint64_t steps) {
|
||||
auto s0 = _nodeState._du32._v0;
|
||||
auto s1 = _nodeState._du32._v1;
|
||||
|
||||
s1 ^= s0;
|
||||
_nodeState._du32._v0 = rotl(s0, 26) ^ s1 ^ (s1 << 9);
|
||||
_nodeState._du32._v1 = rotl(s1, 13);
|
||||
|
||||
_nodeState._long ^= (steps ^ 0xdeadbeef);
|
||||
}
|
||||
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
|
||||
#endif // LIBND4J_GRAPH_RNG_H
|
||||
@@ -0,0 +1,43 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@protonmail.com
|
||||
//
|
||||
// relies on xoroshiro64** and xoroshiro128 implementations
|
||||
#include "../array/DataTypeUtils.h"
|
||||
#include "./RandomGenerator.h"
|
||||
#include "../helpers/logger.h"
|
||||
#include "../system/op_boilerplate.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
template SD_HOST_DEVICE int RandomGenerator::relativeT(sd::LongType, int, int);
|
||||
template SD_HOST_DEVICE float16 RandomGenerator::relativeT(sd::LongType, float16, float16);
|
||||
template SD_HOST_DEVICE float RandomGenerator::relativeT(sd::LongType, float, float);
|
||||
template SD_HOST_DEVICE double RandomGenerator::relativeT(sd::LongType, double, double);
|
||||
template SD_HOST_DEVICE sd::LongType RandomGenerator::relativeT(sd::LongType, sd::LongType, sd::LongType);
|
||||
|
||||
template SD_HOST_DEVICE float16 RandomGenerator::relativeT(sd::LongType);
|
||||
template SD_HOST_DEVICE float RandomGenerator::relativeT(sd::LongType);
|
||||
template SD_HOST_DEVICE double RandomGenerator::relativeT(sd::LongType);
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,46 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 11/06/18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_RESULTWRAPPER_H
|
||||
#define LIBND4J_RESULTWRAPPER_H
|
||||
#include <system/common.h>
|
||||
#include <system/op_boilerplate.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT ResultWrapper {
|
||||
private:
|
||||
LongType _size = 0L;
|
||||
Pointer _pointer = nullptr;
|
||||
|
||||
public:
|
||||
ResultWrapper(LongType size, Pointer ptr);
|
||||
~ResultWrapper();
|
||||
|
||||
LongType size();
|
||||
|
||||
Pointer pointer();
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_RESULTWRAPPER_H
|
||||
@@ -0,0 +1,107 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 14.10.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_SCOPE_H
|
||||
#define LIBND4J_SCOPE_H
|
||||
#include <graph/Node.h>
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
|
||||
/**
|
||||
* OpScope holds sequential list of operations, and made suitable for continuous
|
||||
* re-execution of multiple operations.
|
||||
*
|
||||
* @tparam T
|
||||
*/
|
||||
class SD_LIB_EXPORT Scope {
|
||||
protected:
|
||||
// Graph-unique IDs for OpScope instances
|
||||
int _id;
|
||||
std::string _name;
|
||||
|
||||
// list of nodes to run, always sequential
|
||||
// Graph takes care of topo sort
|
||||
std::vector<Node*> _nodes;
|
||||
|
||||
public:
|
||||
// attach GiG here, with shared namespace?
|
||||
// or just rebuilt graph leaf?
|
||||
|
||||
// default constructor
|
||||
explicit Scope(int id, const char* name = nullptr);
|
||||
|
||||
// default destructor
|
||||
~Scope();
|
||||
|
||||
/**
|
||||
* this method adds op node to the scope
|
||||
*
|
||||
* PLEASE NOTE: We assume that ops are being added ORDERED
|
||||
*/
|
||||
void push_back(Node* node);
|
||||
|
||||
/**
|
||||
* This method returns list of ops stored earlier, ready for execution
|
||||
*
|
||||
* PLEASE NOTE: If the scope is conditional - last op in list should be BooleanOp
|
||||
* @return
|
||||
*/
|
||||
std::vector<Node*>* nodes();
|
||||
|
||||
/**
|
||||
* This function returns number of nodes in this scope
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Returns ID of this scope
|
||||
* @return
|
||||
*/
|
||||
int id();
|
||||
|
||||
/**
|
||||
* Returns name of this scope
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
std::string* name();
|
||||
|
||||
/**
|
||||
* This method returns clone of this OpScope
|
||||
*/
|
||||
Scope* clone();
|
||||
|
||||
/**
|
||||
* This method removes all Nodes from this scope
|
||||
*/
|
||||
void forgetNodes();
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_SCOPE_H
|
||||
@@ -0,0 +1,68 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_SESSIONLOCALSTORAGE_H
|
||||
#define LIBND4J_SESSIONLOCALSTORAGE_H
|
||||
#include <memory/Workspace.h>
|
||||
|
||||
#include <map>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Context.h"
|
||||
#include "Stash.h"
|
||||
#include "VariableSpace.h"
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT SessionLocalStorage {
|
||||
protected:
|
||||
std::atomic<LongType> _sessionCounter;
|
||||
SD_MAP_IMPL<LongType, LongType> _threadSession;
|
||||
SD_MAP_IMPL<LongType, VariableSpace*> _threadVariableSpace;
|
||||
|
||||
VariableSpace* _variableSpace;
|
||||
Stash* _stash;
|
||||
|
||||
std::mutex _mutex;
|
||||
|
||||
LongType getSessionId();
|
||||
LongType getThreadId();
|
||||
|
||||
public:
|
||||
SessionLocalStorage(VariableSpace* variableSpace = nullptr, Stash* stash = nullptr);
|
||||
|
||||
~SessionLocalStorage();
|
||||
|
||||
VariableSpace* localVariableSpace();
|
||||
VariableSpace* localVariableSpace(LongType sessionId);
|
||||
|
||||
LongType startSession();
|
||||
void endSession(LongType sessionId);
|
||||
void endSession();
|
||||
|
||||
int numberOfSessions();
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_SESSIONLOCALSTORAGE_H
|
||||
@@ -0,0 +1,88 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_STASH_H
|
||||
#define LIBND4J_STASH_H
|
||||
|
||||
#include <array/NDArray.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT KeyPair {
|
||||
int _node;
|
||||
std::string _name;
|
||||
|
||||
public:
|
||||
KeyPair(int node = 0, const char *name = nullptr);
|
||||
|
||||
bool operator<(const KeyPair &other) const;
|
||||
|
||||
bool operator==(const KeyPair &other) const { return _node == other._node; }
|
||||
|
||||
int key() const { return _node; }
|
||||
std::string name() const { return _name; }
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#ifndef __JAVACPP_HACK__
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
class SD_LIB_EXPORT hash<sd::graph::KeyPair> {
|
||||
public:
|
||||
size_t operator()(const sd::graph::KeyPair &k) const;
|
||||
};
|
||||
}; // namespace std
|
||||
|
||||
#endif
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT Stash {
|
||||
protected:
|
||||
std::map<KeyPair, NDArray *> _stash;
|
||||
std::vector<NDArray *> _handles;
|
||||
|
||||
public:
|
||||
Stash();
|
||||
~Stash();
|
||||
|
||||
void storeArray(int nodeId, const char *name, NDArray *array);
|
||||
|
||||
bool checkStash(int nodeId, const char *name);
|
||||
|
||||
NDArray *extractArray(int nodeId, const char *name);
|
||||
|
||||
void clear();
|
||||
};
|
||||
} // namespace graph
|
||||
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_STASH_H
|
||||
@@ -0,0 +1,49 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 16/11/17.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_TIMEHOLDER_H
|
||||
#define LIBND4J_TIMEHOLDER_H
|
||||
#include <system/common.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT TimeHolder {
|
||||
private:
|
||||
std::map<int, LongType> _outer;
|
||||
std::map<int, LongType> _inner;
|
||||
|
||||
public:
|
||||
TimeHolder() = default;
|
||||
~TimeHolder() = default;
|
||||
|
||||
void setOuterTime(int nodeId, LongType time);
|
||||
void setInnerTime(int nodeId, LongType time);
|
||||
|
||||
LongType outerTime(int nodeId);
|
||||
LongType innerTime(int nodeId);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_TIMEHOLDER_H
|
||||
@@ -0,0 +1,145 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_VARIABLE_H
|
||||
#define LIBND4J_VARIABLE_H
|
||||
#include <array/NDArray.h>
|
||||
#include <array/NDArrayList.h>
|
||||
#include <graph/VariableType.h>
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifndef __JAVACPP_HACK__
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
class SD_LIB_EXPORT hash<std::pair<int, int>> {
|
||||
public:
|
||||
size_t operator()(const std::pair<int, int> &k) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
class SD_LIB_EXPORT hash<bfloat16> {
|
||||
public:
|
||||
size_t operator()(const bfloat16 &k) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
class SD_LIB_EXPORT hash<float16> {
|
||||
public:
|
||||
size_t operator()(const float16 &k) const;
|
||||
};
|
||||
}; // namespace std
|
||||
|
||||
#endif
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT Variable {
|
||||
protected:
|
||||
int _id = 0;
|
||||
int _index = 0;
|
||||
NDArray *_ndarray = nullptr;
|
||||
std::string _name;
|
||||
|
||||
std::vector<LongType> _shape;
|
||||
|
||||
bool _external = false;
|
||||
bool _readOnly = false;
|
||||
bool _placeholder = false;
|
||||
bool _removable = true;
|
||||
|
||||
// for now we're setting default to numeric
|
||||
// in future we'll be fetching it right from the array,
|
||||
// InputType _variableType = InputType_UNDEFINED;
|
||||
// DataType _dataType = INHERIT;
|
||||
|
||||
NDArrayList *_list = nullptr;
|
||||
|
||||
VariableType _variableType = NDARRAY;
|
||||
|
||||
public:
|
||||
Variable(bool placeHolder);
|
||||
Variable(NDArray *arrayw, const char *name, int id, int idx = 0);
|
||||
Variable(NDArray *array = nullptr, const char *name = nullptr);
|
||||
|
||||
#ifndef __JAVACPP_HACK__
|
||||
Variable(const ::graph::FlatVariable *flatVariable);
|
||||
#endif
|
||||
|
||||
~Variable();
|
||||
|
||||
Variable *clone();
|
||||
|
||||
template <typename N>
|
||||
SD_LIB_EXPORT Variable *asT();
|
||||
|
||||
bool hasNDArray();
|
||||
NDArray *getNDArray();
|
||||
void setNDArray(NDArray *array);
|
||||
|
||||
bool hasNDArrayList();
|
||||
NDArrayList *getNDArrayList();
|
||||
void setNDArrayList(NDArrayList *list);
|
||||
|
||||
bool isExternal();
|
||||
bool isReadOnly();
|
||||
bool isEmpty();
|
||||
bool isRemovable();
|
||||
|
||||
bool isPlaceholder();
|
||||
|
||||
VariableType variableType();
|
||||
void setVariableType(VariableType variableType);
|
||||
|
||||
|
||||
|
||||
void markExternal(bool reallyExternal);
|
||||
void markReadOnly(bool reallyReadOnly);
|
||||
void markRemovable(bool reallyRemovable);
|
||||
|
||||
int id();
|
||||
int index();
|
||||
void setIndex(int index);
|
||||
void setId(int id);
|
||||
void setId(int id, int idx);
|
||||
|
||||
std::string *getName();
|
||||
void setName(std::string *name);
|
||||
|
||||
std::vector<LongType> &shape();
|
||||
|
||||
#ifndef __JAVACPP_HACK__
|
||||
/**
|
||||
* This method returns offset to this Variable in FlatBuffer
|
||||
* @param builder
|
||||
* @return
|
||||
*/
|
||||
flatbuffers::Offset<::graph::FlatVariable> asFlatVariable(flatbuffers::FlatBufferBuilder &builder);
|
||||
#endif
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_VARIABLE_H
|
||||
@@ -0,0 +1,91 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <graph/VariableSpace.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT VariableProxy : public VariableSpace {
|
||||
protected:
|
||||
VariableSpace *_backed = nullptr;
|
||||
VariableSpace *_current = nullptr;
|
||||
|
||||
public:
|
||||
explicit VariableProxy(VariableSpace *reference);
|
||||
~VariableProxy();
|
||||
|
||||
virtual VariableSpace &operator=(const VariableSpace &other);
|
||||
|
||||
virtual int numberOfPlaceholders();
|
||||
virtual std::vector<Variable *> *getPlaceholders();
|
||||
|
||||
virtual memory::Workspace *workspace();
|
||||
|
||||
virtual bool hasExternalVariable(int it);
|
||||
virtual bool hasExternalVariable(std::pair<int, int> &pair);
|
||||
virtual bool hasExternalVariable(std::string *symbol);
|
||||
|
||||
virtual bool hasVariable(int id);
|
||||
virtual bool hasVariable(int id, int idx);
|
||||
virtual bool hasVariable(std::pair<int, int> &pair);
|
||||
virtual bool hasVariable(std::string *symbol);
|
||||
|
||||
virtual Variable *getVariable(int id);
|
||||
virtual Variable *getVariable(int id, int idx);
|
||||
virtual Variable *getVariable(std::pair<int, int> &pair);
|
||||
virtual Variable *getVariable(std::string *symbol);
|
||||
|
||||
virtual std::vector<Variable *> getVariables();
|
||||
|
||||
virtual Variable *putVariable(std::pair<int, int> &pair, NDArray *array);
|
||||
virtual void putVariable(std::pair<int, int> &pair, Variable *variable);
|
||||
virtual void putVariable(int id, Variable *variable);
|
||||
virtual void putVariable(int id, NDArray *array);
|
||||
virtual Variable *putVariable(int id, int idx, NDArray *array);
|
||||
virtual void putVariable(int id, int idx, NDArray &array);
|
||||
virtual void putVariable(int id, int idx, Variable *array);
|
||||
|
||||
virtual void replaceVariable(Variable *variable);
|
||||
|
||||
virtual void dropVariable(std::pair<int, int> &pair);
|
||||
virtual void dropVariable(int id, int idx);
|
||||
|
||||
virtual void putOutputVariable(Variable *variable);
|
||||
|
||||
virtual void trackList(NDArrayList *list);
|
||||
|
||||
// memory-related statistics
|
||||
virtual LongType externalMemory();
|
||||
virtual LongType internalMemory();
|
||||
virtual LongType totalMemory();
|
||||
|
||||
virtual int externalEntries();
|
||||
virtual int internalEntries();
|
||||
virtual int totalEntries();
|
||||
|
||||
virtual VariableSpace *clone();
|
||||
|
||||
virtual Stash *getStash();
|
||||
virtual void setFlowPath(FlowPath *timers);
|
||||
virtual FlowPath *flowPath();
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,142 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_VARIABLESPACE_H
|
||||
#define LIBND4J_VARIABLESPACE_H
|
||||
#include <array/NDArray.h>
|
||||
#include <array/NDArrayList.h>
|
||||
#include <graph/FlowPath.h>
|
||||
#include <graph/Stash.h>
|
||||
#include <graph/Variable.h>
|
||||
#include <helpers/helper_random.h>
|
||||
#include <helpers/logger.h>
|
||||
#include <memory/Workspace.h>
|
||||
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT VariableSpace {
|
||||
protected:
|
||||
memory::Workspace* _workspace;
|
||||
|
||||
// stash is NOT cloned
|
||||
Stash _stash;
|
||||
|
||||
SD_MAP_IMPL<std::pair<int, int>, sd::graph::Variable*> _paired;
|
||||
SD_MAP_IMPL<std::string, sd::graph::Variable*> _symbolic;
|
||||
SD_MAP_IMPL<int, sd::graph::Variable*> _variables;
|
||||
std::vector<sd::graph::Variable*> _external;
|
||||
std::vector<sd::graph::Variable*> _internal;
|
||||
|
||||
std::vector<NDArrayList*> _lists;
|
||||
|
||||
std::vector<sd::graph::Variable*> _placeholders;
|
||||
|
||||
void silentPutVariable(std::pair<int, int>& pair, sd::graph::Variable* variable);
|
||||
|
||||
int _auto_counter = -1;
|
||||
|
||||
std::mutex _varmap;
|
||||
|
||||
SD_MAP_IMPL<int, sd::graph::Variable*> _temporary;
|
||||
|
||||
std::vector<sd::graph::Variable*>* _handles;
|
||||
|
||||
FlowPath* _flow = nullptr;
|
||||
|
||||
public:
|
||||
VariableSpace();
|
||||
virtual ~VariableSpace();
|
||||
|
||||
virtual VariableSpace& operator=(const VariableSpace& other);
|
||||
|
||||
virtual int numberOfPlaceholders();
|
||||
virtual std::vector<sd::graph::Variable*>* getPlaceholders();
|
||||
virtual void setWorkspace(memory::Workspace* workspace);
|
||||
|
||||
virtual LaunchContext* launchContext();
|
||||
|
||||
virtual bool hasExternalVariable(int it);
|
||||
virtual bool hasExternalVariable(std::pair<int, int>& pair);
|
||||
virtual bool hasExternalVariable(std::string* symbol);
|
||||
|
||||
virtual bool hasVariable(int id);
|
||||
virtual bool hasVariable(int id, int idx);
|
||||
virtual bool hasVariable(std::pair<int, int>& pair);
|
||||
virtual bool hasVariable(std::string* symbol);
|
||||
|
||||
virtual Variable* getVariable(int id);
|
||||
virtual Variable* getVariable(int id, int idx);
|
||||
virtual Variable* getVariable(std::pair<int, int>& pair);
|
||||
virtual Variable* getVariable(std::string* symbol);
|
||||
|
||||
virtual std::vector<sd::graph::Variable*> getVariables();
|
||||
|
||||
virtual sd::graph::Variable* putVariable(std::pair<int, int>& pair, NDArray* array);
|
||||
virtual void putVariable(std::pair<int, int>& pair, Variable* variable);
|
||||
virtual void putVariable(int id, sd::graph::Variable* variable);
|
||||
virtual void putVariable(int id, NDArray* array);
|
||||
virtual Variable* putVariable(int id, int idx, NDArray* array);
|
||||
virtual void putVariable(int id, int idx, NDArray& array);
|
||||
virtual void putVariable(int id, int idx, sd::graph::Variable* array);
|
||||
|
||||
virtual void dropVariable(std::pair<int, int>& pair);
|
||||
virtual void dropVariable(int id, int idx);
|
||||
|
||||
virtual void trackList(NDArrayList* list);
|
||||
|
||||
virtual void putOutputVariable(sd::graph::Variable* variable);
|
||||
|
||||
virtual void replaceVariable(sd::graph::Variable* variable);
|
||||
|
||||
// memory-related statistics
|
||||
virtual LongType externalMemory();
|
||||
virtual LongType internalMemory();
|
||||
virtual LongType totalMemory();
|
||||
|
||||
virtual int externalEntries();
|
||||
virtual int internalEntries();
|
||||
virtual int totalEntries();
|
||||
|
||||
virtual VariableSpace* clone();
|
||||
|
||||
std::vector<sd::graph::Variable*>* handles();
|
||||
|
||||
VariableSpace* asT();
|
||||
void injectVariable(std::pair<int, int>& pair, sd::graph::Variable* variable);
|
||||
|
||||
virtual Stash* getStash();
|
||||
|
||||
virtual std::vector<sd::graph::Variable*>* getExternalVariables();
|
||||
|
||||
virtual void setFlowPath(FlowPath* timers);
|
||||
virtual FlowPath* flowPath();
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_VARIABLESPACE_H
|
||||
@@ -0,0 +1,38 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef ND4J_VARIABLE_TYPE_H
|
||||
#define ND4J_VARIABLE_TYPE_H
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
enum VariableType {
|
||||
NDARRAY = 0,
|
||||
ARRAY_LIST = 1,
|
||||
FLOW = 2,
|
||||
CONSTANT = 3,
|
||||
PLACEHOLDER = 4,
|
||||
};
|
||||
}
|
||||
} // namespace sd
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 15/11/17.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_VARIABLESSET_H
|
||||
#define LIBND4J_VARIABLESSET_H
|
||||
#include <graph/Variable.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class SD_LIB_EXPORT VariablesSet {
|
||||
protected:
|
||||
std::vector<Variable*> _holder;
|
||||
Status _status;
|
||||
|
||||
public:
|
||||
VariablesSet(Status status = Status::OK);
|
||||
~VariablesSet();
|
||||
|
||||
Status status();
|
||||
|
||||
int size();
|
||||
|
||||
void push_back(Variable* variable);
|
||||
|
||||
Variable* at(int index);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_VARIABLESSET_H
|
||||
@@ -0,0 +1,52 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <graph/exceptions/unresolved_input_exception.h>
|
||||
#include <helpers/StringUtils.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
unresolved_input_exception::unresolved_input_exception(std::string message) : std::runtime_error(message) {
|
||||
//
|
||||
}
|
||||
|
||||
unresolved_input_exception unresolved_input_exception::build(std::string message, int nodeId,
|
||||
std::pair<int, int> &varIndex) {
|
||||
auto node = StringUtils::valueToString<int>(nodeId);
|
||||
auto varId = StringUtils::valueToString<int>(varIndex.first);
|
||||
auto outputIdx = StringUtils::valueToString<int>(varIndex.second);
|
||||
message += "; Node: [" + node + ":0]; Variable: [" + varId + ":" + outputIdx + "]";
|
||||
return unresolved_input_exception(message);
|
||||
}
|
||||
|
||||
unresolved_input_exception unresolved_input_exception::build(std::string message, std::pair<int, int> &varIndex) {
|
||||
auto nodeId = StringUtils::valueToString<int>(varIndex.first);
|
||||
auto outputIdx = StringUtils::valueToString<int>(varIndex.second);
|
||||
message += "; Variable: [" + nodeId + ":" + outputIdx + "]";
|
||||
return unresolved_input_exception(message);
|
||||
}
|
||||
|
||||
unresolved_input_exception unresolved_input_exception::build(std::string message, std::string &varName) {
|
||||
message += "; Variable: [" + varName + "]";
|
||||
return unresolved_input_exception(message);
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,52 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <graph/exceptions/unresolved_output_exception.h>
|
||||
#include <helpers/StringUtils.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
unresolved_output_exception::unresolved_output_exception(std::string message) : std::runtime_error(message) {
|
||||
//
|
||||
}
|
||||
|
||||
unresolved_output_exception unresolved_output_exception::build(std::string message, std::pair<int, int> &varIndex) {
|
||||
auto nodeId = StringUtils::valueToString<int>(varIndex.first);
|
||||
auto outputIdx = StringUtils::valueToString<int>(varIndex.second);
|
||||
message += "; Variable: [" + nodeId + ":" + outputIdx + "]";
|
||||
return unresolved_output_exception(message);
|
||||
}
|
||||
|
||||
unresolved_output_exception unresolved_output_exception::build(std::string message, int nodeId, int outputIndex) {
|
||||
std::pair<int, int> p(nodeId, outputIndex);
|
||||
return build(message, p);
|
||||
}
|
||||
|
||||
unresolved_output_exception unresolved_output_exception::build(std::string message, std::string &varName,
|
||||
int outputIndex) {
|
||||
auto outputIdx = StringUtils::valueToString<int>(outputIndex);
|
||||
message += "; Variable: [" + varName + ":" + outputIdx + "]";
|
||||
return unresolved_output_exception(message);
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,43 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef DEV_TESTS_UNRESOLVED_INPUT_H
|
||||
#define DEV_TESTS_UNRESOLVED_INPUT_H
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class unresolved_input_exception : public std::runtime_error {
|
||||
public:
|
||||
unresolved_input_exception(std::string message);
|
||||
~unresolved_input_exception() = default;
|
||||
|
||||
static unresolved_input_exception build(std::string message, int nodeId, std::pair<int, int> &varIndex);
|
||||
static unresolved_input_exception build(std::string message, std::pair<int, int> &varIndex);
|
||||
static unresolved_input_exception build(std::string message, std::string &varName);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // DEV_TESTS_UNRESOLVED_INPUT_H
|
||||
@@ -0,0 +1,43 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
|
||||
#ifndef DEV_TESTS_UNRESOLVED_OUTPUT_H
|
||||
#define DEV_TESTS_UNRESOLVED_OUTPUT_H
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class unresolved_output_exception : public std::runtime_error {
|
||||
public:
|
||||
unresolved_output_exception(std::string message);
|
||||
~unresolved_output_exception() = default;
|
||||
|
||||
static unresolved_output_exception build(std::string message, int nodeId, int outputIndex);
|
||||
static unresolved_output_exception build(std::string message, std::pair<int, int> &varIndex);
|
||||
static unresolved_output_exception build(std::string message, std::string &varName, int outputIndex);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // DEV_TESTS_UNRESOLVED_INPUT_H
|
||||
@@ -0,0 +1,49 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICCONDITIONAL_H
|
||||
#define LIBND4J_LOGICCONDITIONAL_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
/**
|
||||
* This class is responsible for execution logic of Conditional logical abstraction
|
||||
*
|
||||
* TL/DR: Class takes 2 ops/scopes with the same number of inputs/outputs and condtion.
|
||||
* Condition is evaluated, and based on its result - one of ops/scopes is executed.
|
||||
* Results of this execution will be copied to Conditional node, and every other op
|
||||
* in the graph will be sure that it's Conditional own result, both alternative nodes will
|
||||
* stay in disguise.
|
||||
*
|
||||
* @tparam T
|
||||
*/
|
||||
class LogicConditional {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICCONDITIONAL_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 30.01.18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICENTER_H
|
||||
#define LIBND4J_LOGICENTER_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class LogicEnter {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICEXIT_H
|
||||
@@ -0,0 +1,42 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICEXECUTOR_H
|
||||
#define LIBND4J_LOGICEXECUTOR_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
/**
|
||||
* This class acts as switch for picking logic execution based on opNum, unique for each logical op
|
||||
* @tparam T
|
||||
*/
|
||||
class LogicExecutor {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICEXECUTOR_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 30.01.18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICEXIT_H
|
||||
#define LIBND4J_LOGICEXIT_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class LogicExit {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICEXIT_H
|
||||
@@ -0,0 +1,38 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 12.11.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICEXPOSE_H
|
||||
#define LIBND4J_LOGICEXPOSE_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class LogicExpose {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICEXPOSE_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 30.01.18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICLOOPCOND_H
|
||||
#define LIBND4J_LOGICLOOPCOND_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class LogicLoopCond {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICLOOPCOND_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 30.01.18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICMERGE_H
|
||||
#define LIBND4J_LOGICMERGE_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class LogicMerge {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICMERGE_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 30.01.18.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICNEXTITERATION_H
|
||||
#define LIBND4J_LOGICNEXTITERATION_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
class LogicNextIeration {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICNEXTITERATION_H
|
||||
@@ -0,0 +1,44 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 28.10.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICRETURN_H
|
||||
#define LIBND4J_LOGICRETURN_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
/**
|
||||
* This class is responsible for execution logic of Return logical abstraction
|
||||
*
|
||||
* Basically we're just transferring input variable(s) to output variable(s), nothing beyond that
|
||||
* @tparam T
|
||||
*/
|
||||
class LogicReturn {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICRETURN_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICSCOPE_H
|
||||
#define LIBND4J_LOGICSCOPE_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
/**
|
||||
* This class is responsible for execution logic of OpScope logical abstraction
|
||||
*
|
||||
* It's ultra-simple. It does nothing, and can't be executed directly.
|
||||
*
|
||||
* @tparam T
|
||||
*/
|
||||
class LogicScope {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICSCOPE_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 21.10.17.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICSWITCH_H
|
||||
#define LIBND4J_LOGICSWITCH_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
/**
|
||||
* This class is responsible for execution logic of Switch logical abstraction
|
||||
*
|
||||
* It's ultra-simple. It does nothing, and can't be executed directly.
|
||||
*
|
||||
* @tparam T
|
||||
*/
|
||||
class LogicSwitch {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICSWITCH_H
|
||||
@@ -0,0 +1,45 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
|
||||
#ifndef LIBND4J_LOGICWHILE_H
|
||||
#define LIBND4J_LOGICWHILE_H
|
||||
|
||||
#include <graph/Graph.h>
|
||||
#include <graph/Node.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
/**
|
||||
* This class is responsible for execution logic of While logical abstraction
|
||||
*
|
||||
* Basic idea is simple: we take 2 scopes, one for condition and other one for body. and we re-execute body as long, as
|
||||
* condition scope evaluates to TRUE
|
||||
* @tparam T
|
||||
*/
|
||||
class LogicWhile {
|
||||
public:
|
||||
static Status processNode(Graph* graph, Node* node);
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
|
||||
#endif // LIBND4J_LOGICWHILE_H
|
||||
@@ -0,0 +1,131 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
#include <graph/GraphExecutioner.h>
|
||||
#include <graph/execution/LogicConditional.h>
|
||||
#include <graph/execution/LogicReturn.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicConditional::processNode(Graph *graph, Node *node) {
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
|
||||
auto size = node->input()->size();
|
||||
|
||||
// propagating inputs (optional)
|
||||
for (size_t e = 0; e < size - 3; e++) {
|
||||
std::pair<int, int> pair(node->id(), e);
|
||||
if (!__variableSpace->hasVariable(pair)) {
|
||||
__variableSpace->putVariable(pair, new Variable(nullptr, nullptr, node->id(), e));
|
||||
}
|
||||
|
||||
auto va = node->input()->at(e);
|
||||
|
||||
auto inputVar = __variableSpace->getVariable(va);
|
||||
|
||||
auto innerVar = __variableSpace->getVariable(pair);
|
||||
if (innerVar->hasNDArray()) {
|
||||
// TODO: ???
|
||||
} else {
|
||||
// FIXME: in some cases it's possible to have no NDArray
|
||||
if (inputVar->hasNDArray()) innerVar->setNDArray(new NDArray(inputVar->getNDArray()->dup(inputVar->getNDArray()->ordering())));
|
||||
}
|
||||
}
|
||||
|
||||
int scopeConditionIndex = node->input()->at(size - 3).first;
|
||||
int scopeFalseIndex = node->input()->at(size - 2).first;
|
||||
int scopeTrueIndex = node->input()->at(size - 1).first;
|
||||
|
||||
auto scopeCondition = graph->scopeById(scopeConditionIndex);
|
||||
int lastNode = 0;
|
||||
for (auto v : *scopeCondition->nodes()) {
|
||||
GraphExecutioner::executeFlatNode(graph, v, __variableSpace);
|
||||
lastNode = v->id();
|
||||
}
|
||||
|
||||
|
||||
auto result = __variableSpace->getVariable(lastNode)->getNDArray();
|
||||
|
||||
bool isReturn = false;
|
||||
|
||||
// now we're executing one of the scopes, depending on condition evaluation
|
||||
if (result->e<int>(0) == 0) {
|
||||
auto scopeFalse = graph->scopeById(scopeFalseIndex);
|
||||
lastNode = 0;
|
||||
int nodes = scopeFalse->nodes()->size();
|
||||
for (int e = 0; e < nodes - 1; e++) {
|
||||
auto v = scopeFalse->nodes()->at(e);
|
||||
GraphExecutioner::executeFlatNode(graph, v, __variableSpace);
|
||||
lastNode = v->id();
|
||||
}
|
||||
|
||||
// last node is either return or just last op
|
||||
auto *node2 = scopeFalse->nodes()->at(nodes - 1);
|
||||
if (node2->opType() == ::graph::OpType_LOGIC && node2->opNum() == 40) {
|
||||
isReturn = true;
|
||||
LogicReturn::processNode(graph, node2);
|
||||
} else {
|
||||
GraphExecutioner::executeFlatNode(graph, node2, __variableSpace);
|
||||
lastNode = node2->id();
|
||||
}
|
||||
} else {
|
||||
auto scopeTrue = graph->scopeById(scopeTrueIndex);
|
||||
lastNode = 0;
|
||||
int nodes = scopeTrue->nodes()->size();
|
||||
for (int e = 0; e < nodes - 1; e++) {
|
||||
auto v = scopeTrue->nodes()->at(e);
|
||||
GraphExecutioner::executeFlatNode(graph, v, __variableSpace);
|
||||
lastNode = v->id();
|
||||
}
|
||||
|
||||
// last node is either return or just last op
|
||||
auto node2 = scopeTrue->nodes()->at(nodes - 1);
|
||||
if (node2->opType() == ::graph::OpType_LOGIC && node2->opNum() == 40) {
|
||||
isReturn = true;
|
||||
LogicReturn::processNode(graph, node2);
|
||||
} else {
|
||||
GraphExecutioner::executeFlatNode(graph, node2, __variableSpace);
|
||||
lastNode = node->id();
|
||||
}
|
||||
}
|
||||
|
||||
// now fetch and transfer variables to Conditional node
|
||||
// but only if return wasn't called at the end of scope
|
||||
if (!isReturn) {
|
||||
for (int e = 0; e < DataTypeUtils::max<int>(); e++) {
|
||||
std::pair<int, int> pair(lastNode, e);
|
||||
std::pair<int, int> pairNew(node->id(), e);
|
||||
if (__variableSpace->hasVariable(pair)) {
|
||||
auto array = __variableSpace->getVariable(pair)->getNDArray();
|
||||
auto newVar = new Variable(array);
|
||||
newVar->setId(lastNode, e);
|
||||
newVar->markRemovable(false);
|
||||
|
||||
__variableSpace->putVariable(pairNew, newVar);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,74 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <graph/execution/LogicEnter.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicEnter::processNode(Graph *graph, Node *node) {
|
||||
// this op replicates input variable into the frame. basically happens once for single loop.
|
||||
// sure, if there's inner loop within outer loop, it'll be called once for outer loop and multiple times for inner
|
||||
// loop
|
||||
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
auto __flowPath = __variableSpace->flowPath();
|
||||
|
||||
// basically, first non-null variable is our target
|
||||
for (size_t e = 0; e < node->input()->size(); e++) {
|
||||
auto inputAddr = node->input()->at(e);
|
||||
|
||||
if (__variableSpace->hasVariable(inputAddr)) {
|
||||
auto var = __variableSpace->getVariable(inputAddr);
|
||||
if (var->hasNDArray()) {
|
||||
Variable *lvar = nullptr;
|
||||
if (__variableSpace->hasVariable(node->id(), 0))
|
||||
lvar = __variableSpace->getVariable(node->id(), 0);
|
||||
else
|
||||
lvar = new Variable(nullptr, node->getName()->c_str(), node->id(), 0);
|
||||
|
||||
auto array = var->getNDArray();
|
||||
lvar->setNDArray(array);
|
||||
lvar->markReadOnly(true);
|
||||
|
||||
break;
|
||||
} else if (var->hasNDArrayList()) {
|
||||
Variable *lvar = nullptr;
|
||||
if (__variableSpace->hasVariable(node->id(), 0))
|
||||
lvar = __variableSpace->getVariable(node->id(), 0);
|
||||
else
|
||||
lvar = new Variable(nullptr, node->getName()->c_str(), node->id(), 0);
|
||||
|
||||
auto list = var->getNDArrayList();
|
||||
lvar->setNDArrayList(list);
|
||||
lvar->markReadOnly(true);
|
||||
|
||||
break;
|
||||
} else {
|
||||
// FIXME: can we really have third case here?
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,71 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
#include <graph/execution/LogicConditional.h>
|
||||
#include <graph/execution/LogicEnter.h>
|
||||
#include <graph/execution/LogicExecutor.h>
|
||||
#include <graph/execution/LogicExit.h>
|
||||
#include <graph/execution/LogicExpose.h>
|
||||
#include <graph/execution/LogicLoopCond.h>
|
||||
#include <graph/execution/LogicMerge.h>
|
||||
#include <graph/execution/LogicNextIteration.h>
|
||||
#include <graph/execution/LogicReturn.h>
|
||||
#include <graph/execution/LogicScope.h>
|
||||
#include <graph/execution/LogicSwitch.h>
|
||||
#include <graph/execution/LogicWhile.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicExecutor::processNode(Graph *graph, Node *node) {
|
||||
switch (node->opNum()) {
|
||||
case logic::While:
|
||||
return LogicWhile::processNode(graph, node);
|
||||
case logic::Scope:
|
||||
return LogicScope::processNode(graph, node);
|
||||
case logic::Conditional:
|
||||
return LogicConditional::processNode(graph, node);
|
||||
case logic::Switch:
|
||||
return LogicSwitch::processNode(graph, node);
|
||||
case logic::Return:
|
||||
return LogicReturn::processNode(graph, node);
|
||||
case logic::Expose:
|
||||
return LogicExpose::processNode(graph, node);
|
||||
case logic::Merge:
|
||||
return LogicMerge::processNode(graph, node);
|
||||
case logic::LoopCond:
|
||||
return LogicLoopCond::processNode(graph, node);
|
||||
case logic::NextIteration:
|
||||
return LogicNextIeration::processNode(graph, node);
|
||||
case logic::Exit:
|
||||
return LogicExit::processNode(graph, node);
|
||||
case logic::Enter:
|
||||
return LogicEnter::processNode(graph, node);
|
||||
}
|
||||
|
||||
if (node->getName() == nullptr) {
|
||||
sd_printf("Unknown LogicOp used at node [%i]: [%i]\n", node->id(), node->opNum());
|
||||
} else {
|
||||
sd_printf("Unknown LogicOp used at node [%i:<%s>]: [%i]\n", node->id(), node->getName()->c_str(), node->opNum());
|
||||
}
|
||||
return Status::BAD_INPUT;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,47 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <graph/execution/LogicExit.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicExit::processNode(Graph *graph, Node *node) {
|
||||
// this op is basically no-op
|
||||
// we just know it exists
|
||||
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
auto __flowPath = __variableSpace->flowPath();
|
||||
|
||||
Context ctx(node->getContextPrototype(), __variableSpace);
|
||||
auto input = ctx.variable(0)->getNDArray();
|
||||
|
||||
std::pair<int, int> pair0(node->id(), 0);
|
||||
|
||||
if (!__variableSpace->hasVariable(pair0))
|
||||
__variableSpace->putVariable(pair0, new Variable(nullptr, nullptr, node->id(), 0));
|
||||
|
||||
__variableSpace->getVariable(pair0)->setNDArray(input);
|
||||
__variableSpace->getVariable(pair0)->markRemovable(false);
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,31 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 12.11.2017.
|
||||
//
|
||||
#include <graph/execution/LogicExpose.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicExpose::processNode(Graph *graph, Node *node) {
|
||||
// do we really want this?
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,54 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <graph/execution/LogicLoopCond.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicLoopCond::processNode(Graph *graph, Node *node) {
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
auto __flowPath = __variableSpace->flowPath();
|
||||
|
||||
Context ctx(node->getContextPrototype(), __variableSpace);
|
||||
auto input = ctx.variable(0)->getNDArray();
|
||||
|
||||
std::pair<int, int> pair0(node->id(), 0);
|
||||
|
||||
if (!__variableSpace->hasVariable(pair0))
|
||||
__variableSpace->putVariable(pair0, new Variable(nullptr, nullptr, node->id(), 0));
|
||||
|
||||
__variableSpace->getVariable(pair0)->setNDArray(input);
|
||||
__variableSpace->getVariable(pair0)->markRemovable(false);
|
||||
|
||||
// pass further
|
||||
if (input->e<int>(0) > 0) {
|
||||
// if condition is TRUE body will be invoked some time soon
|
||||
// __flowPath->markFrameActive(node->getFrameId(), true);
|
||||
//__flowPath->i
|
||||
} else {
|
||||
// body won't be activated
|
||||
// __flowPath->markFrameActive(node->getFrameId(), false);
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,122 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 30.01.18.
|
||||
//
|
||||
#include <graph/execution/LogicMerge.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicMerge::processNode(Graph *graph, Node *node) {
|
||||
// at merge node only one of inputs exist if that's just switch and other node isn't LogicNextItration
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
auto __flowPath = __variableSpace->flowPath();
|
||||
|
||||
// merge MUST have 2 inputs
|
||||
auto inputAddr0 = node->input()->at(0);
|
||||
auto inputAddr1 = node->input()->at(1);
|
||||
|
||||
bool isWhile = false;
|
||||
|
||||
// now we want to check if second input is NextIteration
|
||||
if (graph->hasNode(inputAddr1.first)) {
|
||||
auto secondNode = graph->nodeById(inputAddr1.first);
|
||||
|
||||
// checking for NextIteration
|
||||
if (secondNode->opType() == ::graph::OpType_LOGIC && secondNode->opNum() == 80L) {
|
||||
isWhile = true;
|
||||
|
||||
// notifying NextIteration node for rewind index
|
||||
secondNode->setRewindLayer(node->getLayer());
|
||||
secondNode->setRewindNode(node->id());
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: we don't need this check. Just last input should survive, IF it exists
|
||||
if (isWhile) {
|
||||
if (node->getFrameId() >= 0) __flowPath->markFrameActive(node->getFrameId(), true);
|
||||
|
||||
bool hasVar = __variableSpace->hasVariable(inputAddr1);
|
||||
if (hasVar && __flowPath->wasExecuted(inputAddr1.first)) {
|
||||
sd_debug("Node_%i: propagating second input\n", node->id());
|
||||
auto var = __variableSpace->getVariable(inputAddr1);
|
||||
|
||||
Variable *lvar = nullptr;
|
||||
if (__variableSpace->hasVariable(node->id(), 0))
|
||||
lvar = __variableSpace->getVariable(node->id(), 0);
|
||||
else
|
||||
lvar = new Variable(nullptr, node->getName()->c_str(), node->id(), 0);
|
||||
|
||||
|
||||
auto array = var->getNDArray();
|
||||
|
||||
|
||||
lvar->setNDArray(array);
|
||||
lvar->markReadOnly(true);
|
||||
|
||||
__flowPath->markExecuted(inputAddr1.first, false);
|
||||
|
||||
} else {
|
||||
sd_debug("Node_%i: propagating first input\n", node->id());
|
||||
auto var = __variableSpace->getVariable(inputAddr0);
|
||||
|
||||
Variable *lvar = nullptr;
|
||||
if (__variableSpace->hasVariable(node->id(), 0))
|
||||
lvar = __variableSpace->getVariable(node->id(), 0);
|
||||
else
|
||||
lvar = new Variable(nullptr, node->getName()->c_str(), node->id(), 0);
|
||||
|
||||
if (lvar->hasNDArray())
|
||||
delete lvar->getNDArray();
|
||||
|
||||
auto array = var->getNDArray();
|
||||
lvar->setNDArray(array);
|
||||
lvar->markReadOnly(true);
|
||||
}
|
||||
} else {
|
||||
// basically, first non-null variable is our target
|
||||
for (size_t e = 0; e < node->input()->size(); e++) {
|
||||
auto inputAddr = node->input()->at(e);
|
||||
|
||||
if (__variableSpace->hasVariable(inputAddr)) {
|
||||
auto var = __variableSpace->getVariable(inputAddr);
|
||||
if (!var->hasNDArray() || !__flowPath->isNodeActive(inputAddr.first)) continue;
|
||||
|
||||
Variable *lvar = nullptr;
|
||||
if (__variableSpace->hasVariable(node->id(), 0))
|
||||
lvar = __variableSpace->getVariable(node->id(), 0);
|
||||
else {
|
||||
lvar = new Variable(nullptr, node->getName()->c_str(), node->id(), 0);
|
||||
}
|
||||
if (lvar->hasNDArray()) delete lvar->getNDArray();
|
||||
|
||||
auto array = var->getNDArray();
|
||||
lvar->setNDArray(array);
|
||||
lvar->markReadOnly(true);
|
||||
lvar->markExternal(false);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,50 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// @author raver119@gmail.com
|
||||
//
|
||||
#include <graph/execution/LogicNextIteration.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicNextIeration::processNode(Graph *graph, Node *node) {
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
auto __flowPath = __variableSpace->flowPath();
|
||||
|
||||
auto inputAddr = node->input()->at(0);
|
||||
|
||||
auto var = __variableSpace->getVariable(inputAddr);
|
||||
|
||||
Variable *lvar = nullptr;
|
||||
if (__variableSpace->hasVariable(node->id(), 0))
|
||||
lvar = __variableSpace->getVariable(node->id(), 0);
|
||||
else
|
||||
lvar = new Variable(nullptr, node->getName()->c_str(), node->id(), 0);
|
||||
|
||||
if (lvar->hasNDArray())
|
||||
delete lvar->getNDArray();
|
||||
|
||||
auto array = var->getNDArray();
|
||||
lvar->setNDArray(array);
|
||||
lvar->markReadOnly(true);
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,58 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 28.10.2017.
|
||||
//
|
||||
#include "graph/execution/LogicReturn.h"
|
||||
|
||||
#include <helpers/EnumUtils.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicReturn::processNode(Graph *graph, Node *node) {
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
|
||||
for (size_t e = 0; e < node->input()->size(); e++) {
|
||||
auto inputAddr = node->input()->at(e);
|
||||
auto outputAddr = node->output()->at(e);
|
||||
|
||||
// FIXME!!
|
||||
outputAddr.second = e;
|
||||
|
||||
if (Environment::getInstance().isDebugAndVerbose())
|
||||
sd_debug("Return input: <%i, %i>; Return output: <%i, %i>\n", inputAddr.first, inputAddr.second, outputAddr.first,
|
||||
outputAddr.second);
|
||||
|
||||
auto varIn = __variableSpace->getVariable(inputAddr);
|
||||
auto varOut = __variableSpace->getVariable(outputAddr);
|
||||
|
||||
sd_debug("Returning varType: [%s]\n", EnumUtils::_VariableTypeToString(varIn->variableType()));
|
||||
|
||||
// FIXME: this is obviously wrong, we should keep depth track for backprop here
|
||||
varOut->getNDArray()->assign(varIn->getNDArray());
|
||||
|
||||
if (Environment::getInstance().isDebugAndVerbose())
|
||||
sd_debug("In after: [%f]; Out after: [%f]\n", varIn->getNDArray()->meanNumber().e<float>(0),
|
||||
varOut->getNDArray()->meanNumber().e<float>(0));
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,32 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
#include <graph/execution/LogicScope.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicScope::processNode(Graph *graph, Node *node) {
|
||||
// this op is basically no-op
|
||||
// we just know it exists
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,105 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 21.10.17.
|
||||
//
|
||||
|
||||
#include <graph/GraphExecutioner.h>
|
||||
#include <graph/execution/LogicSwitch.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicSwitch::processNode(Graph* graph, Node* node) {
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
auto __flowPath = __variableSpace->flowPath();
|
||||
|
||||
Context ctx(node->getContextPrototype(), __variableSpace);
|
||||
|
||||
// this can be either our format, or compatible format.
|
||||
if (graph->hasScope(node->input()->at(0).first)) {
|
||||
sd_debug("Node_%i: Scoped mode.\n", node->id());
|
||||
// first input is OpScope, so it's ours
|
||||
int scopeConditionIndex = node->input()->at(0).first;
|
||||
auto input = ctx.variable(1);
|
||||
|
||||
auto scopeCondition = graph->scopeById(scopeConditionIndex);
|
||||
int lastNode = 0;
|
||||
for (auto v : *scopeCondition->nodes()) {
|
||||
GraphExecutioner::executeFlatNode(graph, v, __variableSpace);
|
||||
lastNode = v->id();
|
||||
}
|
||||
|
||||
// now we should take result of the OpScope run, and evaluate it
|
||||
auto result = __variableSpace->getVariable(lastNode)->getNDArray();
|
||||
|
||||
std::pair<int, int> pair0(node->id(), 0);
|
||||
std::pair<int, int> pair1(node->id(), 1);
|
||||
|
||||
if (!__variableSpace->hasVariable(pair0))
|
||||
__variableSpace->putVariable(pair0, new Variable(nullptr, nullptr, node->id(), 0));
|
||||
|
||||
if (!__variableSpace->hasVariable(pair1))
|
||||
__variableSpace->putVariable(pair1, new Variable(nullptr, nullptr, node->id(), 1));
|
||||
|
||||
if (!result->e<bool>(0)) {
|
||||
__flowPath->markBranch(node->id(), 0);
|
||||
__variableSpace->getVariable(pair0)->setNDArray(input->getNDArray());
|
||||
__variableSpace->getVariable(pair0)->markRemovable(false);
|
||||
} else {
|
||||
__flowPath->markBranch(node->id(), 1);
|
||||
__variableSpace->getVariable(pair1)->setNDArray(input->getNDArray());
|
||||
__variableSpace->getVariable(pair1)->markRemovable(false);
|
||||
}
|
||||
} else {
|
||||
// first input is NOT a OpScope, so it's compatible format
|
||||
sd_debug("Node_%i: Compatible mode.\n", node->id());
|
||||
|
||||
auto input = ctx.variable(0)->getNDArray();
|
||||
auto boolean = ctx.variable(1)->getNDArray();
|
||||
|
||||
|
||||
|
||||
std::pair<int, int> pair0(node->id(), 0);
|
||||
std::pair<int, int> pair1(node->id(), 1);
|
||||
|
||||
if (!__variableSpace->hasVariable(pair0))
|
||||
__variableSpace->putVariable(pair0, new Variable(nullptr, nullptr, node->id(), 0));
|
||||
|
||||
if (!__variableSpace->hasVariable(pair1))
|
||||
__variableSpace->putVariable(pair1, new Variable(nullptr, nullptr, node->id(), 1));
|
||||
|
||||
if (!boolean->e<bool>(0)) {
|
||||
// false
|
||||
sd_debug("Node_%i: FALSE branch active\n", node->id());
|
||||
__flowPath->markBranch(node->id(), 0);
|
||||
__variableSpace->getVariable(pair0)->setNDArray(input);
|
||||
__variableSpace->getVariable(pair0)->markRemovable(false);
|
||||
} else {
|
||||
// true
|
||||
sd_debug("Node_%i: TRUE branch active\n", node->id());
|
||||
__flowPath->markBranch(node->id(), 1);
|
||||
__variableSpace->getVariable(pair1)->setNDArray(input);
|
||||
__variableSpace->getVariable(pair1)->markRemovable(false);
|
||||
}
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
};
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,137 @@
|
||||
/* ******************************************************************************
|
||||
*
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Apache License, Version 2.0 which is available at
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* See the NOTICE file distributed with this work for additional
|
||||
* information regarding copyright ownership.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
******************************************************************************/
|
||||
|
||||
//
|
||||
// Created by raver119 on 20.10.2017.
|
||||
//
|
||||
#include <graph/GraphExecutioner.h>
|
||||
#include <graph/execution/LogicExecutor.h>
|
||||
#include <graph/execution/LogicReturn.h>
|
||||
#include <graph/execution/LogicWhile.h>
|
||||
|
||||
namespace sd {
|
||||
namespace graph {
|
||||
Status LogicWhile::processNode(Graph* graph, Node* node) {
|
||||
auto __variableSpace = graph->getVariableSpace();
|
||||
|
||||
sd_debug("Starting on WHILE loop: [%i]\n", node->id());
|
||||
|
||||
// total number of inputs. 2 last inputs are scopes
|
||||
int inputs = node->input()->size();
|
||||
|
||||
if (inputs < 3) {
|
||||
sd_printf("While [%i]: loop should have at least 1 external variable announced\n", node->id());
|
||||
return Status::BAD_INPUT;
|
||||
}
|
||||
|
||||
for (int e = 0; e < inputs - 2; e++) {
|
||||
std::pair<int, int> pair(node->id(), e);
|
||||
if (!__variableSpace->hasVariable(pair)) {
|
||||
__variableSpace->putVariable(pair, new Variable(nullptr, nullptr, node->id(), e));
|
||||
}
|
||||
|
||||
auto va = node->input()->at(e);
|
||||
|
||||
auto inputVar = __variableSpace->getVariable(va);
|
||||
|
||||
auto innerVar = __variableSpace->getVariable(pair);
|
||||
if (innerVar->hasNDArray()) {
|
||||
// TODO: ???
|
||||
} else {
|
||||
// FIXME: in some cases it's possible to have no NDArray
|
||||
if (inputVar->hasNDArray()) innerVar->setNDArray(new NDArray(inputVar->getNDArray()->dup(inputVar->getNDArray()->ordering())));
|
||||
}
|
||||
}
|
||||
|
||||
int scopeConditionIndex = node->input()->at(inputs - 2).first;
|
||||
int scopeBodyIndex = node->input()->at(inputs - 1).first;
|
||||
|
||||
sd_debug("While [%i]: got [%i] inputs\n", node->id(), node->input()->size());
|
||||
|
||||
// we're running condition nodes now
|
||||
auto scope = graph->scopeById(scopeConditionIndex);
|
||||
int breaker = 0;
|
||||
while (true && breaker < 10000000) {
|
||||
int lastNode = 0;
|
||||
// we're running condition scope first
|
||||
sd_debug("While [%i]: got [%i] ops in condition scope [%i]\n", node->id(), scope->nodes()->size(),
|
||||
scopeConditionIndex);
|
||||
|
||||
for (Node* v : *scope->nodes()) {
|
||||
// v->getBlock()->updateVariables();
|
||||
if (v->opType() == ::graph::OpType_LOGIC) {
|
||||
sd_debug("Falling back to logic\n", "");
|
||||
LogicExecutor::processNode(graph, v);
|
||||
} else {
|
||||
sd_debug("Op [<%s>]\n", v->getName()->c_str());
|
||||
Status status = GraphExecutioner::executeFlatNode(graph, v, __variableSpace);
|
||||
if (status != Status::OK) return status;
|
||||
}
|
||||
|
||||
lastNode = v->id();
|
||||
}
|
||||
|
||||
if (!__variableSpace->hasVariable(lastNode)) {
|
||||
sd_printf("While [%i]: got no results out of conditional loop\n", node->id());
|
||||
return Status::KERNEL_FAILURE;
|
||||
}
|
||||
|
||||
// now we should take result of the OpScope run, and evaluate it
|
||||
auto result = __variableSpace->getVariable(lastNode)->getNDArray();
|
||||
|
||||
|
||||
// if result evaluates to 0.0 - condition returned FALSE
|
||||
if (result->e<int>(0) == 0)
|
||||
break;
|
||||
else {
|
||||
auto scopeBody = graph->scopeById(scopeBodyIndex);
|
||||
size_t e = 0;
|
||||
sd_debug("While [%i] got [%i] ops in body scope [%i]\n", node->id(), scopeBody->nodes()->size(), scopeBodyIndex);
|
||||
for (; e < scopeBody->nodes()->size() - 1; e++) {
|
||||
Node* v = scopeBody->nodes()->at(e);
|
||||
|
||||
if (v->opType() == ::graph::OpType_LOGIC) {
|
||||
sd_debug("Falling back to logic\n", "");
|
||||
LogicExecutor::processNode(graph, v);
|
||||
} else {
|
||||
sd_debug("Op [<%s>]\n", v->getName()->c_str());
|
||||
// v->getBlock()->updateVariables();
|
||||
Status status = GraphExecutioner::executeFlatNode(graph, v, __variableSpace);
|
||||
if (status != Status::OK) return status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// now execute return statement
|
||||
Node* ret = scopeBody->nodes()->at(e);
|
||||
LogicReturn::processNode(graph, ret);
|
||||
}
|
||||
|
||||
breaker++;
|
||||
}
|
||||
|
||||
// if we've hit breaker limit - we should notify about that
|
||||
if (breaker >= 10000000) {
|
||||
sd_printf("While condition seems to be never ending, aborting...\n", breaker);
|
||||
return Status::KERNEL_FAILURE;
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
} // namespace graph
|
||||
} // namespace sd
|
||||
@@ -0,0 +1,447 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_ARRAY_GRAPH_H_
|
||||
#define FLATBUFFERS_GENERATED_ARRAY_GRAPH_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 2 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 10,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace graph {
|
||||
|
||||
struct BufferChunk;
|
||||
struct BufferChunkBuilder;
|
||||
|
||||
struct FlatArray;
|
||||
struct FlatArrayBuilder;
|
||||
|
||||
enum ByteOrder : int8_t {
|
||||
ByteOrder_LE = 0,
|
||||
ByteOrder_BE = 1,
|
||||
ByteOrder_MIN = ByteOrder_LE,
|
||||
ByteOrder_MAX = ByteOrder_BE
|
||||
};
|
||||
|
||||
inline const ByteOrder (&EnumValuesByteOrder())[2] {
|
||||
static const ByteOrder values[] = {
|
||||
ByteOrder_LE,
|
||||
ByteOrder_BE
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesByteOrder() {
|
||||
static const char * const names[3] = {
|
||||
"LE",
|
||||
"BE",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameByteOrder(ByteOrder e) {
|
||||
if (::flatbuffers::IsOutRange(e, ByteOrder_LE, ByteOrder_BE)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesByteOrder()[index];
|
||||
}
|
||||
|
||||
enum DType : int8_t {
|
||||
DType_INHERIT = 0,
|
||||
DType_BOOL = 1,
|
||||
DType_FLOAT8 = 2,
|
||||
DType_HALF = 3,
|
||||
DType_HALF2 = 4,
|
||||
DType_FLOAT = 5,
|
||||
DType_DOUBLE = 6,
|
||||
DType_INT8 = 7,
|
||||
DType_INT16 = 8,
|
||||
DType_INT32 = 9,
|
||||
DType_INT64 = 10,
|
||||
DType_UINT8 = 11,
|
||||
DType_UINT16 = 12,
|
||||
DType_UINT32 = 13,
|
||||
DType_UINT64 = 14,
|
||||
DType_QINT8 = 15,
|
||||
DType_QINT16 = 16,
|
||||
DType_BFLOAT16 = 17,
|
||||
DType_UTF8 = 50,
|
||||
DType_UTF16 = 51,
|
||||
DType_UTF32 = 52,
|
||||
DType_MIN = DType_INHERIT,
|
||||
DType_MAX = DType_UTF32
|
||||
};
|
||||
|
||||
inline const DType (&EnumValuesDType())[21] {
|
||||
static const DType values[] = {
|
||||
DType_INHERIT,
|
||||
DType_BOOL,
|
||||
DType_FLOAT8,
|
||||
DType_HALF,
|
||||
DType_HALF2,
|
||||
DType_FLOAT,
|
||||
DType_DOUBLE,
|
||||
DType_INT8,
|
||||
DType_INT16,
|
||||
DType_INT32,
|
||||
DType_INT64,
|
||||
DType_UINT8,
|
||||
DType_UINT16,
|
||||
DType_UINT32,
|
||||
DType_UINT64,
|
||||
DType_QINT8,
|
||||
DType_QINT16,
|
||||
DType_BFLOAT16,
|
||||
DType_UTF8,
|
||||
DType_UTF16,
|
||||
DType_UTF32
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesDType() {
|
||||
static const char * const names[54] = {
|
||||
"INHERIT",
|
||||
"BOOL",
|
||||
"FLOAT8",
|
||||
"HALF",
|
||||
"HALF2",
|
||||
"FLOAT",
|
||||
"DOUBLE",
|
||||
"INT8",
|
||||
"INT16",
|
||||
"INT32",
|
||||
"INT64",
|
||||
"UINT8",
|
||||
"UINT16",
|
||||
"UINT32",
|
||||
"UINT64",
|
||||
"QINT8",
|
||||
"QINT16",
|
||||
"BFLOAT16",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"UTF8",
|
||||
"UTF16",
|
||||
"UTF32",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameDType(DType e) {
|
||||
if (::flatbuffers::IsOutRange(e, DType_INHERIT, DType_UTF32)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesDType()[index];
|
||||
}
|
||||
|
||||
enum LossReduce : int8_t {
|
||||
LossReduce_NONE = 0,
|
||||
LossReduce_SUM = 1,
|
||||
LossReduce_MEAN_BY_WEIGHT = 2,
|
||||
LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT = 3,
|
||||
LossReduce_MIN = LossReduce_NONE,
|
||||
LossReduce_MAX = LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT
|
||||
};
|
||||
|
||||
inline const LossReduce (&EnumValuesLossReduce())[4] {
|
||||
static const LossReduce values[] = {
|
||||
LossReduce_NONE,
|
||||
LossReduce_SUM,
|
||||
LossReduce_MEAN_BY_WEIGHT,
|
||||
LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesLossReduce() {
|
||||
static const char * const names[5] = {
|
||||
"NONE",
|
||||
"SUM",
|
||||
"MEAN_BY_WEIGHT",
|
||||
"MEAN_BY_NONZERO_WEIGHT_COUNT",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameLossReduce(LossReduce e) {
|
||||
if (::flatbuffers::IsOutRange(e, LossReduce_NONE, LossReduce_MEAN_BY_NONZERO_WEIGHT_COUNT)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesLossReduce()[index];
|
||||
}
|
||||
|
||||
struct BufferChunk FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef BufferChunkBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_INDEX = 4,
|
||||
VT_DATA = 6
|
||||
};
|
||||
int64_t index() const {
|
||||
return GetField<int64_t>(VT_INDEX, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<int8_t> *data() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int8_t> *>(VT_DATA);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int64_t>(verifier, VT_INDEX, 8) &&
|
||||
VerifyOffset(verifier, VT_DATA) &&
|
||||
verifier.VerifyVector(data()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct BufferChunkBuilder {
|
||||
typedef BufferChunk Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_index(int64_t index) {
|
||||
fbb_.AddElement<int64_t>(BufferChunk::VT_INDEX, index, 0);
|
||||
}
|
||||
void add_data(::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> data) {
|
||||
fbb_.AddOffset(BufferChunk::VT_DATA, data);
|
||||
}
|
||||
explicit BufferChunkBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<BufferChunk> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<BufferChunk>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<BufferChunk> CreateBufferChunk(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int64_t index = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> data = 0) {
|
||||
BufferChunkBuilder builder_(_fbb);
|
||||
builder_.add_index(index);
|
||||
builder_.add_data(data);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<BufferChunk> CreateBufferChunkDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int64_t index = 0,
|
||||
const std::vector<int8_t> *data = nullptr) {
|
||||
auto data__ = data ? _fbb.CreateVector<int8_t>(*data) : 0;
|
||||
return graph::CreateBufferChunk(
|
||||
_fbb,
|
||||
index,
|
||||
data__);
|
||||
}
|
||||
|
||||
struct FlatArray FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef FlatArrayBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_SHAPE = 4,
|
||||
VT_BUFFER = 6,
|
||||
VT_DTYPE = 8,
|
||||
VT_BYTEORDER = 10,
|
||||
VT_BUFFERCHUNKS = 12,
|
||||
VT_TOTALBUFFERSIZE = 14,
|
||||
VT_EXTERNALDATAFILENAME = 16,
|
||||
VT_ISEXTERNAL = 18
|
||||
};
|
||||
const ::flatbuffers::Vector<int64_t> *shape() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int64_t> *>(VT_SHAPE);
|
||||
}
|
||||
const ::flatbuffers::Vector<int8_t> *buffer() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int8_t> *>(VT_BUFFER);
|
||||
}
|
||||
graph::DType dtype() const {
|
||||
return static_cast<graph::DType>(GetField<int8_t>(VT_DTYPE, 0));
|
||||
}
|
||||
graph::ByteOrder byteOrder() const {
|
||||
return static_cast<graph::ByteOrder>(GetField<int8_t>(VT_BYTEORDER, 0));
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>> *bufferChunks() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>> *>(VT_BUFFERCHUNKS);
|
||||
}
|
||||
int64_t totalBufferSize() const {
|
||||
return GetField<int64_t>(VT_TOTALBUFFERSIZE, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *externalDataFilename() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_EXTERNALDATAFILENAME);
|
||||
}
|
||||
bool isExternal() const {
|
||||
return GetField<uint8_t>(VT_ISEXTERNAL, 0) != 0;
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_SHAPE) &&
|
||||
verifier.VerifyVector(shape()) &&
|
||||
VerifyOffset(verifier, VT_BUFFER) &&
|
||||
verifier.VerifyVector(buffer()) &&
|
||||
VerifyField<int8_t>(verifier, VT_DTYPE, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_BYTEORDER, 1) &&
|
||||
VerifyOffset(verifier, VT_BUFFERCHUNKS) &&
|
||||
verifier.VerifyVector(bufferChunks()) &&
|
||||
verifier.VerifyVectorOfTables(bufferChunks()) &&
|
||||
VerifyField<int64_t>(verifier, VT_TOTALBUFFERSIZE, 8) &&
|
||||
VerifyOffset(verifier, VT_EXTERNALDATAFILENAME) &&
|
||||
verifier.VerifyVector(externalDataFilename()) &&
|
||||
verifier.VerifyVectorOfStrings(externalDataFilename()) &&
|
||||
VerifyField<uint8_t>(verifier, VT_ISEXTERNAL, 1) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct FlatArrayBuilder {
|
||||
typedef FlatArray Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_shape(::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> shape) {
|
||||
fbb_.AddOffset(FlatArray::VT_SHAPE, shape);
|
||||
}
|
||||
void add_buffer(::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> buffer) {
|
||||
fbb_.AddOffset(FlatArray::VT_BUFFER, buffer);
|
||||
}
|
||||
void add_dtype(graph::DType dtype) {
|
||||
fbb_.AddElement<int8_t>(FlatArray::VT_DTYPE, static_cast<int8_t>(dtype), 0);
|
||||
}
|
||||
void add_byteOrder(graph::ByteOrder byteOrder) {
|
||||
fbb_.AddElement<int8_t>(FlatArray::VT_BYTEORDER, static_cast<int8_t>(byteOrder), 0);
|
||||
}
|
||||
void add_bufferChunks(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>>> bufferChunks) {
|
||||
fbb_.AddOffset(FlatArray::VT_BUFFERCHUNKS, bufferChunks);
|
||||
}
|
||||
void add_totalBufferSize(int64_t totalBufferSize) {
|
||||
fbb_.AddElement<int64_t>(FlatArray::VT_TOTALBUFFERSIZE, totalBufferSize, 0);
|
||||
}
|
||||
void add_externalDataFilename(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> externalDataFilename) {
|
||||
fbb_.AddOffset(FlatArray::VT_EXTERNALDATAFILENAME, externalDataFilename);
|
||||
}
|
||||
void add_isExternal(bool isExternal) {
|
||||
fbb_.AddElement<uint8_t>(FlatArray::VT_ISEXTERNAL, static_cast<uint8_t>(isExternal), 0);
|
||||
}
|
||||
explicit FlatArrayBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<FlatArray> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<FlatArray>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<FlatArray> CreateFlatArray(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> shape = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> buffer = 0,
|
||||
graph::DType dtype = graph::DType_INHERIT,
|
||||
graph::ByteOrder byteOrder = graph::ByteOrder_LE,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::BufferChunk>>> bufferChunks = 0,
|
||||
int64_t totalBufferSize = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> externalDataFilename = 0,
|
||||
bool isExternal = false) {
|
||||
FlatArrayBuilder builder_(_fbb);
|
||||
builder_.add_totalBufferSize(totalBufferSize);
|
||||
builder_.add_externalDataFilename(externalDataFilename);
|
||||
builder_.add_bufferChunks(bufferChunks);
|
||||
builder_.add_buffer(buffer);
|
||||
builder_.add_shape(shape);
|
||||
builder_.add_isExternal(isExternal);
|
||||
builder_.add_byteOrder(byteOrder);
|
||||
builder_.add_dtype(dtype);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<FlatArray> CreateFlatArrayDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const std::vector<int64_t> *shape = nullptr,
|
||||
const std::vector<int8_t> *buffer = nullptr,
|
||||
graph::DType dtype = graph::DType_INHERIT,
|
||||
graph::ByteOrder byteOrder = graph::ByteOrder_LE,
|
||||
const std::vector<::flatbuffers::Offset<graph::BufferChunk>> *bufferChunks = nullptr,
|
||||
int64_t totalBufferSize = 0,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *externalDataFilename = nullptr,
|
||||
bool isExternal = false) {
|
||||
auto shape__ = shape ? _fbb.CreateVector<int64_t>(*shape) : 0;
|
||||
auto buffer__ = buffer ? _fbb.CreateVector<int8_t>(*buffer) : 0;
|
||||
auto bufferChunks__ = bufferChunks ? _fbb.CreateVector<::flatbuffers::Offset<graph::BufferChunk>>(*bufferChunks) : 0;
|
||||
auto externalDataFilename__ = externalDataFilename ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*externalDataFilename) : 0;
|
||||
return graph::CreateFlatArray(
|
||||
_fbb,
|
||||
shape__,
|
||||
buffer__,
|
||||
dtype,
|
||||
byteOrder,
|
||||
bufferChunks__,
|
||||
totalBufferSize,
|
||||
externalDataFilename__,
|
||||
isExternal);
|
||||
}
|
||||
|
||||
inline const graph::FlatArray *GetFlatArray(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<graph::FlatArray>(buf);
|
||||
}
|
||||
|
||||
inline const graph::FlatArray *GetSizePrefixedFlatArray(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<graph::FlatArray>(buf);
|
||||
}
|
||||
|
||||
inline bool VerifyFlatArrayBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifyBuffer<graph::FlatArray>(nullptr);
|
||||
}
|
||||
|
||||
inline bool VerifySizePrefixedFlatArrayBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifySizePrefixedBuffer<graph::FlatArray>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishFlatArrayBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatArray> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedFlatArrayBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatArray> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace graph
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_ARRAY_GRAPH_H_
|
||||
@@ -0,0 +1,305 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_CONFIG_GRAPH_H_
|
||||
#define FLATBUFFERS_GENERATED_CONFIG_GRAPH_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 2 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 10,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
namespace graph {
|
||||
|
||||
struct FlatConfiguration;
|
||||
struct FlatConfigurationBuilder;
|
||||
|
||||
enum ProfilingMode : int8_t {
|
||||
ProfilingMode_NONE = 0,
|
||||
ProfilingMode_NAN_PANIC = 1,
|
||||
ProfilingMode_INF_PANIC = 2,
|
||||
ProfilingMode_ANY_PANIC = 3,
|
||||
ProfilingMode_MIN = ProfilingMode_NONE,
|
||||
ProfilingMode_MAX = ProfilingMode_ANY_PANIC
|
||||
};
|
||||
|
||||
inline const ProfilingMode (&EnumValuesProfilingMode())[4] {
|
||||
static const ProfilingMode values[] = {
|
||||
ProfilingMode_NONE,
|
||||
ProfilingMode_NAN_PANIC,
|
||||
ProfilingMode_INF_PANIC,
|
||||
ProfilingMode_ANY_PANIC
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesProfilingMode() {
|
||||
static const char * const names[5] = {
|
||||
"NONE",
|
||||
"NAN_PANIC",
|
||||
"INF_PANIC",
|
||||
"ANY_PANIC",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameProfilingMode(ProfilingMode e) {
|
||||
if (::flatbuffers::IsOutRange(e, ProfilingMode_NONE, ProfilingMode_ANY_PANIC)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesProfilingMode()[index];
|
||||
}
|
||||
|
||||
enum ExecutionMode : int8_t {
|
||||
ExecutionMode_SEQUENTIAL = 0,
|
||||
ExecutionMode_STRICT = 1,
|
||||
ExecutionMode_AUTO = 2,
|
||||
ExecutionMode_MIN = ExecutionMode_SEQUENTIAL,
|
||||
ExecutionMode_MAX = ExecutionMode_AUTO
|
||||
};
|
||||
|
||||
inline const ExecutionMode (&EnumValuesExecutionMode())[3] {
|
||||
static const ExecutionMode values[] = {
|
||||
ExecutionMode_SEQUENTIAL,
|
||||
ExecutionMode_STRICT,
|
||||
ExecutionMode_AUTO
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesExecutionMode() {
|
||||
static const char * const names[4] = {
|
||||
"SEQUENTIAL",
|
||||
"STRICT",
|
||||
"AUTO",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameExecutionMode(ExecutionMode e) {
|
||||
if (::flatbuffers::IsOutRange(e, ExecutionMode_SEQUENTIAL, ExecutionMode_AUTO)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesExecutionMode()[index];
|
||||
}
|
||||
|
||||
enum OutputMode : int8_t {
|
||||
OutputMode_IMPLICIT = 0,
|
||||
OutputMode_EXPLICIT = 1,
|
||||
OutputMode_EXPLICIT_AND_IMPLICIT = 2,
|
||||
OutputMode_VARIABLE_SPACE = 3,
|
||||
OutputMode_OPTIMIZED = 4,
|
||||
OutputMode_MIN = OutputMode_IMPLICIT,
|
||||
OutputMode_MAX = OutputMode_OPTIMIZED
|
||||
};
|
||||
|
||||
inline const OutputMode (&EnumValuesOutputMode())[5] {
|
||||
static const OutputMode values[] = {
|
||||
OutputMode_IMPLICIT,
|
||||
OutputMode_EXPLICIT,
|
||||
OutputMode_EXPLICIT_AND_IMPLICIT,
|
||||
OutputMode_VARIABLE_SPACE,
|
||||
OutputMode_OPTIMIZED
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesOutputMode() {
|
||||
static const char * const names[6] = {
|
||||
"IMPLICIT",
|
||||
"EXPLICIT",
|
||||
"EXPLICIT_AND_IMPLICIT",
|
||||
"VARIABLE_SPACE",
|
||||
"OPTIMIZED",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameOutputMode(OutputMode e) {
|
||||
if (::flatbuffers::IsOutRange(e, OutputMode_IMPLICIT, OutputMode_OPTIMIZED)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesOutputMode()[index];
|
||||
}
|
||||
|
||||
enum Direction : int8_t {
|
||||
Direction_FORWARD_ONLY = 0,
|
||||
Direction_FORWARD_AND_BACKWARD = 1,
|
||||
Direction_BACKWARD_ONLY = 2,
|
||||
Direction_MIN = Direction_FORWARD_ONLY,
|
||||
Direction_MAX = Direction_BACKWARD_ONLY
|
||||
};
|
||||
|
||||
inline const Direction (&EnumValuesDirection())[3] {
|
||||
static const Direction values[] = {
|
||||
Direction_FORWARD_ONLY,
|
||||
Direction_FORWARD_AND_BACKWARD,
|
||||
Direction_BACKWARD_ONLY
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char * const *EnumNamesDirection() {
|
||||
static const char * const names[4] = {
|
||||
"FORWARD_ONLY",
|
||||
"FORWARD_AND_BACKWARD",
|
||||
"BACKWARD_ONLY",
|
||||
nullptr
|
||||
};
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameDirection(Direction e) {
|
||||
if (::flatbuffers::IsOutRange(e, Direction_FORWARD_ONLY, Direction_BACKWARD_ONLY)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesDirection()[index];
|
||||
}
|
||||
|
||||
struct FlatConfiguration FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef FlatConfigurationBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ID = 4,
|
||||
VT_EXECUTIONMODE = 6,
|
||||
VT_PROFILINGMODE = 8,
|
||||
VT_OUTPUTMODE = 10,
|
||||
VT_TIMESTATS = 12,
|
||||
VT_FOOTPRINTFORWARD = 14,
|
||||
VT_FOOTPRINTBACKWARD = 16,
|
||||
VT_DIRECTION = 18
|
||||
};
|
||||
int64_t id() const {
|
||||
return GetField<int64_t>(VT_ID, 0);
|
||||
}
|
||||
graph::ExecutionMode executionMode() const {
|
||||
return static_cast<graph::ExecutionMode>(GetField<int8_t>(VT_EXECUTIONMODE, 0));
|
||||
}
|
||||
graph::ProfilingMode profilingMode() const {
|
||||
return static_cast<graph::ProfilingMode>(GetField<int8_t>(VT_PROFILINGMODE, 0));
|
||||
}
|
||||
graph::OutputMode outputMode() const {
|
||||
return static_cast<graph::OutputMode>(GetField<int8_t>(VT_OUTPUTMODE, 0));
|
||||
}
|
||||
bool timestats() const {
|
||||
return GetField<uint8_t>(VT_TIMESTATS, 0) != 0;
|
||||
}
|
||||
int64_t footprintForward() const {
|
||||
return GetField<int64_t>(VT_FOOTPRINTFORWARD, 0);
|
||||
}
|
||||
int64_t footprintBackward() const {
|
||||
return GetField<int64_t>(VT_FOOTPRINTBACKWARD, 0);
|
||||
}
|
||||
graph::Direction direction() const {
|
||||
return static_cast<graph::Direction>(GetField<int8_t>(VT_DIRECTION, 0));
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int64_t>(verifier, VT_ID, 8) &&
|
||||
VerifyField<int8_t>(verifier, VT_EXECUTIONMODE, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_PROFILINGMODE, 1) &&
|
||||
VerifyField<int8_t>(verifier, VT_OUTPUTMODE, 1) &&
|
||||
VerifyField<uint8_t>(verifier, VT_TIMESTATS, 1) &&
|
||||
VerifyField<int64_t>(verifier, VT_FOOTPRINTFORWARD, 8) &&
|
||||
VerifyField<int64_t>(verifier, VT_FOOTPRINTBACKWARD, 8) &&
|
||||
VerifyField<int8_t>(verifier, VT_DIRECTION, 1) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct FlatConfigurationBuilder {
|
||||
typedef FlatConfiguration Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_id(int64_t id) {
|
||||
fbb_.AddElement<int64_t>(FlatConfiguration::VT_ID, id, 0);
|
||||
}
|
||||
void add_executionMode(graph::ExecutionMode executionMode) {
|
||||
fbb_.AddElement<int8_t>(FlatConfiguration::VT_EXECUTIONMODE, static_cast<int8_t>(executionMode), 0);
|
||||
}
|
||||
void add_profilingMode(graph::ProfilingMode profilingMode) {
|
||||
fbb_.AddElement<int8_t>(FlatConfiguration::VT_PROFILINGMODE, static_cast<int8_t>(profilingMode), 0);
|
||||
}
|
||||
void add_outputMode(graph::OutputMode outputMode) {
|
||||
fbb_.AddElement<int8_t>(FlatConfiguration::VT_OUTPUTMODE, static_cast<int8_t>(outputMode), 0);
|
||||
}
|
||||
void add_timestats(bool timestats) {
|
||||
fbb_.AddElement<uint8_t>(FlatConfiguration::VT_TIMESTATS, static_cast<uint8_t>(timestats), 0);
|
||||
}
|
||||
void add_footprintForward(int64_t footprintForward) {
|
||||
fbb_.AddElement<int64_t>(FlatConfiguration::VT_FOOTPRINTFORWARD, footprintForward, 0);
|
||||
}
|
||||
void add_footprintBackward(int64_t footprintBackward) {
|
||||
fbb_.AddElement<int64_t>(FlatConfiguration::VT_FOOTPRINTBACKWARD, footprintBackward, 0);
|
||||
}
|
||||
void add_direction(graph::Direction direction) {
|
||||
fbb_.AddElement<int8_t>(FlatConfiguration::VT_DIRECTION, static_cast<int8_t>(direction), 0);
|
||||
}
|
||||
explicit FlatConfigurationBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<FlatConfiguration> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<FlatConfiguration>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<FlatConfiguration> CreateFlatConfiguration(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int64_t id = 0,
|
||||
graph::ExecutionMode executionMode = graph::ExecutionMode_SEQUENTIAL,
|
||||
graph::ProfilingMode profilingMode = graph::ProfilingMode_NONE,
|
||||
graph::OutputMode outputMode = graph::OutputMode_IMPLICIT,
|
||||
bool timestats = false,
|
||||
int64_t footprintForward = 0,
|
||||
int64_t footprintBackward = 0,
|
||||
graph::Direction direction = graph::Direction_FORWARD_ONLY) {
|
||||
FlatConfigurationBuilder builder_(_fbb);
|
||||
builder_.add_footprintBackward(footprintBackward);
|
||||
builder_.add_footprintForward(footprintForward);
|
||||
builder_.add_id(id);
|
||||
builder_.add_direction(direction);
|
||||
builder_.add_timestats(timestats);
|
||||
builder_.add_outputMode(outputMode);
|
||||
builder_.add_profilingMode(profilingMode);
|
||||
builder_.add_executionMode(executionMode);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline const graph::FlatConfiguration *GetFlatConfiguration(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<graph::FlatConfiguration>(buf);
|
||||
}
|
||||
|
||||
inline const graph::FlatConfiguration *GetSizePrefixedFlatConfiguration(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<graph::FlatConfiguration>(buf);
|
||||
}
|
||||
|
||||
inline bool VerifyFlatConfigurationBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifyBuffer<graph::FlatConfiguration>(nullptr);
|
||||
}
|
||||
|
||||
inline bool VerifySizePrefixedFlatConfigurationBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifySizePrefixedBuffer<graph::FlatConfiguration>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishFlatConfigurationBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatConfiguration> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedFlatConfigurationBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatConfiguration> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace graph
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_CONFIG_GRAPH_H_
|
||||
@@ -0,0 +1,512 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_GRAPH_GRAPH_H_
|
||||
#define FLATBUFFERS_GENERATED_GRAPH_GRAPH_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 2 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 10,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "array_generated.h"
|
||||
#include "config_generated.h"
|
||||
#include "node_generated.h"
|
||||
#include "request_generated.h"
|
||||
#include "result_generated.h"
|
||||
#include "utils_generated.h"
|
||||
#include "variable_generated.h"
|
||||
|
||||
namespace graph {
|
||||
|
||||
struct UpdaterState;
|
||||
struct UpdaterStateBuilder;
|
||||
|
||||
struct SameDiffSubInstance;
|
||||
struct SameDiffSubInstanceBuilder;
|
||||
|
||||
struct FlatGraph;
|
||||
struct FlatGraphBuilder;
|
||||
|
||||
struct FlatDropRequest;
|
||||
struct FlatDropRequestBuilder;
|
||||
|
||||
struct FlatResponse;
|
||||
struct FlatResponseBuilder;
|
||||
|
||||
struct UpdaterState FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef UpdaterStateBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_PARAMNAME = 4,
|
||||
VT_UPDATERSTATEKEYS = 6,
|
||||
VT_UPDATERSTATEVALUES = 8
|
||||
};
|
||||
const ::flatbuffers::String *paramName() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_PARAMNAME);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *updaterStateKeys() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_UPDATERSTATEKEYS);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatArray>> *updaterStateValues() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatArray>> *>(VT_UPDATERSTATEVALUES);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_PARAMNAME) &&
|
||||
verifier.VerifyString(paramName()) &&
|
||||
VerifyOffset(verifier, VT_UPDATERSTATEKEYS) &&
|
||||
verifier.VerifyVector(updaterStateKeys()) &&
|
||||
verifier.VerifyVectorOfStrings(updaterStateKeys()) &&
|
||||
VerifyOffset(verifier, VT_UPDATERSTATEVALUES) &&
|
||||
verifier.VerifyVector(updaterStateValues()) &&
|
||||
verifier.VerifyVectorOfTables(updaterStateValues()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct UpdaterStateBuilder {
|
||||
typedef UpdaterState Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_paramName(::flatbuffers::Offset<::flatbuffers::String> paramName) {
|
||||
fbb_.AddOffset(UpdaterState::VT_PARAMNAME, paramName);
|
||||
}
|
||||
void add_updaterStateKeys(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> updaterStateKeys) {
|
||||
fbb_.AddOffset(UpdaterState::VT_UPDATERSTATEKEYS, updaterStateKeys);
|
||||
}
|
||||
void add_updaterStateValues(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatArray>>> updaterStateValues) {
|
||||
fbb_.AddOffset(UpdaterState::VT_UPDATERSTATEVALUES, updaterStateValues);
|
||||
}
|
||||
explicit UpdaterStateBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<UpdaterState> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<UpdaterState>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<UpdaterState> CreateUpdaterState(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::String> paramName = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> updaterStateKeys = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatArray>>> updaterStateValues = 0) {
|
||||
UpdaterStateBuilder builder_(_fbb);
|
||||
builder_.add_updaterStateValues(updaterStateValues);
|
||||
builder_.add_updaterStateKeys(updaterStateKeys);
|
||||
builder_.add_paramName(paramName);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<UpdaterState> CreateUpdaterStateDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const char *paramName = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *updaterStateKeys = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<graph::FlatArray>> *updaterStateValues = nullptr) {
|
||||
auto paramName__ = paramName ? _fbb.CreateString(paramName) : 0;
|
||||
auto updaterStateKeys__ = updaterStateKeys ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*updaterStateKeys) : 0;
|
||||
auto updaterStateValues__ = updaterStateValues ? _fbb.CreateVector<::flatbuffers::Offset<graph::FlatArray>>(*updaterStateValues) : 0;
|
||||
return graph::CreateUpdaterState(
|
||||
_fbb,
|
||||
paramName__,
|
||||
updaterStateKeys__,
|
||||
updaterStateValues__);
|
||||
}
|
||||
|
||||
struct SameDiffSubInstance FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef SameDiffSubInstanceBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_NAME = 4,
|
||||
VT_SERIALIZEDDATA = 6
|
||||
};
|
||||
const ::flatbuffers::String *name() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_NAME);
|
||||
}
|
||||
const ::flatbuffers::Vector<uint8_t> *serializedData() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<uint8_t> *>(VT_SERIALIZEDDATA);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_NAME) &&
|
||||
verifier.VerifyString(name()) &&
|
||||
VerifyOffset(verifier, VT_SERIALIZEDDATA) &&
|
||||
verifier.VerifyVector(serializedData()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct SameDiffSubInstanceBuilder {
|
||||
typedef SameDiffSubInstance Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_name(::flatbuffers::Offset<::flatbuffers::String> name) {
|
||||
fbb_.AddOffset(SameDiffSubInstance::VT_NAME, name);
|
||||
}
|
||||
void add_serializedData(::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> serializedData) {
|
||||
fbb_.AddOffset(SameDiffSubInstance::VT_SERIALIZEDDATA, serializedData);
|
||||
}
|
||||
explicit SameDiffSubInstanceBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<SameDiffSubInstance> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<SameDiffSubInstance>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<SameDiffSubInstance> CreateSameDiffSubInstance(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<::flatbuffers::String> name = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> serializedData = 0) {
|
||||
SameDiffSubInstanceBuilder builder_(_fbb);
|
||||
builder_.add_serializedData(serializedData);
|
||||
builder_.add_name(name);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<SameDiffSubInstance> CreateSameDiffSubInstanceDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const char *name = nullptr,
|
||||
const std::vector<uint8_t> *serializedData = nullptr) {
|
||||
auto name__ = name ? _fbb.CreateString(name) : 0;
|
||||
auto serializedData__ = serializedData ? _fbb.CreateVector<uint8_t>(*serializedData) : 0;
|
||||
return graph::CreateSameDiffSubInstance(
|
||||
_fbb,
|
||||
name__,
|
||||
serializedData__);
|
||||
}
|
||||
|
||||
struct FlatGraph FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef FlatGraphBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ID = 4,
|
||||
VT_VARIABLES = 6,
|
||||
VT_NODES = 8,
|
||||
VT_OUTPUTS = 10,
|
||||
VT_CONFIGURATION = 12,
|
||||
VT_PLACEHOLDERS = 14,
|
||||
VT_LOSSVARIABLES = 16,
|
||||
VT_TRAININGCONFIG = 18,
|
||||
VT_UPDATERSTATE = 20,
|
||||
VT_METADATAKEYS = 22,
|
||||
VT_METADATAVALUES = 24,
|
||||
VT_SUBINSTANCES = 26
|
||||
};
|
||||
int64_t id() const {
|
||||
return GetField<int64_t>(VT_ID, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatVariable>> *variables() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatVariable>> *>(VT_VARIABLES);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatNode>> *nodes() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatNode>> *>(VT_NODES);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>> *outputs() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>> *>(VT_OUTPUTS);
|
||||
}
|
||||
const graph::FlatConfiguration *configuration() const {
|
||||
return GetPointer<const graph::FlatConfiguration *>(VT_CONFIGURATION);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *placeholders() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_PLACEHOLDERS);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *lossVariables() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_LOSSVARIABLES);
|
||||
}
|
||||
const ::flatbuffers::String *trainingConfig() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_TRAININGCONFIG);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::UpdaterState>> *updaterState() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::UpdaterState>> *>(VT_UPDATERSTATE);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *metadataKeys() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_METADATAKEYS);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *metadataValues() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_METADATAVALUES);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::SameDiffSubInstance>> *subInstances() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::SameDiffSubInstance>> *>(VT_SUBINSTANCES);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int64_t>(verifier, VT_ID, 8) &&
|
||||
VerifyOffset(verifier, VT_VARIABLES) &&
|
||||
verifier.VerifyVector(variables()) &&
|
||||
verifier.VerifyVectorOfTables(variables()) &&
|
||||
VerifyOffset(verifier, VT_NODES) &&
|
||||
verifier.VerifyVector(nodes()) &&
|
||||
verifier.VerifyVectorOfTables(nodes()) &&
|
||||
VerifyOffset(verifier, VT_OUTPUTS) &&
|
||||
verifier.VerifyVector(outputs()) &&
|
||||
verifier.VerifyVectorOfTables(outputs()) &&
|
||||
VerifyOffset(verifier, VT_CONFIGURATION) &&
|
||||
verifier.VerifyTable(configuration()) &&
|
||||
VerifyOffset(verifier, VT_PLACEHOLDERS) &&
|
||||
verifier.VerifyVector(placeholders()) &&
|
||||
verifier.VerifyVectorOfStrings(placeholders()) &&
|
||||
VerifyOffset(verifier, VT_LOSSVARIABLES) &&
|
||||
verifier.VerifyVector(lossVariables()) &&
|
||||
verifier.VerifyVectorOfStrings(lossVariables()) &&
|
||||
VerifyOffset(verifier, VT_TRAININGCONFIG) &&
|
||||
verifier.VerifyString(trainingConfig()) &&
|
||||
VerifyOffset(verifier, VT_UPDATERSTATE) &&
|
||||
verifier.VerifyVector(updaterState()) &&
|
||||
verifier.VerifyVectorOfTables(updaterState()) &&
|
||||
VerifyOffset(verifier, VT_METADATAKEYS) &&
|
||||
verifier.VerifyVector(metadataKeys()) &&
|
||||
verifier.VerifyVectorOfStrings(metadataKeys()) &&
|
||||
VerifyOffset(verifier, VT_METADATAVALUES) &&
|
||||
verifier.VerifyVector(metadataValues()) &&
|
||||
verifier.VerifyVectorOfStrings(metadataValues()) &&
|
||||
VerifyOffset(verifier, VT_SUBINSTANCES) &&
|
||||
verifier.VerifyVector(subInstances()) &&
|
||||
verifier.VerifyVectorOfTables(subInstances()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct FlatGraphBuilder {
|
||||
typedef FlatGraph Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_id(int64_t id) {
|
||||
fbb_.AddElement<int64_t>(FlatGraph::VT_ID, id, 0);
|
||||
}
|
||||
void add_variables(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatVariable>>> variables) {
|
||||
fbb_.AddOffset(FlatGraph::VT_VARIABLES, variables);
|
||||
}
|
||||
void add_nodes(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatNode>>> nodes) {
|
||||
fbb_.AddOffset(FlatGraph::VT_NODES, nodes);
|
||||
}
|
||||
void add_outputs(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>>> outputs) {
|
||||
fbb_.AddOffset(FlatGraph::VT_OUTPUTS, outputs);
|
||||
}
|
||||
void add_configuration(::flatbuffers::Offset<graph::FlatConfiguration> configuration) {
|
||||
fbb_.AddOffset(FlatGraph::VT_CONFIGURATION, configuration);
|
||||
}
|
||||
void add_placeholders(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> placeholders) {
|
||||
fbb_.AddOffset(FlatGraph::VT_PLACEHOLDERS, placeholders);
|
||||
}
|
||||
void add_lossVariables(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> lossVariables) {
|
||||
fbb_.AddOffset(FlatGraph::VT_LOSSVARIABLES, lossVariables);
|
||||
}
|
||||
void add_trainingConfig(::flatbuffers::Offset<::flatbuffers::String> trainingConfig) {
|
||||
fbb_.AddOffset(FlatGraph::VT_TRAININGCONFIG, trainingConfig);
|
||||
}
|
||||
void add_updaterState(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::UpdaterState>>> updaterState) {
|
||||
fbb_.AddOffset(FlatGraph::VT_UPDATERSTATE, updaterState);
|
||||
}
|
||||
void add_metadataKeys(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> metadataKeys) {
|
||||
fbb_.AddOffset(FlatGraph::VT_METADATAKEYS, metadataKeys);
|
||||
}
|
||||
void add_metadataValues(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> metadataValues) {
|
||||
fbb_.AddOffset(FlatGraph::VT_METADATAVALUES, metadataValues);
|
||||
}
|
||||
void add_subInstances(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::SameDiffSubInstance>>> subInstances) {
|
||||
fbb_.AddOffset(FlatGraph::VT_SUBINSTANCES, subInstances);
|
||||
}
|
||||
explicit FlatGraphBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<FlatGraph> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<FlatGraph>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<FlatGraph> CreateFlatGraph(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int64_t id = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatVariable>>> variables = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatNode>>> nodes = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>>> outputs = 0,
|
||||
::flatbuffers::Offset<graph::FlatConfiguration> configuration = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> placeholders = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> lossVariables = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> trainingConfig = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::UpdaterState>>> updaterState = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> metadataKeys = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> metadataValues = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::SameDiffSubInstance>>> subInstances = 0) {
|
||||
FlatGraphBuilder builder_(_fbb);
|
||||
builder_.add_id(id);
|
||||
builder_.add_subInstances(subInstances);
|
||||
builder_.add_metadataValues(metadataValues);
|
||||
builder_.add_metadataKeys(metadataKeys);
|
||||
builder_.add_updaterState(updaterState);
|
||||
builder_.add_trainingConfig(trainingConfig);
|
||||
builder_.add_lossVariables(lossVariables);
|
||||
builder_.add_placeholders(placeholders);
|
||||
builder_.add_configuration(configuration);
|
||||
builder_.add_outputs(outputs);
|
||||
builder_.add_nodes(nodes);
|
||||
builder_.add_variables(variables);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<FlatGraph> CreateFlatGraphDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int64_t id = 0,
|
||||
const std::vector<::flatbuffers::Offset<graph::FlatVariable>> *variables = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<graph::FlatNode>> *nodes = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<graph::IntPair>> *outputs = nullptr,
|
||||
::flatbuffers::Offset<graph::FlatConfiguration> configuration = 0,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *placeholders = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *lossVariables = nullptr,
|
||||
const char *trainingConfig = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<graph::UpdaterState>> *updaterState = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *metadataKeys = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *metadataValues = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<graph::SameDiffSubInstance>> *subInstances = nullptr) {
|
||||
auto variables__ = variables ? _fbb.CreateVector<::flatbuffers::Offset<graph::FlatVariable>>(*variables) : 0;
|
||||
auto nodes__ = nodes ? _fbb.CreateVector<::flatbuffers::Offset<graph::FlatNode>>(*nodes) : 0;
|
||||
auto outputs__ = outputs ? _fbb.CreateVector<::flatbuffers::Offset<graph::IntPair>>(*outputs) : 0;
|
||||
auto placeholders__ = placeholders ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*placeholders) : 0;
|
||||
auto lossVariables__ = lossVariables ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*lossVariables) : 0;
|
||||
auto trainingConfig__ = trainingConfig ? _fbb.CreateString(trainingConfig) : 0;
|
||||
auto updaterState__ = updaterState ? _fbb.CreateVector<::flatbuffers::Offset<graph::UpdaterState>>(*updaterState) : 0;
|
||||
auto metadataKeys__ = metadataKeys ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*metadataKeys) : 0;
|
||||
auto metadataValues__ = metadataValues ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*metadataValues) : 0;
|
||||
auto subInstances__ = subInstances ? _fbb.CreateVector<::flatbuffers::Offset<graph::SameDiffSubInstance>>(*subInstances) : 0;
|
||||
return graph::CreateFlatGraph(
|
||||
_fbb,
|
||||
id,
|
||||
variables__,
|
||||
nodes__,
|
||||
outputs__,
|
||||
configuration,
|
||||
placeholders__,
|
||||
lossVariables__,
|
||||
trainingConfig__,
|
||||
updaterState__,
|
||||
metadataKeys__,
|
||||
metadataValues__,
|
||||
subInstances__);
|
||||
}
|
||||
|
||||
struct FlatDropRequest FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef FlatDropRequestBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ID = 4
|
||||
};
|
||||
int64_t id() const {
|
||||
return GetField<int64_t>(VT_ID, 0);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int64_t>(verifier, VT_ID, 8) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct FlatDropRequestBuilder {
|
||||
typedef FlatDropRequest Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_id(int64_t id) {
|
||||
fbb_.AddElement<int64_t>(FlatDropRequest::VT_ID, id, 0);
|
||||
}
|
||||
explicit FlatDropRequestBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<FlatDropRequest> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<FlatDropRequest>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<FlatDropRequest> CreateFlatDropRequest(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int64_t id = 0) {
|
||||
FlatDropRequestBuilder builder_(_fbb);
|
||||
builder_.add_id(id);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct FlatResponse FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef FlatResponseBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_STATUS = 4
|
||||
};
|
||||
int32_t status() const {
|
||||
return GetField<int32_t>(VT_STATUS, 0);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_STATUS, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct FlatResponseBuilder {
|
||||
typedef FlatResponse Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_status(int32_t status) {
|
||||
fbb_.AddElement<int32_t>(FlatResponse::VT_STATUS, status, 0);
|
||||
}
|
||||
explicit FlatResponseBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<FlatResponse> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<FlatResponse>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<FlatResponse> CreateFlatResponse(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t status = 0) {
|
||||
FlatResponseBuilder builder_(_fbb);
|
||||
builder_.add_status(status);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline const graph::FlatGraph *GetFlatGraph(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<graph::FlatGraph>(buf);
|
||||
}
|
||||
|
||||
inline const graph::FlatGraph *GetSizePrefixedFlatGraph(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<graph::FlatGraph>(buf);
|
||||
}
|
||||
|
||||
inline bool VerifyFlatGraphBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifyBuffer<graph::FlatGraph>(nullptr);
|
||||
}
|
||||
|
||||
inline bool VerifySizePrefixedFlatGraphBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifySizePrefixedBuffer<graph::FlatGraph>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishFlatGraphBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatGraph> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedFlatGraphBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatGraph> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace graph
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_GRAPH_GRAPH_H_
|
||||
@@ -0,0 +1,426 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_NODE_GRAPH_H_
|
||||
#define FLATBUFFERS_GENERATED_NODE_GRAPH_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 2 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 10,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "array_generated.h"
|
||||
#include "properties_generated.h"
|
||||
#include "utils_generated.h"
|
||||
|
||||
namespace graph {
|
||||
|
||||
struct FlatNode;
|
||||
struct FlatNodeBuilder;
|
||||
|
||||
struct FlatNode FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef FlatNodeBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ID = 4,
|
||||
VT_NAME = 6,
|
||||
VT_OPTYPE = 8,
|
||||
VT_OPNUM = 10,
|
||||
VT_PROPERTIES = 12,
|
||||
VT_INPUT = 14,
|
||||
VT_INPUTPAIRED = 16,
|
||||
VT_OUTPUT = 18,
|
||||
VT_EXTRAPARAMS = 20,
|
||||
VT_EXTRAINTEGER = 22,
|
||||
VT_EXTRABOOLS = 24,
|
||||
VT_DIMENSIONS = 26,
|
||||
VT_DEVICE = 28,
|
||||
VT_SCOPE_ID = 30,
|
||||
VT_SCOPE_NAME = 32,
|
||||
VT_OUTPUTNAMES = 34,
|
||||
VT_OPNAME = 36,
|
||||
VT_OUTPUTTYPES = 38,
|
||||
VT_SCALAR = 40,
|
||||
VT_CONTROLDEPS = 42,
|
||||
VT_VARCONTROLDEPS = 44,
|
||||
VT_CONTROLDEPFOR = 46,
|
||||
VT_EXTRATYPES = 48,
|
||||
VT_EXTRASTRINGS = 50
|
||||
};
|
||||
int32_t id() const {
|
||||
return GetField<int32_t>(VT_ID, 0);
|
||||
}
|
||||
const ::flatbuffers::String *name() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_NAME);
|
||||
}
|
||||
graph::OpType opType() const {
|
||||
return static_cast<graph::OpType>(GetField<int8_t>(VT_OPTYPE, 0));
|
||||
}
|
||||
int64_t opNum() const {
|
||||
return GetField<int64_t>(VT_OPNUM, 0);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatProperties>> *properties() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatProperties>> *>(VT_PROPERTIES);
|
||||
}
|
||||
const ::flatbuffers::Vector<int32_t> *input() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_INPUT);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>> *inputPaired() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>> *>(VT_INPUTPAIRED);
|
||||
}
|
||||
const ::flatbuffers::Vector<int32_t> *output() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_OUTPUT);
|
||||
}
|
||||
const ::flatbuffers::Vector<double> *extraParams() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<double> *>(VT_EXTRAPARAMS);
|
||||
}
|
||||
const ::flatbuffers::Vector<int64_t> *extraInteger() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int64_t> *>(VT_EXTRAINTEGER);
|
||||
}
|
||||
const ::flatbuffers::Vector<uint8_t> *extraBools() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<uint8_t> *>(VT_EXTRABOOLS);
|
||||
}
|
||||
const ::flatbuffers::Vector<int32_t> *dimensions() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int32_t> *>(VT_DIMENSIONS);
|
||||
}
|
||||
int32_t device() const {
|
||||
return GetField<int32_t>(VT_DEVICE, 0);
|
||||
}
|
||||
int32_t scope_id() const {
|
||||
return GetField<int32_t>(VT_SCOPE_ID, 0);
|
||||
}
|
||||
const ::flatbuffers::String *scope_name() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_SCOPE_NAME);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *outputNames() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_OUTPUTNAMES);
|
||||
}
|
||||
const ::flatbuffers::String *opName() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_OPNAME);
|
||||
}
|
||||
const ::flatbuffers::Vector<int8_t> *outputTypes() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int8_t> *>(VT_OUTPUTTYPES);
|
||||
}
|
||||
const graph::FlatArray *scalar() const {
|
||||
return GetPointer<const graph::FlatArray *>(VT_SCALAR);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *controlDeps() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_CONTROLDEPS);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *varControlDeps() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_VARCONTROLDEPS);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *controlDepFor() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_CONTROLDEPFOR);
|
||||
}
|
||||
const ::flatbuffers::Vector<int8_t> *extraTypes() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<int8_t> *>(VT_EXTRATYPES);
|
||||
}
|
||||
const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *extraStrings() const {
|
||||
return GetPointer<const ::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>> *>(VT_EXTRASTRINGS);
|
||||
}
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_ID, 4) &&
|
||||
VerifyOffset(verifier, VT_NAME) &&
|
||||
verifier.VerifyString(name()) &&
|
||||
VerifyField<int8_t>(verifier, VT_OPTYPE, 1) &&
|
||||
VerifyField<int64_t>(verifier, VT_OPNUM, 8) &&
|
||||
VerifyOffset(verifier, VT_PROPERTIES) &&
|
||||
verifier.VerifyVector(properties()) &&
|
||||
verifier.VerifyVectorOfTables(properties()) &&
|
||||
VerifyOffset(verifier, VT_INPUT) &&
|
||||
verifier.VerifyVector(input()) &&
|
||||
VerifyOffset(verifier, VT_INPUTPAIRED) &&
|
||||
verifier.VerifyVector(inputPaired()) &&
|
||||
verifier.VerifyVectorOfTables(inputPaired()) &&
|
||||
VerifyOffset(verifier, VT_OUTPUT) &&
|
||||
verifier.VerifyVector(output()) &&
|
||||
VerifyOffset(verifier, VT_EXTRAPARAMS) &&
|
||||
verifier.VerifyVector(extraParams()) &&
|
||||
VerifyOffset(verifier, VT_EXTRAINTEGER) &&
|
||||
verifier.VerifyVector(extraInteger()) &&
|
||||
VerifyOffset(verifier, VT_EXTRABOOLS) &&
|
||||
verifier.VerifyVector(extraBools()) &&
|
||||
VerifyOffset(verifier, VT_DIMENSIONS) &&
|
||||
verifier.VerifyVector(dimensions()) &&
|
||||
VerifyField<int32_t>(verifier, VT_DEVICE, 4) &&
|
||||
VerifyField<int32_t>(verifier, VT_SCOPE_ID, 4) &&
|
||||
VerifyOffset(verifier, VT_SCOPE_NAME) &&
|
||||
verifier.VerifyString(scope_name()) &&
|
||||
VerifyOffset(verifier, VT_OUTPUTNAMES) &&
|
||||
verifier.VerifyVector(outputNames()) &&
|
||||
verifier.VerifyVectorOfStrings(outputNames()) &&
|
||||
VerifyOffset(verifier, VT_OPNAME) &&
|
||||
verifier.VerifyString(opName()) &&
|
||||
VerifyOffset(verifier, VT_OUTPUTTYPES) &&
|
||||
verifier.VerifyVector(outputTypes()) &&
|
||||
VerifyOffset(verifier, VT_SCALAR) &&
|
||||
verifier.VerifyTable(scalar()) &&
|
||||
VerifyOffset(verifier, VT_CONTROLDEPS) &&
|
||||
verifier.VerifyVector(controlDeps()) &&
|
||||
verifier.VerifyVectorOfStrings(controlDeps()) &&
|
||||
VerifyOffset(verifier, VT_VARCONTROLDEPS) &&
|
||||
verifier.VerifyVector(varControlDeps()) &&
|
||||
verifier.VerifyVectorOfStrings(varControlDeps()) &&
|
||||
VerifyOffset(verifier, VT_CONTROLDEPFOR) &&
|
||||
verifier.VerifyVector(controlDepFor()) &&
|
||||
verifier.VerifyVectorOfStrings(controlDepFor()) &&
|
||||
VerifyOffset(verifier, VT_EXTRATYPES) &&
|
||||
verifier.VerifyVector(extraTypes()) &&
|
||||
VerifyOffset(verifier, VT_EXTRASTRINGS) &&
|
||||
verifier.VerifyVector(extraStrings()) &&
|
||||
verifier.VerifyVectorOfStrings(extraStrings()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct FlatNodeBuilder {
|
||||
typedef FlatNode Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_id(int32_t id) {
|
||||
fbb_.AddElement<int32_t>(FlatNode::VT_ID, id, 0);
|
||||
}
|
||||
void add_name(::flatbuffers::Offset<::flatbuffers::String> name) {
|
||||
fbb_.AddOffset(FlatNode::VT_NAME, name);
|
||||
}
|
||||
void add_opType(graph::OpType opType) {
|
||||
fbb_.AddElement<int8_t>(FlatNode::VT_OPTYPE, static_cast<int8_t>(opType), 0);
|
||||
}
|
||||
void add_opNum(int64_t opNum) {
|
||||
fbb_.AddElement<int64_t>(FlatNode::VT_OPNUM, opNum, 0);
|
||||
}
|
||||
void add_properties(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatProperties>>> properties) {
|
||||
fbb_.AddOffset(FlatNode::VT_PROPERTIES, properties);
|
||||
}
|
||||
void add_input(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> input) {
|
||||
fbb_.AddOffset(FlatNode::VT_INPUT, input);
|
||||
}
|
||||
void add_inputPaired(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>>> inputPaired) {
|
||||
fbb_.AddOffset(FlatNode::VT_INPUTPAIRED, inputPaired);
|
||||
}
|
||||
void add_output(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> output) {
|
||||
fbb_.AddOffset(FlatNode::VT_OUTPUT, output);
|
||||
}
|
||||
void add_extraParams(::flatbuffers::Offset<::flatbuffers::Vector<double>> extraParams) {
|
||||
fbb_.AddOffset(FlatNode::VT_EXTRAPARAMS, extraParams);
|
||||
}
|
||||
void add_extraInteger(::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> extraInteger) {
|
||||
fbb_.AddOffset(FlatNode::VT_EXTRAINTEGER, extraInteger);
|
||||
}
|
||||
void add_extraBools(::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> extraBools) {
|
||||
fbb_.AddOffset(FlatNode::VT_EXTRABOOLS, extraBools);
|
||||
}
|
||||
void add_dimensions(::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> dimensions) {
|
||||
fbb_.AddOffset(FlatNode::VT_DIMENSIONS, dimensions);
|
||||
}
|
||||
void add_device(int32_t device) {
|
||||
fbb_.AddElement<int32_t>(FlatNode::VT_DEVICE, device, 0);
|
||||
}
|
||||
void add_scope_id(int32_t scope_id) {
|
||||
fbb_.AddElement<int32_t>(FlatNode::VT_SCOPE_ID, scope_id, 0);
|
||||
}
|
||||
void add_scope_name(::flatbuffers::Offset<::flatbuffers::String> scope_name) {
|
||||
fbb_.AddOffset(FlatNode::VT_SCOPE_NAME, scope_name);
|
||||
}
|
||||
void add_outputNames(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> outputNames) {
|
||||
fbb_.AddOffset(FlatNode::VT_OUTPUTNAMES, outputNames);
|
||||
}
|
||||
void add_opName(::flatbuffers::Offset<::flatbuffers::String> opName) {
|
||||
fbb_.AddOffset(FlatNode::VT_OPNAME, opName);
|
||||
}
|
||||
void add_outputTypes(::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> outputTypes) {
|
||||
fbb_.AddOffset(FlatNode::VT_OUTPUTTYPES, outputTypes);
|
||||
}
|
||||
void add_scalar(::flatbuffers::Offset<graph::FlatArray> scalar) {
|
||||
fbb_.AddOffset(FlatNode::VT_SCALAR, scalar);
|
||||
}
|
||||
void add_controlDeps(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> controlDeps) {
|
||||
fbb_.AddOffset(FlatNode::VT_CONTROLDEPS, controlDeps);
|
||||
}
|
||||
void add_varControlDeps(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> varControlDeps) {
|
||||
fbb_.AddOffset(FlatNode::VT_VARCONTROLDEPS, varControlDeps);
|
||||
}
|
||||
void add_controlDepFor(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> controlDepFor) {
|
||||
fbb_.AddOffset(FlatNode::VT_CONTROLDEPFOR, controlDepFor);
|
||||
}
|
||||
void add_extraTypes(::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> extraTypes) {
|
||||
fbb_.AddOffset(FlatNode::VT_EXTRATYPES, extraTypes);
|
||||
}
|
||||
void add_extraStrings(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> extraStrings) {
|
||||
fbb_.AddOffset(FlatNode::VT_EXTRASTRINGS, extraStrings);
|
||||
}
|
||||
explicit FlatNodeBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<FlatNode> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<FlatNode>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<FlatNode> CreateFlatNode(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t id = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> name = 0,
|
||||
graph::OpType opType = graph::OpType_TRANSFORM_FLOAT,
|
||||
int64_t opNum = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::FlatProperties>>> properties = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> input = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<graph::IntPair>>> inputPaired = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> output = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<double>> extraParams = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int64_t>> extraInteger = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<uint8_t>> extraBools = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int32_t>> dimensions = 0,
|
||||
int32_t device = 0,
|
||||
int32_t scope_id = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> scope_name = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> outputNames = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::String> opName = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> outputTypes = 0,
|
||||
::flatbuffers::Offset<graph::FlatArray> scalar = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> controlDeps = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> varControlDeps = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> controlDepFor = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<int8_t>> extraTypes = 0,
|
||||
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::flatbuffers::String>>> extraStrings = 0) {
|
||||
FlatNodeBuilder builder_(_fbb);
|
||||
builder_.add_opNum(opNum);
|
||||
builder_.add_extraStrings(extraStrings);
|
||||
builder_.add_extraTypes(extraTypes);
|
||||
builder_.add_controlDepFor(controlDepFor);
|
||||
builder_.add_varControlDeps(varControlDeps);
|
||||
builder_.add_controlDeps(controlDeps);
|
||||
builder_.add_scalar(scalar);
|
||||
builder_.add_outputTypes(outputTypes);
|
||||
builder_.add_opName(opName);
|
||||
builder_.add_outputNames(outputNames);
|
||||
builder_.add_scope_name(scope_name);
|
||||
builder_.add_scope_id(scope_id);
|
||||
builder_.add_device(device);
|
||||
builder_.add_dimensions(dimensions);
|
||||
builder_.add_extraBools(extraBools);
|
||||
builder_.add_extraInteger(extraInteger);
|
||||
builder_.add_extraParams(extraParams);
|
||||
builder_.add_output(output);
|
||||
builder_.add_inputPaired(inputPaired);
|
||||
builder_.add_input(input);
|
||||
builder_.add_properties(properties);
|
||||
builder_.add_name(name);
|
||||
builder_.add_id(id);
|
||||
builder_.add_opType(opType);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<FlatNode> CreateFlatNodeDirect(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t id = 0,
|
||||
const char *name = nullptr,
|
||||
graph::OpType opType = graph::OpType_TRANSFORM_FLOAT,
|
||||
int64_t opNum = 0,
|
||||
const std::vector<::flatbuffers::Offset<graph::FlatProperties>> *properties = nullptr,
|
||||
const std::vector<int32_t> *input = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<graph::IntPair>> *inputPaired = nullptr,
|
||||
const std::vector<int32_t> *output = nullptr,
|
||||
const std::vector<double> *extraParams = nullptr,
|
||||
const std::vector<int64_t> *extraInteger = nullptr,
|
||||
const std::vector<uint8_t> *extraBools = nullptr,
|
||||
const std::vector<int32_t> *dimensions = nullptr,
|
||||
int32_t device = 0,
|
||||
int32_t scope_id = 0,
|
||||
const char *scope_name = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *outputNames = nullptr,
|
||||
const char *opName = nullptr,
|
||||
const std::vector<int8_t> *outputTypes = nullptr,
|
||||
::flatbuffers::Offset<graph::FlatArray> scalar = 0,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *controlDeps = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *varControlDeps = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *controlDepFor = nullptr,
|
||||
const std::vector<int8_t> *extraTypes = nullptr,
|
||||
const std::vector<::flatbuffers::Offset<::flatbuffers::String>> *extraStrings = nullptr) {
|
||||
auto name__ = name ? _fbb.CreateString(name) : 0;
|
||||
auto properties__ = properties ? _fbb.CreateVector<::flatbuffers::Offset<graph::FlatProperties>>(*properties) : 0;
|
||||
auto input__ = input ? _fbb.CreateVector<int32_t>(*input) : 0;
|
||||
auto inputPaired__ = inputPaired ? _fbb.CreateVector<::flatbuffers::Offset<graph::IntPair>>(*inputPaired) : 0;
|
||||
auto output__ = output ? _fbb.CreateVector<int32_t>(*output) : 0;
|
||||
auto extraParams__ = extraParams ? _fbb.CreateVector<double>(*extraParams) : 0;
|
||||
auto extraInteger__ = extraInteger ? _fbb.CreateVector<int64_t>(*extraInteger) : 0;
|
||||
auto extraBools__ = extraBools ? _fbb.CreateVector<uint8_t>(*extraBools) : 0;
|
||||
auto dimensions__ = dimensions ? _fbb.CreateVector<int32_t>(*dimensions) : 0;
|
||||
auto scope_name__ = scope_name ? _fbb.CreateString(scope_name) : 0;
|
||||
auto outputNames__ = outputNames ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*outputNames) : 0;
|
||||
auto opName__ = opName ? _fbb.CreateString(opName) : 0;
|
||||
auto outputTypes__ = outputTypes ? _fbb.CreateVector<int8_t>(*outputTypes) : 0;
|
||||
auto controlDeps__ = controlDeps ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*controlDeps) : 0;
|
||||
auto varControlDeps__ = varControlDeps ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*varControlDeps) : 0;
|
||||
auto controlDepFor__ = controlDepFor ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*controlDepFor) : 0;
|
||||
auto extraTypes__ = extraTypes ? _fbb.CreateVector<int8_t>(*extraTypes) : 0;
|
||||
auto extraStrings__ = extraStrings ? _fbb.CreateVector<::flatbuffers::Offset<::flatbuffers::String>>(*extraStrings) : 0;
|
||||
return graph::CreateFlatNode(
|
||||
_fbb,
|
||||
id,
|
||||
name__,
|
||||
opType,
|
||||
opNum,
|
||||
properties__,
|
||||
input__,
|
||||
inputPaired__,
|
||||
output__,
|
||||
extraParams__,
|
||||
extraInteger__,
|
||||
extraBools__,
|
||||
dimensions__,
|
||||
device,
|
||||
scope_id,
|
||||
scope_name__,
|
||||
outputNames__,
|
||||
opName__,
|
||||
outputTypes__,
|
||||
scalar,
|
||||
controlDeps__,
|
||||
varControlDeps__,
|
||||
controlDepFor__,
|
||||
extraTypes__,
|
||||
extraStrings__);
|
||||
}
|
||||
|
||||
inline const graph::FlatNode *GetFlatNode(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<graph::FlatNode>(buf);
|
||||
}
|
||||
|
||||
inline const graph::FlatNode *GetSizePrefixedFlatNode(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<graph::FlatNode>(buf);
|
||||
}
|
||||
|
||||
inline bool VerifyFlatNodeBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifyBuffer<graph::FlatNode>(nullptr);
|
||||
}
|
||||
|
||||
inline bool VerifySizePrefixedFlatNodeBuffer(
|
||||
::flatbuffers::Verifier &verifier) {
|
||||
return verifier.VerifySizePrefixedBuffer<graph::FlatNode>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishFlatNodeBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatNode> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedFlatNodeBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<graph::FlatNode> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
} // namespace graph
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_NODE_GRAPH_H_
|
||||
@@ -0,0 +1,65 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class BufferChunk extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static BufferChunk getRootAsBufferChunk(ByteBuffer _bb) { return getRootAsBufferChunk(_bb, new BufferChunk()); }
|
||||
public static BufferChunk getRootAsBufferChunk(ByteBuffer _bb, BufferChunk obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public BufferChunk __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long index() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public byte data(int j) { int o = __offset(6); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
|
||||
public int dataLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector dataVector() { return dataVector(new ByteVector()); }
|
||||
public ByteVector dataVector(ByteVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer dataAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
|
||||
public ByteBuffer dataInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
|
||||
|
||||
public static int createBufferChunk(FlatBufferBuilder builder,
|
||||
long index,
|
||||
int dataOffset) {
|
||||
builder.startTable(2);
|
||||
BufferChunk.addIndex(builder, index);
|
||||
BufferChunk.addData(builder, dataOffset);
|
||||
return BufferChunk.endBufferChunk(builder);
|
||||
}
|
||||
|
||||
public static void startBufferChunk(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addIndex(FlatBufferBuilder builder, long index) { builder.addLong(0, index, 0L); }
|
||||
public static void addData(FlatBufferBuilder builder, int dataOffset) { builder.addOffset(1, dataOffset, 0); }
|
||||
public static int createDataVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createDataVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startDataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static int endBufferChunk(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public BufferChunk get(int j) { return get(new BufferChunk(), j); }
|
||||
public BufferChunk get(BufferChunk obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class ByteOrder {
|
||||
private ByteOrder() { }
|
||||
public static final byte LE = 0;
|
||||
public static final byte BE = 1;
|
||||
|
||||
public static final String[] names = { "LE", "BE", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class DType {
|
||||
private DType() { }
|
||||
public static final byte INHERIT = 0;
|
||||
public static final byte BOOL = 1;
|
||||
public static final byte FLOAT8 = 2;
|
||||
public static final byte HALF = 3;
|
||||
public static final byte HALF2 = 4;
|
||||
public static final byte FLOAT = 5;
|
||||
public static final byte DOUBLE = 6;
|
||||
public static final byte INT8 = 7;
|
||||
public static final byte INT16 = 8;
|
||||
public static final byte INT32 = 9;
|
||||
public static final byte INT64 = 10;
|
||||
public static final byte UINT8 = 11;
|
||||
public static final byte UINT16 = 12;
|
||||
public static final byte UINT32 = 13;
|
||||
public static final byte UINT64 = 14;
|
||||
public static final byte QINT8 = 15;
|
||||
public static final byte QINT16 = 16;
|
||||
public static final byte BFLOAT16 = 17;
|
||||
public static final byte UTF8 = 50;
|
||||
public static final byte UTF16 = 51;
|
||||
public static final byte UTF32 = 52;
|
||||
|
||||
public static final String[] names = { "INHERIT", "BOOL", "FLOAT8", "HALF", "HALF2", "FLOAT", "DOUBLE", "INT8", "INT16", "INT32", "INT64", "UINT8", "UINT16", "UINT32", "UINT64", "QINT8", "QINT16", "BFLOAT16", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "UTF8", "UTF16", "UTF32", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class Direction {
|
||||
private Direction() { }
|
||||
public static final byte FORWARD_ONLY = 0;
|
||||
public static final byte FORWARD_AND_BACKWARD = 1;
|
||||
public static final byte BACKWARD_ONLY = 2;
|
||||
|
||||
public static final String[] names = { "FORWARD_ONLY", "FORWARD_AND_BACKWARD", "BACKWARD_ONLY", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class ExecutionMode {
|
||||
private ExecutionMode() { }
|
||||
public static final byte SEQUENTIAL = 0;
|
||||
public static final byte STRICT = 1;
|
||||
public static final byte AUTO = 2;
|
||||
|
||||
public static final String[] names = { "SEQUENTIAL", "STRICT", "AUTO", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatArray extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatArray getRootAsFlatArray(ByteBuffer _bb) { return getRootAsFlatArray(_bb, new FlatArray()); }
|
||||
public static FlatArray getRootAsFlatArray(ByteBuffer _bb, FlatArray obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatArray __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long shape(int j) { int o = __offset(4); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int shapeLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector shapeVector() { return shapeVector(new LongVector()); }
|
||||
public LongVector shapeVector(LongVector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer shapeAsByteBuffer() { return __vector_as_bytebuffer(4, 8); }
|
||||
public ByteBuffer shapeInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 8); }
|
||||
public byte buffer(int j) { int o = __offset(6); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
|
||||
public int bufferLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector bufferVector() { return bufferVector(new ByteVector()); }
|
||||
public ByteVector bufferVector(ByteVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer bufferAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
|
||||
public ByteBuffer bufferInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
|
||||
public byte dtype() { int o = __offset(8); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public byte byteOrder() { int o = __offset(10); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public org.nd4j.graph.BufferChunk bufferChunks(int j) { return bufferChunks(new org.nd4j.graph.BufferChunk(), j); }
|
||||
public org.nd4j.graph.BufferChunk bufferChunks(org.nd4j.graph.BufferChunk obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int bufferChunksLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.BufferChunk.Vector bufferChunksVector() { return bufferChunksVector(new org.nd4j.graph.BufferChunk.Vector()); }
|
||||
public org.nd4j.graph.BufferChunk.Vector bufferChunksVector(org.nd4j.graph.BufferChunk.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public long totalBufferSize() { int o = __offset(14); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public String externalDataFilename(int j) { int o = __offset(16); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int externalDataFilenameLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector externalDataFilenameVector() { return externalDataFilenameVector(new StringVector()); }
|
||||
public StringVector externalDataFilenameVector(StringVector obj) { int o = __offset(16); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public boolean isExternal() { int o = __offset(18); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
|
||||
|
||||
public static int createFlatArray(FlatBufferBuilder builder,
|
||||
int shapeOffset,
|
||||
int bufferOffset,
|
||||
byte dtype,
|
||||
byte byteOrder,
|
||||
int bufferChunksOffset,
|
||||
long totalBufferSize,
|
||||
int externalDataFilenameOffset,
|
||||
boolean isExternal) {
|
||||
builder.startTable(8);
|
||||
FlatArray.addTotalBufferSize(builder, totalBufferSize);
|
||||
FlatArray.addExternalDataFilename(builder, externalDataFilenameOffset);
|
||||
FlatArray.addBufferChunks(builder, bufferChunksOffset);
|
||||
FlatArray.addBuffer(builder, bufferOffset);
|
||||
FlatArray.addShape(builder, shapeOffset);
|
||||
FlatArray.addIsExternal(builder, isExternal);
|
||||
FlatArray.addByteOrder(builder, byteOrder);
|
||||
FlatArray.addDtype(builder, dtype);
|
||||
return FlatArray.endFlatArray(builder);
|
||||
}
|
||||
|
||||
public static void startFlatArray(FlatBufferBuilder builder) { builder.startTable(8); }
|
||||
public static void addShape(FlatBufferBuilder builder, int shapeOffset) { builder.addOffset(0, shapeOffset, 0); }
|
||||
public static int createShapeVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startShapeVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addBuffer(FlatBufferBuilder builder, int bufferOffset) { builder.addOffset(1, bufferOffset, 0); }
|
||||
public static int createBufferVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createBufferVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startBufferVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addDtype(FlatBufferBuilder builder, byte dtype) { builder.addByte(2, dtype, 0); }
|
||||
public static void addByteOrder(FlatBufferBuilder builder, byte byteOrder) { builder.addByte(3, byteOrder, 0); }
|
||||
public static void addBufferChunks(FlatBufferBuilder builder, int bufferChunksOffset) { builder.addOffset(4, bufferChunksOffset, 0); }
|
||||
public static int createBufferChunksVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startBufferChunksVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addTotalBufferSize(FlatBufferBuilder builder, long totalBufferSize) { builder.addLong(5, totalBufferSize, 0L); }
|
||||
public static void addExternalDataFilename(FlatBufferBuilder builder, int externalDataFilenameOffset) { builder.addOffset(6, externalDataFilenameOffset, 0); }
|
||||
public static int createExternalDataFilenameVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startExternalDataFilenameVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addIsExternal(FlatBufferBuilder builder, boolean isExternal) { builder.addBoolean(7, isExternal, false); }
|
||||
public static int endFlatArray(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatArrayBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatArrayBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatArray get(int j) { return get(new FlatArray(), j); }
|
||||
public FlatArray get(FlatArray obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatArrayList extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatArrayList getRootAsFlatArrayList(ByteBuffer _bb) { return getRootAsFlatArrayList(_bb, new FlatArrayList()); }
|
||||
public static FlatArrayList getRootAsFlatArrayList(ByteBuffer _bb, FlatArrayList obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatArrayList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public org.nd4j.graph.FlatArray list(int j) { return list(new org.nd4j.graph.FlatArray(), j); }
|
||||
public org.nd4j.graph.FlatArray list(org.nd4j.graph.FlatArray obj, int j) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int listLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatArray.Vector listVector() { return listVector(new org.nd4j.graph.FlatArray.Vector()); }
|
||||
public org.nd4j.graph.FlatArray.Vector listVector(org.nd4j.graph.FlatArray.Vector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createFlatArrayList(FlatBufferBuilder builder,
|
||||
int listOffset) {
|
||||
builder.startTable(1);
|
||||
FlatArrayList.addList(builder, listOffset);
|
||||
return FlatArrayList.endFlatArrayList(builder);
|
||||
}
|
||||
|
||||
public static void startFlatArrayList(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addList(FlatBufferBuilder builder, int listOffset) { builder.addOffset(0, listOffset, 0); }
|
||||
public static int createListVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startListVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endFlatArrayList(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatArrayList get(int j) { return get(new FlatArrayList(), j); }
|
||||
public FlatArrayList get(FlatArrayList obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatConfiguration extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatConfiguration getRootAsFlatConfiguration(ByteBuffer _bb) { return getRootAsFlatConfiguration(_bb, new FlatConfiguration()); }
|
||||
public static FlatConfiguration getRootAsFlatConfiguration(ByteBuffer _bb, FlatConfiguration obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatConfiguration __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public byte executionMode() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public byte profilingMode() { int o = __offset(8); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public byte outputMode() { int o = __offset(10); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public boolean timestats() { int o = __offset(12); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
|
||||
public long footprintForward() { int o = __offset(14); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public long footprintBackward() { int o = __offset(16); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public byte direction() { int o = __offset(18); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
|
||||
public static int createFlatConfiguration(FlatBufferBuilder builder,
|
||||
long id,
|
||||
byte executionMode,
|
||||
byte profilingMode,
|
||||
byte outputMode,
|
||||
boolean timestats,
|
||||
long footprintForward,
|
||||
long footprintBackward,
|
||||
byte direction) {
|
||||
builder.startTable(8);
|
||||
FlatConfiguration.addFootprintBackward(builder, footprintBackward);
|
||||
FlatConfiguration.addFootprintForward(builder, footprintForward);
|
||||
FlatConfiguration.addId(builder, id);
|
||||
FlatConfiguration.addDirection(builder, direction);
|
||||
FlatConfiguration.addTimestats(builder, timestats);
|
||||
FlatConfiguration.addOutputMode(builder, outputMode);
|
||||
FlatConfiguration.addProfilingMode(builder, profilingMode);
|
||||
FlatConfiguration.addExecutionMode(builder, executionMode);
|
||||
return FlatConfiguration.endFlatConfiguration(builder);
|
||||
}
|
||||
|
||||
public static void startFlatConfiguration(FlatBufferBuilder builder) { builder.startTable(8); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
|
||||
public static void addExecutionMode(FlatBufferBuilder builder, byte executionMode) { builder.addByte(1, executionMode, 0); }
|
||||
public static void addProfilingMode(FlatBufferBuilder builder, byte profilingMode) { builder.addByte(2, profilingMode, 0); }
|
||||
public static void addOutputMode(FlatBufferBuilder builder, byte outputMode) { builder.addByte(3, outputMode, 0); }
|
||||
public static void addTimestats(FlatBufferBuilder builder, boolean timestats) { builder.addBoolean(4, timestats, false); }
|
||||
public static void addFootprintForward(FlatBufferBuilder builder, long footprintForward) { builder.addLong(5, footprintForward, 0L); }
|
||||
public static void addFootprintBackward(FlatBufferBuilder builder, long footprintBackward) { builder.addLong(6, footprintBackward, 0L); }
|
||||
public static void addDirection(FlatBufferBuilder builder, byte direction) { builder.addByte(7, direction, 0); }
|
||||
public static int endFlatConfiguration(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatConfigurationBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatConfigurationBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatConfiguration get(int j) { return get(new FlatConfiguration(), j); }
|
||||
public FlatConfiguration get(FlatConfiguration obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatDropRequest extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatDropRequest getRootAsFlatDropRequest(ByteBuffer _bb) { return getRootAsFlatDropRequest(_bb, new FlatDropRequest()); }
|
||||
public static FlatDropRequest getRootAsFlatDropRequest(ByteBuffer _bb, FlatDropRequest obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatDropRequest __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
|
||||
public static int createFlatDropRequest(FlatBufferBuilder builder,
|
||||
long id) {
|
||||
builder.startTable(1);
|
||||
FlatDropRequest.addId(builder, id);
|
||||
return FlatDropRequest.endFlatDropRequest(builder);
|
||||
}
|
||||
|
||||
public static void startFlatDropRequest(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
|
||||
public static int endFlatDropRequest(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatDropRequest get(int j) { return get(new FlatDropRequest(), j); }
|
||||
public FlatDropRequest get(FlatDropRequest obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatGraph extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatGraph getRootAsFlatGraph(ByteBuffer _bb) { return getRootAsFlatGraph(_bb, new FlatGraph()); }
|
||||
public static FlatGraph getRootAsFlatGraph(ByteBuffer _bb, FlatGraph obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatGraph __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public org.nd4j.graph.FlatVariable variables(int j) { return variables(new org.nd4j.graph.FlatVariable(), j); }
|
||||
public org.nd4j.graph.FlatVariable variables(org.nd4j.graph.FlatVariable obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int variablesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatVariable.Vector variablesVector() { return variablesVector(new org.nd4j.graph.FlatVariable.Vector()); }
|
||||
public org.nd4j.graph.FlatVariable.Vector variablesVector(org.nd4j.graph.FlatVariable.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.FlatNode nodes(int j) { return nodes(new org.nd4j.graph.FlatNode(), j); }
|
||||
public org.nd4j.graph.FlatNode nodes(org.nd4j.graph.FlatNode obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int nodesLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatNode.Vector nodesVector() { return nodesVector(new org.nd4j.graph.FlatNode.Vector()); }
|
||||
public org.nd4j.graph.FlatNode.Vector nodesVector(org.nd4j.graph.FlatNode.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.IntPair outputs(int j) { return outputs(new org.nd4j.graph.IntPair(), j); }
|
||||
public org.nd4j.graph.IntPair outputs(org.nd4j.graph.IntPair obj, int j) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int outputsLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.IntPair.Vector outputsVector() { return outputsVector(new org.nd4j.graph.IntPair.Vector()); }
|
||||
public org.nd4j.graph.IntPair.Vector outputsVector(org.nd4j.graph.IntPair.Vector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.FlatConfiguration configuration() { return configuration(new org.nd4j.graph.FlatConfiguration()); }
|
||||
public org.nd4j.graph.FlatConfiguration configuration(org.nd4j.graph.FlatConfiguration obj) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public String placeholders(int j) { int o = __offset(14); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int placeholdersLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector placeholdersVector() { return placeholdersVector(new StringVector()); }
|
||||
public StringVector placeholdersVector(StringVector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String lossVariables(int j) { int o = __offset(16); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int lossVariablesLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector lossVariablesVector() { return lossVariablesVector(new StringVector()); }
|
||||
public StringVector lossVariablesVector(StringVector obj) { int o = __offset(16); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String trainingConfig() { int o = __offset(18); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer trainingConfigAsByteBuffer() { return __vector_as_bytebuffer(18, 1); }
|
||||
public ByteBuffer trainingConfigInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 18, 1); }
|
||||
public org.nd4j.graph.UpdaterState updaterState(int j) { return updaterState(new org.nd4j.graph.UpdaterState(), j); }
|
||||
public org.nd4j.graph.UpdaterState updaterState(org.nd4j.graph.UpdaterState obj, int j) { int o = __offset(20); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int updaterStateLength() { int o = __offset(20); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.UpdaterState.Vector updaterStateVector() { return updaterStateVector(new org.nd4j.graph.UpdaterState.Vector()); }
|
||||
public org.nd4j.graph.UpdaterState.Vector updaterStateVector(org.nd4j.graph.UpdaterState.Vector obj) { int o = __offset(20); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String metadataKeys(int j) { int o = __offset(22); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int metadataKeysLength() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector metadataKeysVector() { return metadataKeysVector(new StringVector()); }
|
||||
public StringVector metadataKeysVector(StringVector obj) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String metadataValues(int j) { int o = __offset(24); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int metadataValuesLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector metadataValuesVector() { return metadataValuesVector(new StringVector()); }
|
||||
public StringVector metadataValuesVector(StringVector obj) { int o = __offset(24); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.SameDiffSubInstance subInstances(int j) { return subInstances(new org.nd4j.graph.SameDiffSubInstance(), j); }
|
||||
public org.nd4j.graph.SameDiffSubInstance subInstances(org.nd4j.graph.SameDiffSubInstance obj, int j) { int o = __offset(26); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int subInstancesLength() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.SameDiffSubInstance.Vector subInstancesVector() { return subInstancesVector(new org.nd4j.graph.SameDiffSubInstance.Vector()); }
|
||||
public org.nd4j.graph.SameDiffSubInstance.Vector subInstancesVector(org.nd4j.graph.SameDiffSubInstance.Vector obj) { int o = __offset(26); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createFlatGraph(FlatBufferBuilder builder,
|
||||
long id,
|
||||
int variablesOffset,
|
||||
int nodesOffset,
|
||||
int outputsOffset,
|
||||
int configurationOffset,
|
||||
int placeholdersOffset,
|
||||
int lossVariablesOffset,
|
||||
int trainingConfigOffset,
|
||||
int updaterStateOffset,
|
||||
int metadataKeysOffset,
|
||||
int metadataValuesOffset,
|
||||
int subInstancesOffset) {
|
||||
builder.startTable(12);
|
||||
FlatGraph.addId(builder, id);
|
||||
FlatGraph.addSubInstances(builder, subInstancesOffset);
|
||||
FlatGraph.addMetadataValues(builder, metadataValuesOffset);
|
||||
FlatGraph.addMetadataKeys(builder, metadataKeysOffset);
|
||||
FlatGraph.addUpdaterState(builder, updaterStateOffset);
|
||||
FlatGraph.addTrainingConfig(builder, trainingConfigOffset);
|
||||
FlatGraph.addLossVariables(builder, lossVariablesOffset);
|
||||
FlatGraph.addPlaceholders(builder, placeholdersOffset);
|
||||
FlatGraph.addConfiguration(builder, configurationOffset);
|
||||
FlatGraph.addOutputs(builder, outputsOffset);
|
||||
FlatGraph.addNodes(builder, nodesOffset);
|
||||
FlatGraph.addVariables(builder, variablesOffset);
|
||||
return FlatGraph.endFlatGraph(builder);
|
||||
}
|
||||
|
||||
public static void startFlatGraph(FlatBufferBuilder builder) { builder.startTable(12); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
|
||||
public static void addVariables(FlatBufferBuilder builder, int variablesOffset) { builder.addOffset(1, variablesOffset, 0); }
|
||||
public static int createVariablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startVariablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addNodes(FlatBufferBuilder builder, int nodesOffset) { builder.addOffset(2, nodesOffset, 0); }
|
||||
public static int createNodesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startNodesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addOutputs(FlatBufferBuilder builder, int outputsOffset) { builder.addOffset(3, outputsOffset, 0); }
|
||||
public static int createOutputsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startOutputsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addConfiguration(FlatBufferBuilder builder, int configurationOffset) { builder.addOffset(4, configurationOffset, 0); }
|
||||
public static void addPlaceholders(FlatBufferBuilder builder, int placeholdersOffset) { builder.addOffset(5, placeholdersOffset, 0); }
|
||||
public static int createPlaceholdersVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startPlaceholdersVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addLossVariables(FlatBufferBuilder builder, int lossVariablesOffset) { builder.addOffset(6, lossVariablesOffset, 0); }
|
||||
public static int createLossVariablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startLossVariablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addTrainingConfig(FlatBufferBuilder builder, int trainingConfigOffset) { builder.addOffset(7, trainingConfigOffset, 0); }
|
||||
public static void addUpdaterState(FlatBufferBuilder builder, int updaterStateOffset) { builder.addOffset(8, updaterStateOffset, 0); }
|
||||
public static int createUpdaterStateVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startUpdaterStateVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addMetadataKeys(FlatBufferBuilder builder, int metadataKeysOffset) { builder.addOffset(9, metadataKeysOffset, 0); }
|
||||
public static int createMetadataKeysVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startMetadataKeysVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addMetadataValues(FlatBufferBuilder builder, int metadataValuesOffset) { builder.addOffset(10, metadataValuesOffset, 0); }
|
||||
public static int createMetadataValuesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startMetadataValuesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addSubInstances(FlatBufferBuilder builder, int subInstancesOffset) { builder.addOffset(11, subInstancesOffset, 0); }
|
||||
public static int createSubInstancesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startSubInstancesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endFlatGraph(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatGraphBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatGraphBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatGraph get(int j) { return get(new FlatGraph(), j); }
|
||||
public FlatGraph get(FlatGraph obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatInferenceRequest extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatInferenceRequest getRootAsFlatInferenceRequest(ByteBuffer _bb) { return getRootAsFlatInferenceRequest(_bb, new FlatInferenceRequest()); }
|
||||
public static FlatInferenceRequest getRootAsFlatInferenceRequest(ByteBuffer _bb, FlatInferenceRequest obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatInferenceRequest __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public org.nd4j.graph.FlatVariable variables(int j) { return variables(new org.nd4j.graph.FlatVariable(), j); }
|
||||
public org.nd4j.graph.FlatVariable variables(org.nd4j.graph.FlatVariable obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int variablesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatVariable.Vector variablesVector() { return variablesVector(new org.nd4j.graph.FlatVariable.Vector()); }
|
||||
public org.nd4j.graph.FlatVariable.Vector variablesVector(org.nd4j.graph.FlatVariable.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.FlatConfiguration configuration() { return configuration(new org.nd4j.graph.FlatConfiguration()); }
|
||||
public org.nd4j.graph.FlatConfiguration configuration(org.nd4j.graph.FlatConfiguration obj) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
|
||||
public static int createFlatInferenceRequest(FlatBufferBuilder builder,
|
||||
long id,
|
||||
int variablesOffset,
|
||||
int configurationOffset) {
|
||||
builder.startTable(3);
|
||||
FlatInferenceRequest.addId(builder, id);
|
||||
FlatInferenceRequest.addConfiguration(builder, configurationOffset);
|
||||
FlatInferenceRequest.addVariables(builder, variablesOffset);
|
||||
return FlatInferenceRequest.endFlatInferenceRequest(builder);
|
||||
}
|
||||
|
||||
public static void startFlatInferenceRequest(FlatBufferBuilder builder) { builder.startTable(3); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
|
||||
public static void addVariables(FlatBufferBuilder builder, int variablesOffset) { builder.addOffset(1, variablesOffset, 0); }
|
||||
public static int createVariablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startVariablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addConfiguration(FlatBufferBuilder builder, int configurationOffset) { builder.addOffset(2, configurationOffset, 0); }
|
||||
public static int endFlatInferenceRequest(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatInferenceRequestBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatInferenceRequestBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatInferenceRequest get(int j) { return get(new FlatInferenceRequest(), j); }
|
||||
public FlatInferenceRequest get(FlatInferenceRequest obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatNode extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatNode getRootAsFlatNode(ByteBuffer _bb) { return getRootAsFlatNode(_bb, new FlatNode()); }
|
||||
public static FlatNode getRootAsFlatNode(ByteBuffer _bb, FlatNode obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatNode __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int id() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
|
||||
public byte opType() { int o = __offset(8); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public long opNum() { int o = __offset(10); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public org.nd4j.graph.FlatProperties properties(int j) { return properties(new org.nd4j.graph.FlatProperties(), j); }
|
||||
public org.nd4j.graph.FlatProperties properties(org.nd4j.graph.FlatProperties obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int propertiesLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatProperties.Vector propertiesVector() { return propertiesVector(new org.nd4j.graph.FlatProperties.Vector()); }
|
||||
public org.nd4j.graph.FlatProperties.Vector propertiesVector(org.nd4j.graph.FlatProperties.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public int input(int j) { int o = __offset(14); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
|
||||
public int inputLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
|
||||
public IntVector inputVector() { return inputVector(new IntVector()); }
|
||||
public IntVector inputVector(IntVector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer inputAsByteBuffer() { return __vector_as_bytebuffer(14, 4); }
|
||||
public ByteBuffer inputInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 14, 4); }
|
||||
public org.nd4j.graph.IntPair inputPaired(int j) { return inputPaired(new org.nd4j.graph.IntPair(), j); }
|
||||
public org.nd4j.graph.IntPair inputPaired(org.nd4j.graph.IntPair obj, int j) { int o = __offset(16); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int inputPairedLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.IntPair.Vector inputPairedVector() { return inputPairedVector(new org.nd4j.graph.IntPair.Vector()); }
|
||||
public org.nd4j.graph.IntPair.Vector inputPairedVector(org.nd4j.graph.IntPair.Vector obj) { int o = __offset(16); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public int output(int j) { int o = __offset(18); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
|
||||
public int outputLength() { int o = __offset(18); return o != 0 ? __vector_len(o) : 0; }
|
||||
public IntVector outputVector() { return outputVector(new IntVector()); }
|
||||
public IntVector outputVector(IntVector obj) { int o = __offset(18); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer outputAsByteBuffer() { return __vector_as_bytebuffer(18, 4); }
|
||||
public ByteBuffer outputInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 18, 4); }
|
||||
public double extraParams(int j) { int o = __offset(20); return o != 0 ? bb.getDouble(__vector(o) + j * 8) : 0; }
|
||||
public int extraParamsLength() { int o = __offset(20); return o != 0 ? __vector_len(o) : 0; }
|
||||
public DoubleVector extraParamsVector() { return extraParamsVector(new DoubleVector()); }
|
||||
public DoubleVector extraParamsVector(DoubleVector obj) { int o = __offset(20); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer extraParamsAsByteBuffer() { return __vector_as_bytebuffer(20, 8); }
|
||||
public ByteBuffer extraParamsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 20, 8); }
|
||||
public long extraInteger(int j) { int o = __offset(22); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int extraIntegerLength() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector extraIntegerVector() { return extraIntegerVector(new LongVector()); }
|
||||
public LongVector extraIntegerVector(LongVector obj) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer extraIntegerAsByteBuffer() { return __vector_as_bytebuffer(22, 8); }
|
||||
public ByteBuffer extraIntegerInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 22, 8); }
|
||||
public boolean extraBools(int j) { int o = __offset(24); return o != 0 ? 0!=bb.get(__vector(o) + j * 1) : false; }
|
||||
public int extraBoolsLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; }
|
||||
public BooleanVector extraBoolsVector() { return extraBoolsVector(new BooleanVector()); }
|
||||
public BooleanVector extraBoolsVector(BooleanVector obj) { int o = __offset(24); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer extraBoolsAsByteBuffer() { return __vector_as_bytebuffer(24, 1); }
|
||||
public ByteBuffer extraBoolsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 24, 1); }
|
||||
public int dimensions(int j) { int o = __offset(26); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
|
||||
public int dimensionsLength() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; }
|
||||
public IntVector dimensionsVector() { return dimensionsVector(new IntVector()); }
|
||||
public IntVector dimensionsVector(IntVector obj) { int o = __offset(26); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer dimensionsAsByteBuffer() { return __vector_as_bytebuffer(26, 4); }
|
||||
public ByteBuffer dimensionsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 26, 4); }
|
||||
public int device() { int o = __offset(28); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public int scopeId() { int o = __offset(30); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public String scopeName() { int o = __offset(32); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer scopeNameAsByteBuffer() { return __vector_as_bytebuffer(32, 1); }
|
||||
public ByteBuffer scopeNameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 32, 1); }
|
||||
public String outputNames(int j) { int o = __offset(34); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int outputNamesLength() { int o = __offset(34); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector outputNamesVector() { return outputNamesVector(new StringVector()); }
|
||||
public StringVector outputNamesVector(StringVector obj) { int o = __offset(34); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String opName() { int o = __offset(36); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer opNameAsByteBuffer() { return __vector_as_bytebuffer(36, 1); }
|
||||
public ByteBuffer opNameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 36, 1); }
|
||||
public byte outputTypes(int j) { int o = __offset(38); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
|
||||
public int outputTypesLength() { int o = __offset(38); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector outputTypesVector() { return outputTypesVector(new ByteVector()); }
|
||||
public ByteVector outputTypesVector(ByteVector obj) { int o = __offset(38); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer outputTypesAsByteBuffer() { return __vector_as_bytebuffer(38, 1); }
|
||||
public ByteBuffer outputTypesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 38, 1); }
|
||||
public org.nd4j.graph.FlatArray scalar() { return scalar(new org.nd4j.graph.FlatArray()); }
|
||||
public org.nd4j.graph.FlatArray scalar(org.nd4j.graph.FlatArray obj) { int o = __offset(40); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public String controlDeps(int j) { int o = __offset(42); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int controlDepsLength() { int o = __offset(42); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector controlDepsVector() { return controlDepsVector(new StringVector()); }
|
||||
public StringVector controlDepsVector(StringVector obj) { int o = __offset(42); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String varControlDeps(int j) { int o = __offset(44); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int varControlDepsLength() { int o = __offset(44); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector varControlDepsVector() { return varControlDepsVector(new StringVector()); }
|
||||
public StringVector varControlDepsVector(StringVector obj) { int o = __offset(44); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String controlDepFor(int j) { int o = __offset(46); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int controlDepForLength() { int o = __offset(46); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector controlDepForVector() { return controlDepForVector(new StringVector()); }
|
||||
public StringVector controlDepForVector(StringVector obj) { int o = __offset(46); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public byte extraTypes(int j) { int o = __offset(48); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
|
||||
public int extraTypesLength() { int o = __offset(48); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector extraTypesVector() { return extraTypesVector(new ByteVector()); }
|
||||
public ByteVector extraTypesVector(ByteVector obj) { int o = __offset(48); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer extraTypesAsByteBuffer() { return __vector_as_bytebuffer(48, 1); }
|
||||
public ByteBuffer extraTypesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 48, 1); }
|
||||
public String extraStrings(int j) { int o = __offset(50); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int extraStringsLength() { int o = __offset(50); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector extraStringsVector() { return extraStringsVector(new StringVector()); }
|
||||
public StringVector extraStringsVector(StringVector obj) { int o = __offset(50); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createFlatNode(FlatBufferBuilder builder,
|
||||
int id,
|
||||
int nameOffset,
|
||||
byte opType,
|
||||
long opNum,
|
||||
int propertiesOffset,
|
||||
int inputOffset,
|
||||
int inputPairedOffset,
|
||||
int outputOffset,
|
||||
int extraParamsOffset,
|
||||
int extraIntegerOffset,
|
||||
int extraBoolsOffset,
|
||||
int dimensionsOffset,
|
||||
int device,
|
||||
int scopeId,
|
||||
int scopeNameOffset,
|
||||
int outputNamesOffset,
|
||||
int opNameOffset,
|
||||
int outputTypesOffset,
|
||||
int scalarOffset,
|
||||
int controlDepsOffset,
|
||||
int varControlDepsOffset,
|
||||
int controlDepForOffset,
|
||||
int extraTypesOffset,
|
||||
int extraStringsOffset) {
|
||||
builder.startTable(24);
|
||||
FlatNode.addOpNum(builder, opNum);
|
||||
FlatNode.addExtraStrings(builder, extraStringsOffset);
|
||||
FlatNode.addExtraTypes(builder, extraTypesOffset);
|
||||
FlatNode.addControlDepFor(builder, controlDepForOffset);
|
||||
FlatNode.addVarControlDeps(builder, varControlDepsOffset);
|
||||
FlatNode.addControlDeps(builder, controlDepsOffset);
|
||||
FlatNode.addScalar(builder, scalarOffset);
|
||||
FlatNode.addOutputTypes(builder, outputTypesOffset);
|
||||
FlatNode.addOpName(builder, opNameOffset);
|
||||
FlatNode.addOutputNames(builder, outputNamesOffset);
|
||||
FlatNode.addScopeName(builder, scopeNameOffset);
|
||||
FlatNode.addScopeId(builder, scopeId);
|
||||
FlatNode.addDevice(builder, device);
|
||||
FlatNode.addDimensions(builder, dimensionsOffset);
|
||||
FlatNode.addExtraBools(builder, extraBoolsOffset);
|
||||
FlatNode.addExtraInteger(builder, extraIntegerOffset);
|
||||
FlatNode.addExtraParams(builder, extraParamsOffset);
|
||||
FlatNode.addOutput(builder, outputOffset);
|
||||
FlatNode.addInputPaired(builder, inputPairedOffset);
|
||||
FlatNode.addInput(builder, inputOffset);
|
||||
FlatNode.addProperties(builder, propertiesOffset);
|
||||
FlatNode.addName(builder, nameOffset);
|
||||
FlatNode.addId(builder, id);
|
||||
FlatNode.addOpType(builder, opType);
|
||||
return FlatNode.endFlatNode(builder);
|
||||
}
|
||||
|
||||
public static void startFlatNode(FlatBufferBuilder builder) { builder.startTable(24); }
|
||||
public static void addId(FlatBufferBuilder builder, int id) { builder.addInt(0, id, 0); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(1, nameOffset, 0); }
|
||||
public static void addOpType(FlatBufferBuilder builder, byte opType) { builder.addByte(2, opType, 0); }
|
||||
public static void addOpNum(FlatBufferBuilder builder, long opNum) { builder.addLong(3, opNum, 0L); }
|
||||
public static void addProperties(FlatBufferBuilder builder, int propertiesOffset) { builder.addOffset(4, propertiesOffset, 0); }
|
||||
public static int createPropertiesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startPropertiesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addInput(FlatBufferBuilder builder, int inputOffset) { builder.addOffset(5, inputOffset, 0); }
|
||||
public static int createInputVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
|
||||
public static void startInputVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addInputPaired(FlatBufferBuilder builder, int inputPairedOffset) { builder.addOffset(6, inputPairedOffset, 0); }
|
||||
public static int createInputPairedVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startInputPairedVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addOutput(FlatBufferBuilder builder, int outputOffset) { builder.addOffset(7, outputOffset, 0); }
|
||||
public static int createOutputVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
|
||||
public static void startOutputVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addExtraParams(FlatBufferBuilder builder, int extraParamsOffset) { builder.addOffset(8, extraParamsOffset, 0); }
|
||||
public static int createExtraParamsVector(FlatBufferBuilder builder, double[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addDouble(data[i]); return builder.endVector(); }
|
||||
public static void startExtraParamsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addExtraInteger(FlatBufferBuilder builder, int extraIntegerOffset) { builder.addOffset(9, extraIntegerOffset, 0); }
|
||||
public static int createExtraIntegerVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startExtraIntegerVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addExtraBools(FlatBufferBuilder builder, int extraBoolsOffset) { builder.addOffset(10, extraBoolsOffset, 0); }
|
||||
public static int createExtraBoolsVector(FlatBufferBuilder builder, boolean[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addBoolean(data[i]); return builder.endVector(); }
|
||||
public static void startExtraBoolsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addDimensions(FlatBufferBuilder builder, int dimensionsOffset) { builder.addOffset(11, dimensionsOffset, 0); }
|
||||
public static int createDimensionsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
|
||||
public static void startDimensionsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addDevice(FlatBufferBuilder builder, int device) { builder.addInt(12, device, 0); }
|
||||
public static void addScopeId(FlatBufferBuilder builder, int scopeId) { builder.addInt(13, scopeId, 0); }
|
||||
public static void addScopeName(FlatBufferBuilder builder, int scopeNameOffset) { builder.addOffset(14, scopeNameOffset, 0); }
|
||||
public static void addOutputNames(FlatBufferBuilder builder, int outputNamesOffset) { builder.addOffset(15, outputNamesOffset, 0); }
|
||||
public static int createOutputNamesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startOutputNamesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addOpName(FlatBufferBuilder builder, int opNameOffset) { builder.addOffset(16, opNameOffset, 0); }
|
||||
public static void addOutputTypes(FlatBufferBuilder builder, int outputTypesOffset) { builder.addOffset(17, outputTypesOffset, 0); }
|
||||
public static int createOutputTypesVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createOutputTypesVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startOutputTypesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addScalar(FlatBufferBuilder builder, int scalarOffset) { builder.addOffset(18, scalarOffset, 0); }
|
||||
public static void addControlDeps(FlatBufferBuilder builder, int controlDepsOffset) { builder.addOffset(19, controlDepsOffset, 0); }
|
||||
public static int createControlDepsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startControlDepsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addVarControlDeps(FlatBufferBuilder builder, int varControlDepsOffset) { builder.addOffset(20, varControlDepsOffset, 0); }
|
||||
public static int createVarControlDepsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startVarControlDepsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addControlDepFor(FlatBufferBuilder builder, int controlDepForOffset) { builder.addOffset(21, controlDepForOffset, 0); }
|
||||
public static int createControlDepForVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startControlDepForVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addExtraTypes(FlatBufferBuilder builder, int extraTypesOffset) { builder.addOffset(22, extraTypesOffset, 0); }
|
||||
public static int createExtraTypesVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createExtraTypesVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startExtraTypesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addExtraStrings(FlatBufferBuilder builder, int extraStringsOffset) { builder.addOffset(23, extraStringsOffset, 0); }
|
||||
public static int createExtraStringsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startExtraStringsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endFlatNode(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatNodeBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatNodeBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatNode get(int j) { return get(new FlatNode(), j); }
|
||||
public FlatNode get(FlatNode obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatProperties extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatProperties getRootAsFlatProperties(ByteBuffer _bb) { return getRootAsFlatProperties(_bb, new FlatProperties()); }
|
||||
public static FlatProperties getRootAsFlatProperties(ByteBuffer _bb, FlatProperties obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatProperties __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
|
||||
public int i(int j) { int o = __offset(6); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
|
||||
public int iLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public IntVector iVector() { return iVector(new IntVector()); }
|
||||
public IntVector iVector(IntVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer iAsByteBuffer() { return __vector_as_bytebuffer(6, 4); }
|
||||
public ByteBuffer iInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 4); }
|
||||
public long l(int j) { int o = __offset(8); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int lLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector lVector() { return lVector(new LongVector()); }
|
||||
public LongVector lVector(LongVector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer lAsByteBuffer() { return __vector_as_bytebuffer(8, 8); }
|
||||
public ByteBuffer lInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 8, 8); }
|
||||
public double d(int j) { int o = __offset(10); return o != 0 ? bb.getDouble(__vector(o) + j * 8) : 0; }
|
||||
public int dLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; }
|
||||
public DoubleVector dVector() { return dVector(new DoubleVector()); }
|
||||
public DoubleVector dVector(DoubleVector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer dAsByteBuffer() { return __vector_as_bytebuffer(10, 8); }
|
||||
public ByteBuffer dInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 10, 8); }
|
||||
public org.nd4j.graph.FlatArray a(int j) { return a(new org.nd4j.graph.FlatArray(), j); }
|
||||
public org.nd4j.graph.FlatArray a(org.nd4j.graph.FlatArray obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int aLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatArray.Vector aVector() { return aVector(new org.nd4j.graph.FlatArray.Vector()); }
|
||||
public org.nd4j.graph.FlatArray.Vector aVector(org.nd4j.graph.FlatArray.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public boolean b(int j) { int o = __offset(14); return o != 0 ? 0!=bb.get(__vector(o) + j * 1) : false; }
|
||||
public int bLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
|
||||
public BooleanVector bVector() { return bVector(new BooleanVector()); }
|
||||
public BooleanVector bVector(BooleanVector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer bAsByteBuffer() { return __vector_as_bytebuffer(14, 1); }
|
||||
public ByteBuffer bInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 14, 1); }
|
||||
public String s(int j) { int o = __offset(16); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int sLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector sVector() { return sVector(new StringVector()); }
|
||||
public StringVector sVector(StringVector obj) { int o = __offset(16); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public int shape(int j) { int o = __offset(18); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; }
|
||||
public int shapeLength() { int o = __offset(18); return o != 0 ? __vector_len(o) : 0; }
|
||||
public IntVector shapeVector() { return shapeVector(new IntVector()); }
|
||||
public IntVector shapeVector(IntVector obj) { int o = __offset(18); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer shapeAsByteBuffer() { return __vector_as_bytebuffer(18, 4); }
|
||||
public ByteBuffer shapeInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 18, 4); }
|
||||
|
||||
public static int createFlatProperties(FlatBufferBuilder builder,
|
||||
int nameOffset,
|
||||
int iOffset,
|
||||
int lOffset,
|
||||
int dOffset,
|
||||
int aOffset,
|
||||
int bOffset,
|
||||
int sOffset,
|
||||
int shapeOffset) {
|
||||
builder.startTable(8);
|
||||
FlatProperties.addShape(builder, shapeOffset);
|
||||
FlatProperties.addS(builder, sOffset);
|
||||
FlatProperties.addB(builder, bOffset);
|
||||
FlatProperties.addA(builder, aOffset);
|
||||
FlatProperties.addD(builder, dOffset);
|
||||
FlatProperties.addL(builder, lOffset);
|
||||
FlatProperties.addI(builder, iOffset);
|
||||
FlatProperties.addName(builder, nameOffset);
|
||||
return FlatProperties.endFlatProperties(builder);
|
||||
}
|
||||
|
||||
public static void startFlatProperties(FlatBufferBuilder builder) { builder.startTable(8); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); }
|
||||
public static void addI(FlatBufferBuilder builder, int iOffset) { builder.addOffset(1, iOffset, 0); }
|
||||
public static int createIVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
|
||||
public static void startIVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addL(FlatBufferBuilder builder, int lOffset) { builder.addOffset(2, lOffset, 0); }
|
||||
public static int createLVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startLVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addD(FlatBufferBuilder builder, int dOffset) { builder.addOffset(3, dOffset, 0); }
|
||||
public static int createDVector(FlatBufferBuilder builder, double[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addDouble(data[i]); return builder.endVector(); }
|
||||
public static void startDVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addA(FlatBufferBuilder builder, int aOffset) { builder.addOffset(4, aOffset, 0); }
|
||||
public static int createAVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startAVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addB(FlatBufferBuilder builder, int bOffset) { builder.addOffset(5, bOffset, 0); }
|
||||
public static int createBVector(FlatBufferBuilder builder, boolean[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addBoolean(data[i]); return builder.endVector(); }
|
||||
public static void startBVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addS(FlatBufferBuilder builder, int sOffset) { builder.addOffset(6, sOffset, 0); }
|
||||
public static int createSVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startSVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addShape(FlatBufferBuilder builder, int shapeOffset) { builder.addOffset(7, shapeOffset, 0); }
|
||||
public static int createShapeVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); }
|
||||
public static void startShapeVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endFlatProperties(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatPropertiesBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatPropertiesBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatProperties get(int j) { return get(new FlatProperties(), j); }
|
||||
public FlatProperties get(FlatProperties obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatResponse extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatResponse getRootAsFlatResponse(ByteBuffer _bb) { return getRootAsFlatResponse(_bb, new FlatResponse()); }
|
||||
public static FlatResponse getRootAsFlatResponse(ByteBuffer _bb, FlatResponse obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatResponse __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int status() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
|
||||
public static int createFlatResponse(FlatBufferBuilder builder,
|
||||
int status) {
|
||||
builder.startTable(1);
|
||||
FlatResponse.addStatus(builder, status);
|
||||
return FlatResponse.endFlatResponse(builder);
|
||||
}
|
||||
|
||||
public static void startFlatResponse(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addStatus(FlatBufferBuilder builder, int status) { builder.addInt(0, status, 0); }
|
||||
public static int endFlatResponse(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatResponse get(int j) { return get(new FlatResponse(), j); }
|
||||
public FlatResponse get(FlatResponse obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatResult extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatResult getRootAsFlatResult(ByteBuffer _bb) { return getRootAsFlatResult(_bb, new FlatResult()); }
|
||||
public static FlatResult getRootAsFlatResult(ByteBuffer _bb, FlatResult obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatResult __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public org.nd4j.graph.FlatVariable variables(int j) { return variables(new org.nd4j.graph.FlatVariable(), j); }
|
||||
public org.nd4j.graph.FlatVariable variables(org.nd4j.graph.FlatVariable obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int variablesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatVariable.Vector variablesVector() { return variablesVector(new org.nd4j.graph.FlatVariable.Vector()); }
|
||||
public org.nd4j.graph.FlatVariable.Vector variablesVector(org.nd4j.graph.FlatVariable.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.FlatTiming timing(int j) { return timing(new org.nd4j.graph.FlatTiming(), j); }
|
||||
public org.nd4j.graph.FlatTiming timing(org.nd4j.graph.FlatTiming obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int timingLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatTiming.Vector timingVector() { return timingVector(new org.nd4j.graph.FlatTiming.Vector()); }
|
||||
public org.nd4j.graph.FlatTiming.Vector timingVector(org.nd4j.graph.FlatTiming.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public long footprintForward() { int o = __offset(10); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public long footprintBackward() { int o = __offset(12); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
|
||||
public static int createFlatResult(FlatBufferBuilder builder,
|
||||
long id,
|
||||
int variablesOffset,
|
||||
int timingOffset,
|
||||
long footprintForward,
|
||||
long footprintBackward) {
|
||||
builder.startTable(5);
|
||||
FlatResult.addFootprintBackward(builder, footprintBackward);
|
||||
FlatResult.addFootprintForward(builder, footprintForward);
|
||||
FlatResult.addId(builder, id);
|
||||
FlatResult.addTiming(builder, timingOffset);
|
||||
FlatResult.addVariables(builder, variablesOffset);
|
||||
return FlatResult.endFlatResult(builder);
|
||||
}
|
||||
|
||||
public static void startFlatResult(FlatBufferBuilder builder) { builder.startTable(5); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
|
||||
public static void addVariables(FlatBufferBuilder builder, int variablesOffset) { builder.addOffset(1, variablesOffset, 0); }
|
||||
public static int createVariablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startVariablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addTiming(FlatBufferBuilder builder, int timingOffset) { builder.addOffset(2, timingOffset, 0); }
|
||||
public static int createTimingVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startTimingVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addFootprintForward(FlatBufferBuilder builder, long footprintForward) { builder.addLong(3, footprintForward, 0L); }
|
||||
public static void addFootprintBackward(FlatBufferBuilder builder, long footprintBackward) { builder.addLong(4, footprintBackward, 0L); }
|
||||
public static int endFlatResult(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatResultBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatResultBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatResult get(int j) { return get(new FlatResult(), j); }
|
||||
public FlatResult get(FlatResult obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatTiming extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatTiming getRootAsFlatTiming(ByteBuffer _bb) { return getRootAsFlatTiming(_bb, new FlatTiming()); }
|
||||
public static FlatTiming getRootAsFlatTiming(ByteBuffer _bb, FlatTiming obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatTiming __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int id() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
|
||||
public org.nd4j.graph.LongPair timing() { return timing(new org.nd4j.graph.LongPair()); }
|
||||
public org.nd4j.graph.LongPair timing(org.nd4j.graph.LongPair obj) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
|
||||
public static int createFlatTiming(FlatBufferBuilder builder,
|
||||
int id,
|
||||
int nameOffset,
|
||||
int timingOffset) {
|
||||
builder.startTable(3);
|
||||
FlatTiming.addTiming(builder, timingOffset);
|
||||
FlatTiming.addName(builder, nameOffset);
|
||||
FlatTiming.addId(builder, id);
|
||||
return FlatTiming.endFlatTiming(builder);
|
||||
}
|
||||
|
||||
public static void startFlatTiming(FlatBufferBuilder builder) { builder.startTable(3); }
|
||||
public static void addId(FlatBufferBuilder builder, int id) { builder.addInt(0, id, 0); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(1, nameOffset, 0); }
|
||||
public static void addTiming(FlatBufferBuilder builder, int timingOffset) { builder.addOffset(2, timingOffset, 0); }
|
||||
public static int endFlatTiming(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatTiming get(int j) { return get(new FlatTiming(), j); }
|
||||
public FlatTiming get(FlatTiming obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FlatVariable extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FlatVariable getRootAsFlatVariable(ByteBuffer _bb) { return getRootAsFlatVariable(_bb, new FlatVariable()); }
|
||||
public static FlatVariable getRootAsFlatVariable(ByteBuffer _bb, FlatVariable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FlatVariable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public org.nd4j.graph.IntPair id() { return id(new org.nd4j.graph.IntPair()); }
|
||||
public org.nd4j.graph.IntPair id(org.nd4j.graph.IntPair obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
|
||||
public byte dtype() { int o = __offset(8); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public long shape(int j) { int o = __offset(10); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int shapeLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector shapeVector() { return shapeVector(new LongVector()); }
|
||||
public LongVector shapeVector(LongVector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer shapeAsByteBuffer() { return __vector_as_bytebuffer(10, 8); }
|
||||
public ByteBuffer shapeInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 10, 8); }
|
||||
public org.nd4j.graph.FlatArray ndarray() { return ndarray(new org.nd4j.graph.FlatArray()); }
|
||||
public org.nd4j.graph.FlatArray ndarray(org.nd4j.graph.FlatArray obj) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public int device() { int o = __offset(14); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public byte variabletype() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public String controlDeps(int j) { int o = __offset(18); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int controlDepsLength() { int o = __offset(18); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector controlDepsVector() { return controlDepsVector(new StringVector()); }
|
||||
public StringVector controlDepsVector(StringVector obj) { int o = __offset(18); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String controlDepForOp(int j) { int o = __offset(20); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int controlDepForOpLength() { int o = __offset(20); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector controlDepForOpVector() { return controlDepForOpVector(new StringVector()); }
|
||||
public StringVector controlDepForOpVector(StringVector obj) { int o = __offset(20); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String controlDepsForVar(int j) { int o = __offset(22); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int controlDepsForVarLength() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector controlDepsForVarVector() { return controlDepsForVarVector(new StringVector()); }
|
||||
public StringVector controlDepsForVarVector(StringVector obj) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createFlatVariable(FlatBufferBuilder builder,
|
||||
int idOffset,
|
||||
int nameOffset,
|
||||
byte dtype,
|
||||
int shapeOffset,
|
||||
int ndarrayOffset,
|
||||
int device,
|
||||
byte variabletype,
|
||||
int controlDepsOffset,
|
||||
int controlDepForOpOffset,
|
||||
int controlDepsForVarOffset) {
|
||||
builder.startTable(10);
|
||||
FlatVariable.addControlDepsForVar(builder, controlDepsForVarOffset);
|
||||
FlatVariable.addControlDepForOp(builder, controlDepForOpOffset);
|
||||
FlatVariable.addControlDeps(builder, controlDepsOffset);
|
||||
FlatVariable.addDevice(builder, device);
|
||||
FlatVariable.addNdarray(builder, ndarrayOffset);
|
||||
FlatVariable.addShape(builder, shapeOffset);
|
||||
FlatVariable.addName(builder, nameOffset);
|
||||
FlatVariable.addId(builder, idOffset);
|
||||
FlatVariable.addVariabletype(builder, variabletype);
|
||||
FlatVariable.addDtype(builder, dtype);
|
||||
return FlatVariable.endFlatVariable(builder);
|
||||
}
|
||||
|
||||
public static void startFlatVariable(FlatBufferBuilder builder) { builder.startTable(10); }
|
||||
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(1, nameOffset, 0); }
|
||||
public static void addDtype(FlatBufferBuilder builder, byte dtype) { builder.addByte(2, dtype, 0); }
|
||||
public static void addShape(FlatBufferBuilder builder, int shapeOffset) { builder.addOffset(3, shapeOffset, 0); }
|
||||
public static int createShapeVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startShapeVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addNdarray(FlatBufferBuilder builder, int ndarrayOffset) { builder.addOffset(4, ndarrayOffset, 0); }
|
||||
public static void addDevice(FlatBufferBuilder builder, int device) { builder.addInt(5, device, 0); }
|
||||
public static void addVariabletype(FlatBufferBuilder builder, byte variabletype) { builder.addByte(6, variabletype, 0); }
|
||||
public static void addControlDeps(FlatBufferBuilder builder, int controlDepsOffset) { builder.addOffset(7, controlDepsOffset, 0); }
|
||||
public static int createControlDepsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startControlDepsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addControlDepForOp(FlatBufferBuilder builder, int controlDepForOpOffset) { builder.addOffset(8, controlDepForOpOffset, 0); }
|
||||
public static int createControlDepForOpVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startControlDepForOpVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addControlDepsForVar(FlatBufferBuilder builder, int controlDepsForVarOffset) { builder.addOffset(9, controlDepsForVarOffset, 0); }
|
||||
public static int createControlDepsForVarVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startControlDepsForVarVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endFlatVariable(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishFlatVariableBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedFlatVariableBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FlatVariable get(int j) { return get(new FlatVariable(), j); }
|
||||
public FlatVariable get(FlatVariable obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class FrameIteration extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static FrameIteration getRootAsFrameIteration(ByteBuffer _bb) { return getRootAsFrameIteration(_bb, new FrameIteration()); }
|
||||
public static FrameIteration getRootAsFrameIteration(ByteBuffer _bb, FrameIteration obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public FrameIteration __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public String frame() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer frameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
|
||||
public ByteBuffer frameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
|
||||
public int iteration() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
|
||||
|
||||
public static int createFrameIteration(FlatBufferBuilder builder,
|
||||
int frameOffset,
|
||||
int iteration) {
|
||||
builder.startTable(2);
|
||||
FrameIteration.addFrame(builder, frameOffset);
|
||||
FrameIteration.addIteration(builder, iteration);
|
||||
return FrameIteration.endFrameIteration(builder);
|
||||
}
|
||||
|
||||
public static void startFrameIteration(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addFrame(FlatBufferBuilder builder, int frameOffset) { builder.addOffset(0, frameOffset, 0); }
|
||||
public static void addIteration(FlatBufferBuilder builder, int iteration) { builder.addShort(1, (short) iteration, (short) 0); }
|
||||
public static int endFrameIteration(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public FrameIteration get(int j) { return get(new FrameIteration(), j); }
|
||||
public FrameIteration get(FrameIteration obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class InputType {
|
||||
private InputType() { }
|
||||
public static final byte UNDEFINED = 0;
|
||||
public static final byte NUMERIC = 1;
|
||||
public static final byte STRINGULAR = 2;
|
||||
public static final byte NUMERIC_SET = 3;
|
||||
public static final byte STRINGULAR_SET = 4;
|
||||
|
||||
public static final String[] names = { "UNDEFINED", "NUMERIC", "STRINGULAR", "NUMERIC_SET", "STRINGULAR_SET", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class IntPair extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static IntPair getRootAsIntPair(ByteBuffer _bb) { return getRootAsIntPair(_bb, new IntPair()); }
|
||||
public static IntPair getRootAsIntPair(ByteBuffer _bb, IntPair obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public IntPair __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int first() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public int second() { int o = __offset(6); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
|
||||
public static int createIntPair(FlatBufferBuilder builder,
|
||||
int first,
|
||||
int second) {
|
||||
builder.startTable(2);
|
||||
IntPair.addSecond(builder, second);
|
||||
IntPair.addFirst(builder, first);
|
||||
return IntPair.endIntPair(builder);
|
||||
}
|
||||
|
||||
public static void startIntPair(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addFirst(FlatBufferBuilder builder, int first) { builder.addInt(0, first, 0); }
|
||||
public static void addSecond(FlatBufferBuilder builder, int second) { builder.addInt(1, second, 0); }
|
||||
public static int endIntPair(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public IntPair get(int j) { return get(new IntPair(), j); }
|
||||
public IntPair get(IntPair obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class IntTriple extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static IntTriple getRootAsIntTriple(ByteBuffer _bb) { return getRootAsIntTriple(_bb, new IntTriple()); }
|
||||
public static IntTriple getRootAsIntTriple(ByteBuffer _bb, IntTriple obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public IntTriple __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int first() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public int second() { int o = __offset(6); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public int third() { int o = __offset(8); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
|
||||
public static int createIntTriple(FlatBufferBuilder builder,
|
||||
int first,
|
||||
int second,
|
||||
int third) {
|
||||
builder.startTable(3);
|
||||
IntTriple.addThird(builder, third);
|
||||
IntTriple.addSecond(builder, second);
|
||||
IntTriple.addFirst(builder, first);
|
||||
return IntTriple.endIntTriple(builder);
|
||||
}
|
||||
|
||||
public static void startIntTriple(FlatBufferBuilder builder) { builder.startTable(3); }
|
||||
public static void addFirst(FlatBufferBuilder builder, int first) { builder.addInt(0, first, 0); }
|
||||
public static void addSecond(FlatBufferBuilder builder, int second) { builder.addInt(1, second, 0); }
|
||||
public static void addThird(FlatBufferBuilder builder, int third) { builder.addInt(2, third, 0); }
|
||||
public static int endIntTriple(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public IntTriple get(int j) { return get(new IntTriple(), j); }
|
||||
public IntTriple get(IntTriple obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class LongPair extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static LongPair getRootAsLongPair(ByteBuffer _bb) { return getRootAsLongPair(_bb, new LongPair()); }
|
||||
public static LongPair getRootAsLongPair(ByteBuffer _bb, LongPair obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public LongPair __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long first() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public long second() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
|
||||
public static int createLongPair(FlatBufferBuilder builder,
|
||||
long first,
|
||||
long second) {
|
||||
builder.startTable(2);
|
||||
LongPair.addSecond(builder, second);
|
||||
LongPair.addFirst(builder, first);
|
||||
return LongPair.endLongPair(builder);
|
||||
}
|
||||
|
||||
public static void startLongPair(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addFirst(FlatBufferBuilder builder, long first) { builder.addLong(0, first, 0L); }
|
||||
public static void addSecond(FlatBufferBuilder builder, long second) { builder.addLong(1, second, 0L); }
|
||||
public static int endLongPair(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public LongPair get(int j) { return get(new LongPair(), j); }
|
||||
public LongPair get(LongPair obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class LongTriple extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static LongTriple getRootAsLongTriple(ByteBuffer _bb) { return getRootAsLongTriple(_bb, new LongTriple()); }
|
||||
public static LongTriple getRootAsLongTriple(ByteBuffer _bb, LongTriple obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public LongTriple __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long first() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public long second() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public long third() { int o = __offset(8); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
|
||||
public static int createLongTriple(FlatBufferBuilder builder,
|
||||
long first,
|
||||
long second,
|
||||
long third) {
|
||||
builder.startTable(3);
|
||||
LongTriple.addThird(builder, third);
|
||||
LongTriple.addSecond(builder, second);
|
||||
LongTriple.addFirst(builder, first);
|
||||
return LongTriple.endLongTriple(builder);
|
||||
}
|
||||
|
||||
public static void startLongTriple(FlatBufferBuilder builder) { builder.startTable(3); }
|
||||
public static void addFirst(FlatBufferBuilder builder, long first) { builder.addLong(0, first, 0L); }
|
||||
public static void addSecond(FlatBufferBuilder builder, long second) { builder.addLong(1, second, 0L); }
|
||||
public static void addThird(FlatBufferBuilder builder, long third) { builder.addLong(2, third, 0L); }
|
||||
public static int endLongTriple(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public LongTriple get(int j) { return get(new LongTriple(), j); }
|
||||
public LongTriple get(LongTriple obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class LossReduce {
|
||||
private LossReduce() { }
|
||||
public static final byte NONE = 0;
|
||||
public static final byte SUM = 1;
|
||||
public static final byte MEAN_BY_WEIGHT = 2;
|
||||
public static final byte MEAN_BY_NONZERO_WEIGHT_COUNT = 3;
|
||||
|
||||
public static final String[] names = { "NONE", "SUM", "MEAN_BY_WEIGHT", "MEAN_BY_NONZERO_WEIGHT_COUNT", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class OpClass {
|
||||
private OpClass() { }
|
||||
public static final byte TRANSFORM = 0;
|
||||
public static final byte REDUCTION = 1;
|
||||
public static final byte MULTIPLICATOR = 2;
|
||||
public static final byte GRAPH = 3;
|
||||
public static final byte CONDITIONAL = 4;
|
||||
public static final byte LOOP = 5;
|
||||
|
||||
public static final String[] names = { "TRANSFORM", "REDUCTION", "MULTIPLICATOR", "GRAPH", "CONDITIONAL", "LOOP", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class OpType {
|
||||
private OpType() { }
|
||||
public static final byte TRANSFORM_FLOAT = 0;
|
||||
public static final byte TRANSFORM_SAME = 1;
|
||||
public static final byte TRANSFORM_BOOL = 2;
|
||||
public static final byte TRANSFORM_STRICT = 3;
|
||||
public static final byte TRANSFORM_ANY = 4;
|
||||
public static final byte REDUCE_FLOAT = 5;
|
||||
public static final byte REDUCE_SAME = 6;
|
||||
public static final byte REDUCE_LONG = 7;
|
||||
public static final byte REDUCE_BOOL = 8;
|
||||
public static final byte INDEX_REDUCE = 9;
|
||||
public static final byte SCALAR = 10;
|
||||
public static final byte SCALAR_BOOL = 11;
|
||||
public static final byte BROADCAST = 12;
|
||||
public static final byte BROADCAST_BOOL = 13;
|
||||
public static final byte PAIRWISE = 14;
|
||||
public static final byte PAIRWISE_BOOL = 15;
|
||||
public static final byte REDUCE_3 = 16;
|
||||
public static final byte SUMMARYSTATS = 17;
|
||||
public static final byte SHAPE = 18;
|
||||
public static final byte AGGREGATION = 19;
|
||||
public static final byte RANDOM = 20;
|
||||
public static final byte CUSTOM = 21;
|
||||
public static final byte GRAPH = 22;
|
||||
public static final byte VARIABLE = 40;
|
||||
public static final byte BOOLEAN = 60;
|
||||
public static final byte LOGIC = 119;
|
||||
public static final byte UDF = 120;
|
||||
|
||||
public static final String[] names = { "TRANSFORM_FLOAT", "TRANSFORM_SAME", "TRANSFORM_BOOL", "TRANSFORM_STRICT", "TRANSFORM_ANY", "REDUCE_FLOAT", "REDUCE_SAME", "REDUCE_LONG", "REDUCE_BOOL", "INDEX_REDUCE", "SCALAR", "SCALAR_BOOL", "BROADCAST", "BROADCAST_BOOL", "PAIRWISE", "PAIRWISE_BOOL", "REDUCE_3", "SUMMARYSTATS", "SHAPE", "AGGREGATION", "RANDOM", "CUSTOM", "GRAPH", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "VARIABLE", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "BOOLEAN", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "LOGIC", "UDF", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class OutputMode {
|
||||
private OutputMode() { }
|
||||
public static final byte IMPLICIT = 0;
|
||||
public static final byte EXPLICIT = 1;
|
||||
public static final byte EXPLICIT_AND_IMPLICIT = 2;
|
||||
public static final byte VARIABLE_SPACE = 3;
|
||||
public static final byte OPTIMIZED = 4;
|
||||
|
||||
public static final String[] names = { "IMPLICIT", "EXPLICIT", "EXPLICIT_AND_IMPLICIT", "VARIABLE_SPACE", "OPTIMIZED", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class ProfilingMode {
|
||||
private ProfilingMode() { }
|
||||
public static final byte NONE = 0;
|
||||
public static final byte NAN_PANIC = 1;
|
||||
public static final byte INF_PANIC = 2;
|
||||
public static final byte ANY_PANIC = 3;
|
||||
|
||||
public static final String[] names = { "NONE", "NAN_PANIC", "INF_PANIC", "ANY_PANIC", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class SameDiffSubInstance extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static SameDiffSubInstance getRootAsSameDiffSubInstance(ByteBuffer _bb) { return getRootAsSameDiffSubInstance(_bb, new SameDiffSubInstance()); }
|
||||
public static SameDiffSubInstance getRootAsSameDiffSubInstance(ByteBuffer _bb, SameDiffSubInstance obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public SameDiffSubInstance __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
|
||||
public int serializedData(int j) { int o = __offset(6); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
|
||||
public int serializedDataLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector serializedDataVector() { return serializedDataVector(new ByteVector()); }
|
||||
public ByteVector serializedDataVector(ByteVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer serializedDataAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
|
||||
public ByteBuffer serializedDataInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
|
||||
|
||||
public static int createSameDiffSubInstance(FlatBufferBuilder builder,
|
||||
int nameOffset,
|
||||
int serializedDataOffset) {
|
||||
builder.startTable(2);
|
||||
SameDiffSubInstance.addSerializedData(builder, serializedDataOffset);
|
||||
SameDiffSubInstance.addName(builder, nameOffset);
|
||||
return SameDiffSubInstance.endSameDiffSubInstance(builder);
|
||||
}
|
||||
|
||||
public static void startSameDiffSubInstance(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); }
|
||||
public static void addSerializedData(FlatBufferBuilder builder, int serializedDataOffset) { builder.addOffset(1, serializedDataOffset, 0); }
|
||||
public static int createSerializedDataVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createSerializedDataVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startSerializedDataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static int endSameDiffSubInstance(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public SameDiffSubInstance get(int j) { return get(new SameDiffSubInstance(), j); }
|
||||
public SameDiffSubInstance get(SameDiffSubInstance obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class SequenceItem extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static SequenceItem getRootAsSequenceItem(ByteBuffer _bb) { return getRootAsSequenceItem(_bb, new SequenceItem()); }
|
||||
public static SequenceItem getRootAsSequenceItem(ByteBuffer _bb, SequenceItem obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public SequenceItem __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); }
|
||||
public org.nd4j.graph.FlatArray associatedVariable(int j) { return associatedVariable(new org.nd4j.graph.FlatArray(), j); }
|
||||
public org.nd4j.graph.FlatArray associatedVariable(org.nd4j.graph.FlatArray obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int associatedVariableLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.FlatArray.Vector associatedVariableVector() { return associatedVariableVector(new org.nd4j.graph.FlatArray.Vector()); }
|
||||
public org.nd4j.graph.FlatArray.Vector associatedVariableVector(org.nd4j.graph.FlatArray.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createSequenceItem(FlatBufferBuilder builder,
|
||||
int nameOffset,
|
||||
int associatedVariableOffset) {
|
||||
builder.startTable(2);
|
||||
SequenceItem.addAssociatedVariable(builder, associatedVariableOffset);
|
||||
SequenceItem.addName(builder, nameOffset);
|
||||
return SequenceItem.endSequenceItem(builder);
|
||||
}
|
||||
|
||||
public static void startSequenceItem(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); }
|
||||
public static void addAssociatedVariable(FlatBufferBuilder builder, int associatedVariableOffset) { builder.addOffset(1, associatedVariableOffset, 0); }
|
||||
public static int createAssociatedVariableVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startAssociatedVariableVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endSequenceItem(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public SequenceItem get(int j) { return get(new SequenceItem(), j); }
|
||||
public SequenceItem get(SequenceItem obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class SequenceItemRoot extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static SequenceItemRoot getRootAsSequenceItemRoot(ByteBuffer _bb) { return getRootAsSequenceItemRoot(_bb, new SequenceItemRoot()); }
|
||||
public static SequenceItemRoot getRootAsSequenceItemRoot(ByteBuffer _bb, SequenceItemRoot obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public SequenceItemRoot __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public org.nd4j.graph.SequenceItem sequenceItems(int j) { return sequenceItems(new org.nd4j.graph.SequenceItem(), j); }
|
||||
public org.nd4j.graph.SequenceItem sequenceItems(org.nd4j.graph.SequenceItem obj, int j) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int sequenceItemsLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.SequenceItem.Vector sequenceItemsVector() { return sequenceItemsVector(new org.nd4j.graph.SequenceItem.Vector()); }
|
||||
public org.nd4j.graph.SequenceItem.Vector sequenceItemsVector(org.nd4j.graph.SequenceItem.Vector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createSequenceItemRoot(FlatBufferBuilder builder,
|
||||
int sequenceItemsOffset) {
|
||||
builder.startTable(1);
|
||||
SequenceItemRoot.addSequenceItems(builder, sequenceItemsOffset);
|
||||
return SequenceItemRoot.endSequenceItemRoot(builder);
|
||||
}
|
||||
|
||||
public static void startSequenceItemRoot(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addSequenceItems(FlatBufferBuilder builder, int sequenceItemsOffset) { builder.addOffset(0, sequenceItemsOffset, 0); }
|
||||
public static int createSequenceItemsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startSequenceItemsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endSequenceItemRoot(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishSequenceItemRootBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
|
||||
public static void finishSizePrefixedSequenceItemRootBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public SequenceItemRoot get(int j) { return get(new SequenceItemRoot(), j); }
|
||||
public SequenceItemRoot get(SequenceItemRoot obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UIAddName extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static UIAddName getRootAsUIAddName(ByteBuffer _bb) { return getRootAsUIAddName(_bb, new UIAddName()); }
|
||||
public static UIAddName getRootAsUIAddName(ByteBuffer _bb, UIAddName obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public UIAddName __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int nameIdx() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); }
|
||||
|
||||
public static int createUIAddName(FlatBufferBuilder builder,
|
||||
int nameIdx,
|
||||
int nameOffset) {
|
||||
builder.startTable(2);
|
||||
UIAddName.addName(builder, nameOffset);
|
||||
UIAddName.addNameIdx(builder, nameIdx);
|
||||
return UIAddName.endUIAddName(builder);
|
||||
}
|
||||
|
||||
public static void startUIAddName(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addNameIdx(FlatBufferBuilder builder, int nameIdx) { builder.addInt(0, nameIdx, 0); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(1, nameOffset, 0); }
|
||||
public static int endUIAddName(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public UIAddName get(int j) { return get(new UIAddName(), j); }
|
||||
public UIAddName get(UIAddName obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UIEvent extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static UIEvent getRootAsUIEvent(ByteBuffer _bb) { return getRootAsUIEvent(_bb, new UIEvent()); }
|
||||
public static UIEvent getRootAsUIEvent(ByteBuffer _bb, UIEvent obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public UIEvent __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public byte eventType() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public byte eventSubType() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public int nameIdx() { int o = __offset(8); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public long timestamp() { int o = __offset(10); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public int iteration() { int o = __offset(12); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public int epoch() { int o = __offset(14); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public short variableId() { int o = __offset(16); return o != 0 ? bb.getShort(o + bb_pos) : 0; }
|
||||
public org.nd4j.graph.FrameIteration frameIter() { return frameIter(new org.nd4j.graph.FrameIteration()); }
|
||||
public org.nd4j.graph.FrameIteration frameIter(org.nd4j.graph.FrameIteration obj) { int o = __offset(18); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public int plugin() { int o = __offset(20); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
|
||||
|
||||
public static int createUIEvent(FlatBufferBuilder builder,
|
||||
byte eventType,
|
||||
byte eventSubType,
|
||||
int nameIdx,
|
||||
long timestamp,
|
||||
int iteration,
|
||||
int epoch,
|
||||
short variableId,
|
||||
int frameIterOffset,
|
||||
int plugin) {
|
||||
builder.startTable(9);
|
||||
UIEvent.addTimestamp(builder, timestamp);
|
||||
UIEvent.addFrameIter(builder, frameIterOffset);
|
||||
UIEvent.addEpoch(builder, epoch);
|
||||
UIEvent.addIteration(builder, iteration);
|
||||
UIEvent.addNameIdx(builder, nameIdx);
|
||||
UIEvent.addPlugin(builder, plugin);
|
||||
UIEvent.addVariableId(builder, variableId);
|
||||
UIEvent.addEventSubType(builder, eventSubType);
|
||||
UIEvent.addEventType(builder, eventType);
|
||||
return UIEvent.endUIEvent(builder);
|
||||
}
|
||||
|
||||
public static void startUIEvent(FlatBufferBuilder builder) { builder.startTable(9); }
|
||||
public static void addEventType(FlatBufferBuilder builder, byte eventType) { builder.addByte(0, eventType, 0); }
|
||||
public static void addEventSubType(FlatBufferBuilder builder, byte eventSubType) { builder.addByte(1, eventSubType, 0); }
|
||||
public static void addNameIdx(FlatBufferBuilder builder, int nameIdx) { builder.addInt(2, nameIdx, 0); }
|
||||
public static void addTimestamp(FlatBufferBuilder builder, long timestamp) { builder.addLong(3, timestamp, 0L); }
|
||||
public static void addIteration(FlatBufferBuilder builder, int iteration) { builder.addInt(4, iteration, 0); }
|
||||
public static void addEpoch(FlatBufferBuilder builder, int epoch) { builder.addInt(5, epoch, 0); }
|
||||
public static void addVariableId(FlatBufferBuilder builder, short variableId) { builder.addShort(6, variableId, 0); }
|
||||
public static void addFrameIter(FlatBufferBuilder builder, int frameIterOffset) { builder.addOffset(7, frameIterOffset, 0); }
|
||||
public static void addPlugin(FlatBufferBuilder builder, int plugin) { builder.addShort(8, (short) plugin, (short) 0); }
|
||||
public static int endUIEvent(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public UIEvent get(int j) { return get(new UIEvent(), j); }
|
||||
public UIEvent get(UIEvent obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UIEventSubtype {
|
||||
private UIEventSubtype() { }
|
||||
public static final byte NONE = 0;
|
||||
public static final byte EVALUATION = 1;
|
||||
public static final byte LOSS = 2;
|
||||
public static final byte LEARNING_RATE = 3;
|
||||
public static final byte TUNING_METRIC = 4;
|
||||
public static final byte PERFORMANCE = 5;
|
||||
public static final byte PROFILING = 6;
|
||||
public static final byte FEATURE_LABEL = 7;
|
||||
public static final byte PREDICTION = 8;
|
||||
public static final byte USER_CUSTOM = 9;
|
||||
|
||||
public static final String[] names = { "NONE", "EVALUATION", "LOSS", "LEARNING_RATE", "TUNING_METRIC", "PERFORMANCE", "PROFILING", "FEATURE_LABEL", "PREDICTION", "USER_CUSTOM", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UIEventType {
|
||||
private UIEventType() { }
|
||||
public static final byte ADD_NAME = 0;
|
||||
public static final byte SCALAR = 1;
|
||||
public static final byte ARRAY = 2;
|
||||
public static final byte ARRAY_LIST = 3;
|
||||
public static final byte HISTOGRAM = 4;
|
||||
public static final byte IMAGE = 5;
|
||||
public static final byte SUMMARY_STATISTICS = 6;
|
||||
public static final byte OP_TIMING = 7;
|
||||
public static final byte HARDWARE_STATE = 8;
|
||||
|
||||
public static final String[] names = { "ADD_NAME", "SCALAR", "ARRAY", "ARRAY_LIST", "HISTOGRAM", "IMAGE", "SUMMARY_STATISTICS", "OP_TIMING", "HARDWARE_STATE", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UIGraphStructure extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static UIGraphStructure getRootAsUIGraphStructure(ByteBuffer _bb) { return getRootAsUIGraphStructure(_bb, new UIGraphStructure()); }
|
||||
public static UIGraphStructure getRootAsUIGraphStructure(ByteBuffer _bb, UIGraphStructure obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public UIGraphStructure __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public String inputs(int j) { int o = __offset(4); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int inputsLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector inputsVector() { return inputsVector(new StringVector()); }
|
||||
public StringVector inputsVector(StringVector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.IntPair inputsPair(int j) { return inputsPair(new org.nd4j.graph.IntPair(), j); }
|
||||
public org.nd4j.graph.IntPair inputsPair(org.nd4j.graph.IntPair obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int inputsPairLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.IntPair.Vector inputsPairVector() { return inputsPairVector(new org.nd4j.graph.IntPair.Vector()); }
|
||||
public org.nd4j.graph.IntPair.Vector inputsPairVector(org.nd4j.graph.IntPair.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String outputs(int j) { int o = __offset(8); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int outputsLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector outputsVector() { return outputsVector(new StringVector()); }
|
||||
public StringVector outputsVector(StringVector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.UIVariable variables(int j) { return variables(new org.nd4j.graph.UIVariable(), j); }
|
||||
public org.nd4j.graph.UIVariable variables(org.nd4j.graph.UIVariable obj, int j) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int variablesLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.UIVariable.Vector variablesVector() { return variablesVector(new org.nd4j.graph.UIVariable.Vector()); }
|
||||
public org.nd4j.graph.UIVariable.Vector variablesVector(org.nd4j.graph.UIVariable.Vector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public org.nd4j.graph.UIOp ops(int j) { return ops(new org.nd4j.graph.UIOp(), j); }
|
||||
public org.nd4j.graph.UIOp ops(org.nd4j.graph.UIOp obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int opsLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
|
||||
public org.nd4j.graph.UIOp.Vector opsVector() { return opsVector(new org.nd4j.graph.UIOp.Vector()); }
|
||||
public org.nd4j.graph.UIOp.Vector opsVector(org.nd4j.graph.UIOp.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createUIGraphStructure(FlatBufferBuilder builder,
|
||||
int inputsOffset,
|
||||
int inputsPairOffset,
|
||||
int outputsOffset,
|
||||
int variablesOffset,
|
||||
int opsOffset) {
|
||||
builder.startTable(5);
|
||||
UIGraphStructure.addOps(builder, opsOffset);
|
||||
UIGraphStructure.addVariables(builder, variablesOffset);
|
||||
UIGraphStructure.addOutputs(builder, outputsOffset);
|
||||
UIGraphStructure.addInputsPair(builder, inputsPairOffset);
|
||||
UIGraphStructure.addInputs(builder, inputsOffset);
|
||||
return UIGraphStructure.endUIGraphStructure(builder);
|
||||
}
|
||||
|
||||
public static void startUIGraphStructure(FlatBufferBuilder builder) { builder.startTable(5); }
|
||||
public static void addInputs(FlatBufferBuilder builder, int inputsOffset) { builder.addOffset(0, inputsOffset, 0); }
|
||||
public static int createInputsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startInputsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addInputsPair(FlatBufferBuilder builder, int inputsPairOffset) { builder.addOffset(1, inputsPairOffset, 0); }
|
||||
public static int createInputsPairVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startInputsPairVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addOutputs(FlatBufferBuilder builder, int outputsOffset) { builder.addOffset(2, outputsOffset, 0); }
|
||||
public static int createOutputsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startOutputsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addVariables(FlatBufferBuilder builder, int variablesOffset) { builder.addOffset(3, variablesOffset, 0); }
|
||||
public static int createVariablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startVariablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addOps(FlatBufferBuilder builder, int opsOffset) { builder.addOffset(4, opsOffset, 0); }
|
||||
public static int createOpsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startOpsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endUIGraphStructure(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public UIGraphStructure get(int j) { return get(new UIGraphStructure(), j); }
|
||||
public UIGraphStructure get(UIGraphStructure obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UIHardwareState extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static UIHardwareState getRootAsUIHardwareState(ByteBuffer _bb) { return getRootAsUIHardwareState(_bb, new UIHardwareState()); }
|
||||
public static UIHardwareState getRootAsUIHardwareState(ByteBuffer _bb, UIHardwareState obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public UIHardwareState __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long gpuMemory(int j) { int o = __offset(4); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int gpuMemoryLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector gpuMemoryVector() { return gpuMemoryVector(new LongVector()); }
|
||||
public LongVector gpuMemoryVector(LongVector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer gpuMemoryAsByteBuffer() { return __vector_as_bytebuffer(4, 8); }
|
||||
public ByteBuffer gpuMemoryInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 8); }
|
||||
public long hostMemory() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
|
||||
public static int createUIHardwareState(FlatBufferBuilder builder,
|
||||
int gpuMemoryOffset,
|
||||
long hostMemory) {
|
||||
builder.startTable(2);
|
||||
UIHardwareState.addHostMemory(builder, hostMemory);
|
||||
UIHardwareState.addGpuMemory(builder, gpuMemoryOffset);
|
||||
return UIHardwareState.endUIHardwareState(builder);
|
||||
}
|
||||
|
||||
public static void startUIHardwareState(FlatBufferBuilder builder) { builder.startTable(2); }
|
||||
public static void addGpuMemory(FlatBufferBuilder builder, int gpuMemoryOffset) { builder.addOffset(0, gpuMemoryOffset, 0); }
|
||||
public static int createGpuMemoryVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startGpuMemoryVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addHostMemory(FlatBufferBuilder builder, long hostMemory) { builder.addLong(1, hostMemory, 0L); }
|
||||
public static int endUIHardwareState(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public UIHardwareState get(int j) { return get(new UIHardwareState(), j); }
|
||||
public UIHardwareState get(UIHardwareState obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package org.nd4j.graph;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class UIHistogram extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_25_2_10(); }
|
||||
public static UIHistogram getRootAsUIHistogram(ByteBuffer _bb) { return getRootAsUIHistogram(_bb, new UIHistogram()); }
|
||||
public static UIHistogram getRootAsUIHistogram(ByteBuffer _bb, UIHistogram obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public UIHistogram __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public byte type() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public long numbins() { int o = __offset(6); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
|
||||
public org.nd4j.graph.FlatArray binranges() { return binranges(new org.nd4j.graph.FlatArray()); }
|
||||
public org.nd4j.graph.FlatArray binranges(org.nd4j.graph.FlatArray obj) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public org.nd4j.graph.FlatArray y() { return y(new org.nd4j.graph.FlatArray()); }
|
||||
public org.nd4j.graph.FlatArray y(org.nd4j.graph.FlatArray obj) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public String binlabels(int j) { int o = __offset(12); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int binlabelsLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector binlabelsVector() { return binlabelsVector(new StringVector()); }
|
||||
public StringVector binlabelsVector(StringVector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
|
||||
public static int createUIHistogram(FlatBufferBuilder builder,
|
||||
byte type,
|
||||
long numbins,
|
||||
int binrangesOffset,
|
||||
int yOffset,
|
||||
int binlabelsOffset) {
|
||||
builder.startTable(5);
|
||||
UIHistogram.addBinlabels(builder, binlabelsOffset);
|
||||
UIHistogram.addY(builder, yOffset);
|
||||
UIHistogram.addBinranges(builder, binrangesOffset);
|
||||
UIHistogram.addNumbins(builder, numbins);
|
||||
UIHistogram.addType(builder, type);
|
||||
return UIHistogram.endUIHistogram(builder);
|
||||
}
|
||||
|
||||
public static void startUIHistogram(FlatBufferBuilder builder) { builder.startTable(5); }
|
||||
public static void addType(FlatBufferBuilder builder, byte type) { builder.addByte(0, type, 0); }
|
||||
public static void addNumbins(FlatBufferBuilder builder, long numbins) { builder.addInt(1, (int) numbins, (int) 0L); }
|
||||
public static void addBinranges(FlatBufferBuilder builder, int binrangesOffset) { builder.addOffset(2, binrangesOffset, 0); }
|
||||
public static void addY(FlatBufferBuilder builder, int yOffset) { builder.addOffset(3, yOffset, 0); }
|
||||
public static void addBinlabels(FlatBufferBuilder builder, int binlabelsOffset) { builder.addOffset(4, binlabelsOffset, 0); }
|
||||
public static int createBinlabelsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startBinlabelsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static int endUIHistogram(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public UIHistogram get(int j) { return get(new UIHistogram(), j); }
|
||||
public UIHistogram get(UIHistogram obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user