本文整理汇总了C++中tensor::size方法的典型用法代码示例。如果您正苦于以下问题:C++ tensor::size方法的具体用法?C++ tensor::size怎么用?C++ tensor::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensor
的用法示例。
在下文中一共展示了tensor::size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void log10 (
tensor& dest,
const tensor& src
)
{
DLIB_CASSERT(dest.size() == src.size());
#ifdef DLIB_USE_CUDA
cuda::log10(dest,src);
#else
dest = log10(mat(src));
#endif
}
示例2:
void curand_generator::
fill_gaussian (
tensor& data,
float mean,
float stddev
)
{
if (data.size() == 0)
return;
CHECK_CURAND(curandGenerateNormal((curandGenerator_t)handle,
data.device(),
data.size(),
mean,
stddev));
}
示例3: scale_rows
void scale_rows (
tensor& out,
const tensor& m,
const tensor& v
)
{
DLIB_CASSERT(have_same_dimensions(out,m));
DLIB_CASSERT(is_vector(v));
if (m.size() == 0 && v.size() == 0)
return;
DLIB_CASSERT(m.size() != 0);
DLIB_CASSERT(m.num_samples() == v.size());
#ifdef DLIB_USE_CUDA
cuda::scale_rows(out, m, v);
#else
out = scale_rows(mat(m), mat(v));
#endif
}
示例4: scale_columns
void scale_columns (
tensor& out,
const tensor& m,
const tensor& v
)
{
DLIB_CASSERT(have_same_dimensions(out,m));
DLIB_CASSERT(is_vector(v));
if (m.size() == 0 && v.size() == 0)
return;
DLIB_CASSERT(m.size() != 0);
DLIB_CASSERT(m.size()/m.num_samples() == v.size());
#ifdef DLIB_USE_CUDA
cuda::scale_columns(out, m, v);
#else
DLIB_CASSERT(false, "shouldn't be called right now");
out = scale_columns(mat(m), mat(v));
#endif
}
示例5: mat
void scale_rows2 (
float beta,
tensor& out,
const tensor& m1,
const tensor& m2,
const tensor& v1,
const tensor& v2
)
{
DLIB_CASSERT(have_same_dimensions(out,m1));
DLIB_CASSERT(have_same_dimensions(out,m2));
DLIB_CASSERT(have_same_dimensions(v1,v2));
DLIB_CASSERT(is_vector(mat(v1)));
DLIB_CASSERT(v1.size() == m1.num_samples());
#ifdef DLIB_USE_CUDA
cuda::scale_rows2(beta, out, m1, m2, v1, v2);
#else
if (beta == 0)
out = scale_rows(mat(m1) - scale_rows(mat(m2),mat(v1)), mat(v2));
else
out = beta*mat(out) + scale_rows(mat(m1) - scale_rows(mat(m2),mat(v1)), mat(v2));
#endif
}
示例6: result
tensor<T, M> add_apply(tensor<T, M>& a, tensor<T, M>& b) {
tensor<T, M> result(extents[a.size()]);
apply_binary_functor(result, a, b, BF_ADD);
return result;
}