本文整理汇总了C++中Filter::GetNumOutputs方法的典型用法代码示例。如果您正苦于以下问题:C++ Filter::GetNumOutputs方法的具体用法?C++ Filter::GetNumOutputs怎么用?C++ Filter::GetNumOutputs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter::GetNumOutputs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvForward
ImageBatch Convolution::ConvForward(ImageBatch src, Filter filter, NArray bias, ConvInfo info) {
CHECK_EQ(src.GetNumFeatureMaps(), filter.GetNumInputs()) << "#input channels mismatch";
CHECK_EQ(bias.Size().NumDims(), 1) << "bias dimension mismatch";
CHECK_EQ(bias.Size()[0], filter.GetNumOutputs()) << "bias size mismatch";
//no such limit
//CHECK_EQ((src.GetHeight() + 2 * info.pad_height - filter.GetHeight()) % info.stride_vertical, 0) << "filter height mismatch";
//CHECK_EQ((src.GetWidth() + 2 * info.pad_width - filter.GetWidth()) % info.stride_horizontal, 0) << "filter width mismatch";
Scale new_size {
(src.GetWidth() + 2 * info.pad_width - filter.GetWidth()) / info.stride_horizontal + 1,
(src.GetHeight() + 2 * info.pad_height - filter.GetHeight()) / info.stride_vertical + 1,
filter.GetNumOutputs(),
src.GetNumImages()
};
ConvForwardOp* op = new ConvForwardOp();
op->closure = {
info.pad_height,
info.pad_width,
info.stride_vertical,
info.stride_horizontal
};
return NArray::ComputeOne({src, filter, bias}, new_size, op);
}
示例2: ConvBackwardData
ImageBatch Convolution::ConvBackwardData(ImageBatch diff, ImageBatch bottom, Filter filter, ConvInfo info) {
CHECK_EQ(diff.GetNumFeatureMaps(), filter.GetNumOutputs()) << "#output channels mismatch";
/*
* We can't get filter size when (top + 2*pad) % stride != 0
Scale new_size {
(diff.GetWidth() - 1) * info.stride_horizontal + filter.GetWidth() - 2 * info.pad_width,
(diff.GetHeight() - 1) * info.stride_vertical + filter.GetHeight() - 2 * info.pad_height,
filter.GetNumInputs(),
diff.GetNumImages()
};
*/
ConvBackwardDataOp* op = new ConvBackwardDataOp();
op->closure = {
info.pad_height,
info.pad_width,
info.stride_vertical,
info.stride_horizontal
};
return NArray::ComputeOne({diff, filter}, bottom.Size(), op);
}