| 1 |
package tensor |
| 2 |
|
| 3 |
// a View is a *Tensor with customized strides. The reason for not splitting them up into different types is complicated |
| 4 |
// this file contains all the methods that deals with Views |
| 5 |
|
| 6 |
// Materialize takes a view, copies its data and puts it in a new *Tensor. |
| 7 |
func (t *Dense) Materialize() Tensor { |
| 8 |
if !t.IsMaterializable() { |
| 9 |
return t |
| 10 |
} |
| 11 |
|
| 12 |
retVal := recycledDense(t.t, t.shape.Clone(), WithEngine(t.e)) |
| 13 |
copyDenseIter(retVal, t, nil, nil) |
| 14 |
retVal.e = t.e |
| 15 |
retVal.oe = t.oe |
| 16 |
return retVal |
| 17 |
} |