本文整理汇总了C++中Tensor::HaveSameSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Tensor::HaveSameSize方法的具体用法?C++ Tensor::HaveSameSize怎么用?C++ Tensor::HaveSameSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tensor
的用法示例。
在下文中一共展示了Tensor::HaveSameSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void PoolingLayer<Tensor,T>::BackPropagateTemplateAverage(const Tensor<T>& input, Tensor<T>& dedx_prev)
{
Tensor<T>& de_dx_t = hessian ? this->d2e_dx2_ : this->de_dx_;
assert(dedx_prev.HaveSameSize(input));
for(unsigned n = 0; n < this->out_.d(); n++){
for(unsigned y = 0; y < this->out_.h(); y++){
for(unsigned x = 0; x < this->out_.w(); x++) {
for(UINT syi = 0; syi < this->sy_; ++syi){
for(UINT sxi = 0; sxi < this->sx_; ++sxi){
dedx_prev(x*this->sx_+sxi, y*this->sy_+syi, n) = de_dx_t(x,y,n)/(this->sy_*this->sx_);
}
}
}
}
}
}
示例2: assert
void PoolingLayer<Tensor,T>::BackPropagateTemplateMax(const Tensor<T>& input, Tensor<T>& dedx_prev)
{
Tensor<T>& de_dx_t = hessian ? this->d2e_dx2_ : this->de_dx_;
assert(dedx_prev.HaveSameSize(input));
for(unsigned n = 0; n < this->out_.d(); n++){
for(unsigned y = 0; y < this->out_.h(); y++){
for(unsigned x = 0; x < this->out_.w(); x++) {
for(UINT syi = 0; syi < this->sy_; ++syi){
for(UINT sxi = 0; sxi < this->sx_; ++sxi){
dedx_prev(x*this->sx_+sxi, y*this->sy_+syi, n) =
//Check if this is the input corresponding to max out
input(x*this->sx_+sxi, y*this->sy_+syi, n) == this->out_(x,y,n) ? de_dx_t(x,y,n) : 0;
//TODO: some issues with floats equality test?
}
}
}
}
}
}