本文整理汇总了C++中Tensor::NumLayers方法的典型用法代码示例。如果您正苦于以下问题:C++ Tensor::NumLayers方法的具体用法?C++ Tensor::NumLayers怎么用?C++ Tensor::NumLayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tensor
的用法示例。
在下文中一共展示了Tensor::NumLayers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
Vector process(const Vector &input, NetworkContext &ctx) {
assert(input.rows() == numInputs);
ctx.layerOutputs.resize(layerWeights.NumLayers());
ctx.layerOutputs[0] = getLayerOutput(input, layerWeights(0));
for (unsigned i = 1; i < layerWeights.NumLayers(); i++) {
ctx.layerOutputs[i] = getLayerOutput(ctx.layerOutputs[i-1], layerWeights(i));
}
assert(ctx.layerOutputs[ctx.layerOutputs.size()-1].rows() == numOutputs);
return ctx.layerOutputs[ctx.layerOutputs.size()-1];
}
示例2: NetworkImpl
NetworkImpl(const vector<unsigned> &layerSizes) {
assert(layerSizes.size() >= 2);
this->numLayers = layerSizes.size() - 1;
this->numInputs = layerSizes[0];
this->numOutputs = layerSizes[layerSizes.size() - 1];
for (unsigned i = 0; i < numLayers; i++) {
layerWeights.AddLayer(createLayer(layerSizes[i], layerSizes[i+1]));
}
zeroGradient = layerWeights;
for (unsigned i = 0; i < zeroGradient.NumLayers(); i++) {
zeroGradient(i).setZero();
}
}