// Copyright 2014 BVLC and contributors.
//
#include <algorithm>
#include <vector>
#include "caffe/layer.hpp"
#include "caffe/vision_layers.hpp"
#include "caffe/util/math_functions.hpp"
using std::max;
namespace caffe {
template <typename Dtype>
//建立softmax网络层
void SoftmaxLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top)
{
CHECK_EQ(bottom.size(), 1) << "Softmax Layer takes a single blob as input."; //bottom是输入
CHECK_EQ(top->size(), 1) << "Softmax Layer takes a single blob as output.";//top是输出
//以minist为例,如果一次送进来一张图片,因为上一层inner_product层输出10个节点,则bottom : num = 1, channels = 10, height = 1, width = 1;
//输出分配空间
(*top)[0]->Reshape(bottom[0]->num(), bottom[0]->channels(),
bottom[0]->height(), bottom[0]->width());
//sum_multiplier_这里都是1&#x
caffe深度学习网络softmax层代码注释
最新推荐文章于 2024-01-09 22:53:58 发布