FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CaffeOnACL/src/caffe/layers/loss_layer.cpp at master · 2php/CaffeOnACL · GitHub
2php
CaffeOnACL
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
CaffeOnACL
/
src
/
caffe
/
layers
/
loss_layer.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
27 lines (21 loc) · 788 Bytes
Breadcrumbs
CaffeOnACL
/
src
/
caffe
/
layers
/
loss_layer.cpp
Copy path
File metadata and controls
27 lines (21 loc) · 788 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
include
<
vector
>
#
include
"
caffe/layers/loss_layer.hpp
"
namespace
caffe
{
template
<
typename
Dtype>
void
LossLayer<Dtype>::LayerSetUp(
const
vector<Blob<Dtype>*>& bottom,
const
vector<Blob<Dtype>*>& top) {
//
LossLayers have a non-zero (1) loss by default.
if
(
this
->
layer_param_
.
loss_weight_size
() ==
0
) {
this
->
layer_param_
.
add_loss_weight
(
Dtype
(
1
));
}
}
template
<
typename
Dtype>
void
LossLayer<Dtype>::Reshape(
const
vector<Blob<Dtype>*>& bottom,
const
vector<Blob<Dtype>*>& top) {
CHECK_EQ
(bottom[
0
]->
shape
(
0
), bottom[
1
]->
shape
(
0
))
<<
"
The data and label should have the same first dimension.
"
;
vector<
int
>
loss_shape
(
0
);
//
Loss layers output a scalar; 0 axes.
top[
0
]->
Reshape
(loss_shape);
}
INSTANTIATE_CLASS
(LossLayer);
}
//
namespace caffe
Back
|
FazBrowse Home
|
New Git URL