C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

neural_networks_training_topology.h
1 /* file: neural_networks_training_topology.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 #ifndef __NEURAL_NETWORKS_TRAINING_TOPOLOGY_H__
19 #define __NEURAL_NETWORKS_TRAINING_TOPOLOGY_H__
20 
21 #include "algorithms/neural_networks/layers/layer_descriptor.h"
22 
23 namespace daal
24 {
25 namespace algorithms
26 {
27 namespace neural_networks
28 {
29 namespace training
30 {
31 namespace interface1
32 {
43 class Topology: public Base
44 {
45 public:
50  Topology() {}
51 
57  DAAL_DEPRECATED Topology(const Topology &t) : _config(t.size())
58  {
59  for(size_t i = 0; i < t.size(); i++)
60  {
61  _config[i] = layers::LayerDescriptor(i, t[i].layer(), t[i].nextLayers());
62  }
63  }
64 
70  size_t size() const { return _config.size(); }
71 
78  size_t push_back(const layers::LayerIfacePtr &layer)
79  {
80  size_t id = _config.size();
81  _config.push_back(layers::LayerDescriptor(id, layer));
82  return id;
83  }
84 
91  DAAL_DEPRECATED size_t add(const layers::LayerIfacePtr &layer)
92  {
93  return push_back(layer);
94  }
95 
103  DAAL_DEPRECATED size_t add(const Topology &topologyBlock, size_t &startIndex)
104  {
105  size_t size = _config.size();
106  startIndex = size;
107 
108  size_t id = 0;
109  for(size_t i = 0; i < topologyBlock.size(); i++)
110  {
111  id = push_back(topologyBlock[i].layer());
112 
113  const layers::NextLayers& nextLayers = topologyBlock[i].nextLayers();
114  for(size_t j = 0; j < nextLayers.size(); j++)
115  {
116  get(i + size).addNext(nextLayers[j] + size);
117  }
118  }
119  return id;
120  }
121 
128  DAAL_DEPRECATED services::Status clear()
129  {
130  _config.clear();
131  return services::Status();
132  }
133 
140  DAAL_DEPRECATED layers::LayerDescriptor& operator [] (size_t index) { return _config[index]; }
141 
148  const layers::LayerDescriptor& operator [] (size_t index) const { return _config[index]; }
149 
156  layers::LayerDescriptor& get(size_t index) { return _config[index]; }
157 
164  DAAL_DEPRECATED const layers::LayerDescriptor& get(size_t index) const { return _config[index]; }
165 
175  DAAL_DEPRECATED services::Status addNext(size_t index, size_t next)
176  {
177  _config[index].addNext(next);
178  return services::Status();
179  }
180 
181 protected:
182  services::Collection<layers::LayerDescriptor> _config;
183 };
184 
185 typedef services::SharedPtr<Topology> TopologyPtr;
187 }
188 using interface1::Topology;
189 using interface1::TopologyPtr;
190 }
191 }
192 }
193 }
194 
195 #endif
daal::algorithms::neural_networks::training::interface1::Topology::addNext
DAAL_DEPRECATED services::Status addNext(size_t index, size_t next)
Definition: neural_networks_training_topology.h:175
daal::algorithms::neural_networks::training::interface1::Topology::push_back
size_t push_back(const layers::LayerIfacePtr &layer)
Definition: neural_networks_training_topology.h:78
daal::algorithms::neural_networks::training::interface1::Topology::add
DAAL_DEPRECATED size_t add(const Topology &topologyBlock, size_t &startIndex)
Definition: neural_networks_training_topology.h:103
daal::Base
Base class for Intel(R) Data Analytics Acceleration Library objects
Definition: base.h:41
daal::algorithms::neural_networks::training::interface1::Topology::add
DAAL_DEPRECATED size_t add(const layers::LayerIfacePtr &layer)
Definition: neural_networks_training_topology.h:91
daal::algorithms::neural_networks::training::interface1::Topology::operator[]
DAAL_DEPRECATED layers::LayerDescriptor & operator[](size_t index)
Definition: neural_networks_training_topology.h:140
daal::algorithms::neural_networks::training::interface1::Topology::size
size_t size() const
Definition: neural_networks_training_topology.h:70
daal::algorithms::neural_networks::training::interface1::Topology
Class defining a neural network topology - a set of layers and connection between them - on the train...
Definition: neural_networks_training_topology.h:43
daal::algorithms::neural_networks::training::interface1::Topology::clear
DAAL_DEPRECATED services::Status clear()
Definition: neural_networks_training_topology.h:128
daal::algorithms::neural_networks::training::interface1::Topology::Topology
Topology()
Definition: neural_networks_training_topology.h:50
daal::algorithms::neural_networks::training::interface1::Topology::Topology
DAAL_DEPRECATED Topology(const Topology &t)
Definition: neural_networks_training_topology.h:57

For more complete information about compiler optimizations, see our Optimization Notice.