本文整理汇总了C++中Blob::get_N方法的典型用法代码示例。如果您正苦于以下问题:C++ Blob::get_N方法的具体用法?C++ Blob::get_N怎么用?C++ Blob::get_N使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blob
的用法示例。
在下文中一共展示了Blob::get_N方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compare
Blob compare(Blob& A, Blob& B) {
assert(A.get_N() == B.get_N());
Blob out(A.size());
for (int i = 0; i < A.get_N(); ++i) {
out[i] = conv_to<cube>::from(A[i] == B[i]);
}
return out;
}
示例2: out
Blob operator/(Blob& A, double num) {
Blob out(A.size());
int N = A.get_N();
for (int i = 0; i < N; ++i) {
out[i] = A[i] / num;
}
return out;
}
示例3: sqrt
Blob sqrt(Blob& A) {
Blob out(A.size());
int N = A.get_N();
for (int i = 0; i < N; ++i) {
out[i] = arma::sqrt(A[i]);
}
return out;
}
示例4: prob
double prob(Blob& Y, Blob& p) {
assert(Y.get_N() == p.get_N());
assert(Y.get_C() == p.get_C());
assert(Y.get_H() == p.get_H());
assert(Y.get_W() == p.get_W());
double ret = 0;
int N = Y.get_N();
int C = Y.get_C();
vector<int> pp(N, -1);
vector<int> yy(N, -2);
mat mpp = p.reshape();
mat myy = Y.reshape();
for (int i = 0; i < N; ++i) {
int idx_p = 0, idx_y = 0;
double max_p = mpp(i,0), max_y = myy(i,0);
for (int j = 1; j < C; ++j) {
if (mpp(i, j) > max_p) {
max_p = mpp(i, j);
idx_p = j;
}
if (myy(i, j) > max_y) {
max_y = myy(i, j);
idx_y = j;
}
}
pp[i] = idx_p;
yy[i] = idx_y;
}
int cnt = 0;
for (int i = 0; i < N; ++i) {
if (pp[i] == yy[i])
cnt++;
}
ret = (double)cnt / (double)N;
return ret;
}