You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`TensorView` is both memory-efficient and speed-efficient since it only creates ways to view array data as multidimensional tensors **without** actually creating new arrays. One can nevertheless explicitly store a TensorView instance as a single-dimensional or multi-dimensional array using `view.toArray()` or `view.toNDArray()` methods.
10
10
@@ -78,8 +78,8 @@ true
78
78
constview=TensorView(data, options);
79
79
80
80
constdata=view.data(); // underlying data of view
81
-
constarray=view.toArray(ArrayClass=Array); // create single-dimensional array or typed array from view
82
-
constndarray=view.toNDArray(); // create multi-dimensional array from view having the same shape
81
+
constarray=view.toArray(ArrayClass=Array, order="row-major"); // create single-dimensional array or typed array from view
82
+
constndarray=view.toNDArray(order="row-major"); // create multi-dimensional array from view having the same shape
83
83
conststring=view.toString(); // render view to string
84
84
constdim=view.dimension(); // dimension of view, eg 1 for 1d, 2 for 2d, 3 for 3d, ..
85
85
constshape=view.shape(); // shape of view along all dimensions
@@ -99,7 +99,7 @@ const value = view.get(indices); // get value based on indices of same dimension
99
99
view.set(indices, value); // set value at indices
100
100
// NOTE: underlying data will change in all views which use this data and all views which depend on views which use this data
101
101
102
-
view.forEach(function(data_i, i, data, view) {/*..*/}); // forEach method
102
+
view.forEach(function(data_i, i, data, view) {/*..*/}, order="row-major"); // forEach method
103
103
for (let [data_i, i] of view) {/*..*/} // similar as iterator protocol
104
104
105
105
view.op(op, otherView=null); // apply lazy, when requested, pointwise operation op(view, otherView) or op(view)
0 commit comments