File: dense_views.go

package info (click to toggle)
golang-github-gorgonia-tensor 0.9.24-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,696 kB
  • sloc: sh: 18; asm: 18; makefile: 8
file content (17 lines) | stat: -rw-r--r-- 506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package tensor

// a View is a *Tensor with customized strides. The reason for not splitting them up into different types is complicated
// this file contains all the methods that deals with Views

// Materialize takes a view, copies its data and puts it in a new *Tensor.
func (t *Dense) Materialize() Tensor {
	if !t.IsMaterializable() {
		return t
	}

	retVal := recycledDense(t.t, t.shape.Clone(), WithEngine(t.e))
	copyDenseIter(retVal, t, nil, nil)
	retVal.e = t.e
	retVal.oe = t.oe
	return retVal
}