本文整理汇总了C++中LayerParameter::backward_type方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerParameter::backward_type方法的具体用法?C++ LayerParameter::backward_type怎么用?C++ LayerParameter::backward_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerParameter
的用法示例。
在下文中一共展示了LayerParameter::backward_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LayerBase
Layer<Ftype, Btype>::Layer(const LayerParameter& param) : LayerBase(param) {
// Set phase and copy blobs (if there are any).
phase_ = layer_param_.phase();
debug_ = layer_param_.debug();
// Data&Math types
if (!layer_param_.has_forward_type()) {
layer_param_.set_forward_type(tp<Ftype>());
}
if (!layer_param_.has_backward_type()) {
layer_param_.set_backward_type(tp<Btype>());
}
if (!layer_param_.has_forward_math()) {
layer_param_.set_forward_math(tpmax<Ftype, float>());
}
if (!layer_param_.has_backward_math()) {
layer_param_.set_backward_math(tpmax<Btype, float>());
}
Type ftype = layer_param_.forward_type();
Type ftype_t = tp<Ftype>();
if (ftype != ftype_t) {
DLOG(WARNING) << "Overriding LayerParameter's forward type " << Type_Name(ftype)
<< " by template's " << Type_Name(ftype_t) << " for Layer '"
<< layer_param_.name() << "' of type '" << layer_param_.type() << "'";
layer_param_.set_forward_type(ftype_t);
}
Type btype = param.backward_type();
Type btype_t = tp<Btype>();
if (btype != btype_t) {
DLOG(WARNING) << "Overriding LayerParameter's backward type " << Type_Name(btype)
<< " by template's " << Type_Name(btype_t) << " for Layer '"
<< layer_param_.name() << "' of type '" << layer_param_.type() << "'";
layer_param_.set_backward_type(btype_t);
}
if (layer_param_.blobs_size() > 0) {
blobs_.resize(layer_param_.blobs_size());
for (int i = 0; i < layer_param_.blobs_size(); ++i) {
blobs_[i] = Blob::create<Ftype>();
blobs_[i]->FromProto(layer_param_.blobs(i));
}
}
}