caffe深度学习网络softmax层代码注释


// 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
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值