本文整理汇总了C++中NDArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ NDArray::end方法的具体用法?C++ NDArray::end怎么用?C++ NDArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NDArray
的用法示例。
在下文中一共展示了NDArray::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
ImageBuffer apply(const CurveBuffers& lines, ImageBuffer output) {
i32 nts = lines.size(0);
i32 nks = lines.size(1);
ImageBuffer amounts;
ImBufList bufStack;
PopAdaptor popper(bufStack);
PushAdaptor pusher(bufStack);
if (preloadBuffers_ && contextID_ != CurrentContextID()) {
LoadSparseFilters(sparseKernels_.begin(),
sparseKernels_.end(),
sparseBufs_.begin());
contextID_ = CurrentContextID();
}
for (i32 tji = 0; tji < nts; ++tji) {
for (i32 kji = 0; kji < nks; ++kji)
pusher.output(lines(tji, kji));
ImageBuffer lineLocs = Merge(Max, nks, popper);
pusher.output(Filter(lineLocs, sparseBufs_[tji]));
}
return Merge(Add, nts, popper, output);
}
示例2: apply
ImageBuffer apply(const NDArray<ImageBuffer,3>& input, ImageBuffer output) {
ImBufList stack;
PopAdaptor popper(stack);
PushAdaptor pusher(stack);
if (!kernBufs_[0].valid())
LoadSparseFilters(kernels_.begin(), kernels_.end(), kernBufs_.begin());
i32 nto = params_.numOrientations;
i32 ncs = params_.numCurvatures;
NDIndex<3> srcIndx;
for (i32 tji = 0; tji < nto; ++tji) {
srcIndx[0] = tji;
for (i32 ktji = 0; ktji < ncs; ++ktji) {
srcIndx[1] = ktji;
for (i32 knji = 0; knji < ncs; ++knji) {
srcIndx[2] = knji;
pusher.output(Filter(input[srcIndx], kernBufs_[srcIndx]));
}
}
pusher.output(Merge(Add, ncs*ncs, popper));
}
Merge(Add, nto, popper, output);
if (params_.minSupport != 0 || params_.maxSupport != 1) {
Rescale(output, params_.minSupport, params_.maxSupport,
0, 1, false, output);
}
return output;
}
示例3: FindStationFromNode
static void FindStationFromNode( Digraph& dg, Digraph::Node u, EdgeArray& es, bool reverse = false )
{
NDArray nds;
if( reverse )
{
DFS_Helper3( dg, u, nds );
}
else
{
DFS_Helper2( dg, u, nds );
}
std::sort( nds.begin(), nds.end(), SortNodeDist() );
for( int i = 0; i < nds.size(); i++ )
{
if( i < MAX_PATH_LENGTH )
{
bool ret = true;
DPath p;
if( reverse )
{
ret = DFS_Helper( dg, nds[i].u, u, p );
}
else
{
ret = DFS_Helper( dg, u, nds[i].u, p );
}
if( !ret ) continue;
for( DPath::ArcIt e( p ); e != INVALID; ++e )
{
if( !es.contains( e ) ) es.append( e );
}
}
}
}
示例4: apply
ImageBuffer apply(const CurveBuffers& inputs, ImageBuffer output) {
using namespace std::tr1;
using namespace std::tr1::placeholders;
i32 nto = params_.numTotalOrientations;
i32 ncs = params_.numCurvatures;
i32 nnc = params_.numNormalComponents;
i32 ntc = params_.numTangentialComponents;
ImBufList stack;
PopAdaptor popper(stack);
PushAdaptor pusher(stack);
if (preloadBuffers_ && contextID_ != CurrentContextID()) {
LoadSparseFilters(sparseComponents_.begin(),
sparseComponents_.end(),
filterBufs_.begin());
contextID_ = CurrentContextID();
}
NDIndex<2> srcIndx;
for (i32 tani = 0; tani < ntc; ++tani) {
for (i32 ni = 0; ni < nnc; ++ni) {
for (i32 tji = 0; tji < nto; ++tji) {
srcIndx[0] = tji;
for (i32 kji = 0; kji < ncs; ++kji) {
srcIndx[1] = kji;
if (preloadBuffers_) {
const SparseImageBuffer& filt =
filterBufs_(tani, ni, tji, kji);
pusher.output(Filter(inputs[srcIndx], filt));
}
else {
const SparseImageData& filt =
sparseComponents_(tani, ni, tji, kji);
pusher.output(Filter(inputs[srcIndx], filt));
}
}
}
pusher.output(Merge(Add, nto*ncs, popper));
}
pusher.output(LLMerge(LLAnd, nnc, params_.logLinDegree,
params_.adapt, 1.f, popper));
}
CircularAdaptor circ(stack);
ImageBuffer sum = Merge(Add, ntc, circ);
circ.reset();
Map(bind(Stabilize, _1, sum, ntc, params_.stabilizer, _2), ntc, circ);
i32 halfntc = ntc/2;
if (ntc != 2) {
// To support more tangential components, the surround operation would
// have to be extended to support more than two arguments.
assert(ntc == 4 && "Only two or four tangential components supported");
ImageBuffer tcs[4] = {popper.next(), popper.next(),
popper.next(), popper.next()};
pusher.output(Surround(tcs[1], tcs[0], params_.logLinDegree));
pusher.output(Surround(tcs[2], tcs[3], params_.logLinDegree));
}
return LLMerge(LLAnd, ntc - 2*halfntc + 2,
params_.logLinDegree, params_.adapt, 1.f,
popper, output);
}