CopyDense copies a gonum mat.Dense matrix into given Tensor using standard Float64 interface
(to Tensor, dm *mat.Dense)
| 214 | // CopyDense copies a gonum mat.Dense matrix into given Tensor |
| 215 | // using standard Float64 interface |
| 216 | func CopyDense(to Tensor, dm *mat.Dense) { |
| 217 | nr, nc := dm.Dims() |
| 218 | to.SetShape([]int{nr, nc}) |
| 219 | idx := 0 |
| 220 | for ri := 0; ri < nr; ri++ { |
| 221 | for ci := 0; ci < nc; ci++ { |
| 222 | v := dm.At(ri, ci) |
| 223 | to.SetFloat1D(idx, v) |
| 224 | idx++ |
| 225 | } |
| 226 | } |
| 227 | } |