| 113 | } |
| 114 | |
| 115 | void scale_columns ( |
| 116 | tensor& out, |
| 117 | const tensor& m, |
| 118 | const tensor& v |
| 119 | ) |
| 120 | { |
| 121 | DLIB_CASSERT(have_same_dimensions(out,m)); |
| 122 | DLIB_CASSERT(is_vector(v)); |
| 123 | if (m.size() == 0 && v.size() == 0) |
| 124 | return; |
| 125 | DLIB_CASSERT(m.size() != 0); |
| 126 | DLIB_CASSERT(m.size()/m.num_samples() == v.size()); |
| 127 | |
| 128 | IF_DLIB_USE_CUDA( |
| 129 | cuda::scale_columns(out, m, v); |
| 130 | ) |
| 131 | |
| 132 | IF_DLIB_NOT_USE_CUDA( |
| 133 | out = scale_columns(mat(m), mat(v)); |
| 134 | ) |
| 135 | } |
| 136 | |
| 137 | void scale_rows ( |
| 138 | tensor& out, |