cavis/libnd4j/include/graph/VariableProxy.h

89 lines
3.4 KiB
C
Raw Normal View History

2019-06-06 14:21:15 +02:00
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* 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.
*
* 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 {
2019-06-06 14:21:15 +02:00
namespace graph {
class ND4J_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 sd::memory::Workspace *workspace();
2019-06-06 14:21:15 +02:00
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 sd::graph::Variable *getVariable(int id);
virtual sd::graph::Variable *getVariable(int id, int idx);
virtual sd::graph::Variable *getVariable(std::pair<int,int>& pair);
virtual sd::graph::Variable *getVariable(std::string *symbol);
2019-06-06 14:21:15 +02:00
virtual std::vector<Variable*> getVariables();
virtual Variable* putVariable(std::pair<int,int>& pair, NDArray *array);
2019-06-06 14:21:15 +02:00
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);
2019-06-06 14:21:15 +02:00
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(sd::NDArrayList *list);
2019-06-06 14:21:15 +02:00
// memory-related statistics
virtual Nd4jLong externalMemory();
virtual Nd4jLong internalMemory();
virtual Nd4jLong totalMemory();
virtual int externalEntries();
virtual int internalEntries();
virtual int totalEntries();
virtual sd::graph::VariableSpace *clone();
2019-06-06 14:21:15 +02:00
virtual sd::graph::Stash* getStash();
2019-06-06 14:21:15 +02:00
virtual void setFlowPath(FlowPath* timers);
virtual FlowPath* flowPath();
};
}
}