Skip to content

Commit 4614041

Browse files
committed
fix
1 parent 41e6c50 commit 4614041

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

app/Graph/build.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ class LayerFactory {
8989
float beta = 0.0F) {
9090
if (onednn_ && EwLayerOneDnn::is_function_supported(function)) {
9191
return std::make_shared<EwLayerOneDnn>(function, alpha, beta);
92-
} else {
93-
return std::make_shared<EWLayer>(function, alpha, beta);
9492
}
93+
return std::make_shared<EWLayer>(function, alpha, beta);
9594
}
9695
};
9796

include/graph/graph.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Graph {
7474
split_distribution_ = split_dist;
7575
}
7676

77-
void addOwnedLayer(std::shared_ptr<Layer> layer) {
77+
void addOwnedLayer(const std::shared_ptr<Layer>& layer) {
7878
if (!layer) return;
7979
for (const auto& existing_layer : owned_layers_) {
8080
if (existing_layer.get() == layer.get()) {
@@ -115,7 +115,7 @@ class Graph {
115115
return *layers_[layerID];
116116
}
117117

118-
void setInput(std::shared_ptr<Layer> layer, Tensor& vec) {
118+
void setInput(const std::shared_ptr<Layer>& layer, Tensor& vec) {
119119
addOwnedLayer(layer);
120120
layer->setID(0);
121121
layers_.push_back(layer.get());
@@ -126,7 +126,7 @@ class Graph {
126126
in_edges_.resize(1);
127127
}
128128

129-
void addSingleLayer(std::shared_ptr<Layer> layer) {
129+
void addSingleLayer(const std::shared_ptr<Layer>& layer) {
130130
addOwnedLayer(layer);
131131

132132
bool layer_exists = false;
@@ -150,8 +150,8 @@ class Graph {
150150
}
151151
}
152152

153-
void makeConnection(std::shared_ptr<Layer> layPrev,
154-
std::shared_ptr<Layer> layNext) {
153+
void makeConnection(const std::shared_ptr<Layer>& layPrev,
154+
const std::shared_ptr<Layer>& layNext) {
155155
addOwnedLayer(layPrev);
156156
addOwnedLayer(layNext);
157157

@@ -193,8 +193,8 @@ class Graph {
193193
in_edges_[layNext->getID()].push_back(layPrev->getID());
194194
}
195195

196-
bool areLayerNext(std::shared_ptr<Layer> layPrev,
197-
std::shared_ptr<Layer> layNext) {
196+
bool areLayerNext(const std::shared_ptr<Layer>& layPrev,
197+
const std::shared_ptr<Layer>& layNext) {
198198
for (int i = arrayV_[layPrev->getID()]; i < arrayV_[layPrev->getID() + 1];
199199
i++) {
200200
if (arrayE_[i] == layNext->getID()) {
@@ -302,7 +302,7 @@ class Graph {
302302
*outtenres_ = outten_[0];
303303
}
304304

305-
void setOutput(std::shared_ptr<Layer> layer, Tensor& vec) {
305+
void setOutput(const std::shared_ptr<Layer>& layer, Tensor& vec) {
306306
end_ = layer->getID();
307307
outtenres_ = &vec;
308308
std::vector<int> vec1 = {1, 7, 1, 0};

0 commit comments

Comments
 (0)