cavis/libnd4j/include/graph/execution/impl/LogicExecutor.cpp

71 lines
3.0 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
******************************************************************************/
//
// Created by raver119 on 20.10.2017.
//
#include <graph/execution/LogicExecutor.h>
#include <graph/execution/LogicScope.h>
#include <graph/execution/LogicWhile.h>
#include <graph/execution/LogicSwitch.h>
#include <graph/execution/LogicConditional.h>
#include <graph/execution/LogicReturn.h>
#include <graph/execution/LogicExpose.h>
#include <graph/execution/LogicMerge.h>
#include <graph/execution/LogicEnter.h>
#include <graph/execution/LogicExit.h>
#include <graph/execution/LogicLoopCond.h>
#include <graph/execution/LogicNextIteration.h>
namespace sd {
2019-06-06 14:21:15 +02:00
namespace graph {
Nd4jStatus LogicExecutor::processNode(Graph *graph, Node *node) {
switch (node->opNum()) {
case sd::logic::While:
2019-06-06 14:21:15 +02:00
return LogicWhile::processNode(graph, node);
case sd::logic::Scope:
2019-06-06 14:21:15 +02:00
return LogicScope::processNode(graph, node);
case sd::logic::Conditional:
2019-06-06 14:21:15 +02:00
return LogicConditional::processNode(graph, node);
case sd::logic::Switch:
2019-06-06 14:21:15 +02:00
return LogicSwitch::processNode(graph, node);
case sd::logic::Return:
2019-06-06 14:21:15 +02:00
return LogicReturn::processNode(graph, node);
case sd::logic::Expose:
2019-06-06 14:21:15 +02:00
return LogicExpose::processNode(graph, node);
case sd::logic::Merge:
2019-06-06 14:21:15 +02:00
return LogicMerge::processNode(graph, node);
case sd::logic::LoopCond:
2019-06-06 14:21:15 +02:00
return LogicLoopCond::processNode(graph, node);
case sd::logic::NextIteration:
2019-06-06 14:21:15 +02:00
return LogicNextIeration::processNode(graph, node);
case sd::logic::Exit:
2019-06-06 14:21:15 +02:00
return LogicExit::processNode(graph, node);
case sd::logic::Enter:
2019-06-06 14:21:15 +02:00
return LogicEnter::processNode(graph, node);
}
if (node->getName() == nullptr) {
nd4j_printf("Unknown LogicOp used at node [%i]: [%i]\n", node->id(), node->opNum());
} else {
nd4j_printf("Unknown LogicOp used at node [%i:<%s>]: [%i]\n", node->id(), node->getName()->c_str(), node->opNum());
}
return ND4J_STATUS_BAD_INPUT;
}
}
}