From 8727aa8cacd19d190f9e046a4185d3d55b96e9c3 Mon Sep 17 00:00:00 2001 From: gaoyong10 Date: Fri, 23 Apr 2021 12:32:48 +0800 Subject: [PATCH] add switch actor --- .../core/mindrt/include/actor/switch_actor.h | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 mindspore/core/mindrt/include/actor/switch_actor.h diff --git a/mindspore/core/mindrt/include/actor/switch_actor.h b/mindspore/core/mindrt/include/actor/switch_actor.h new file mode 100644 index 00000000000..a3b580bbd04 --- /dev/null +++ b/mindspore/core/mindrt/include/actor/switch_actor.h @@ -0,0 +1,44 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://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. + */ + +#ifndef MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_SWITCH_ACTOR_H +#define MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_SWITCH_ACTOR_H + +#include +#include +#include +#include "actor/actor.h" +#include "actor/op_actor.h" + +namespace mindspore { + +template +class SwitchActorBase : public OpActor { + public: + explicit SwitchActorBase(std::string op_name) : ActorBase(op_name) {} + virtual ~SwitchActorBase() = default; + + // The actor run when receive the input data. + void RunOpData(OpDataPtr input_data, OpContext *context = nullptr) override {} + + protected: + // Different output branches according to the input. + std::vector> output_branch_arrows_; +}; + +} // namespace mindspore + +#endif // MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_SWITCH_ACTOR_H