File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
src/main/scala/com/thoughtworks/compute Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,5 @@ libraryDependencies += "com.github.ghik" %% "silencer-lib" % "0.6"
24
24
libraryDependencies += " ch.qos.logback" % " logback-classic" % " 1.2.3" % Test
25
25
26
26
fork in Test := true
27
+
28
+ enablePlugins(Example )
Original file line number Diff line number Diff line change @@ -768,7 +768,18 @@ trait Tensors extends OpenCL {
768
768
} with InlineTensor
769
769
}
770
770
771
- /**
771
+ /** Returns a new [[Tensor ]] of new shape and the same data of this [[Tensor ]].
772
+ *
773
+ * @note The data in this [[Tensor ]] is considered as row-major order when [[reshape ]].
774
+ *
775
+ * You can create another column-major version reshape by reversing the shape:
776
+ *
777
+ * {{{
778
+ * def columnMajorReshape[Category <: Tensors](tensor: Category#Tensor, newShape: Array[Int]): Category#Tensor = {
779
+ * tensor.permute(tensor.shape.indices.reverse.toArray).reshape(newShape.reverse).permute(newShape.indices.reverse.toArray)
780
+ * }
781
+ * }}}
782
+ *
772
783
* @group delayed
773
784
*/
774
785
def reshape (newShape : Array [Int ]): NonInlineTensor = {
@@ -996,7 +1007,9 @@ trait Tensors extends OpenCL {
996
1007
997
1008
private [compute] def doBuffer : Do [PendingBuffer [closure.JvmValue ]]
998
1009
999
- /**
1010
+ /** Returns a RAII managed asynchronous task to read this [[Tensor ]] into an off-heap memory,
1011
+ * which is linearized in row-majoy order.
1012
+ *
1000
1013
* @group slow
1001
1014
*/
1002
1015
def flatBuffer : Do [FloatBuffer ] = {
@@ -1011,7 +1024,9 @@ trait Tensors extends OpenCL {
1011
1024
}
1012
1025
}
1013
1026
1014
- /**
1027
+ /** Returns an asynchronous task to read this [[Tensor ]] into a [[scala.Array ]],
1028
+ * which is linearized in row-majoy order.
1029
+ *
1015
1030
* @group slow
1016
1031
*/
1017
1032
def flatArray : Future [Array [closure.JvmValue ]] = {
You can’t perform that action at this time.
0 commit comments