An intermediate expression of tensor that can be composed into a more complex expression.
An intermediate expression of tensor that can be composed into a more complex expression.
A Tensor that is associated with a non-inline kernel program (i.e.
There are three kinds of Tensor.
@inline def,
which can be merged into a larger kernel
and will be recalculated whenever a slow action is performed.@noinline def,
which is never merged into a larger kernel
and will be recalculated whenever a slow action is performed.lazy val,
which has an associated data buffer on the compute device
and will be calculated only once even when slow actions are performed more than once.
Returns an uninitialized buffer of Element on device.
Returns an uninitialized buffer of Element on device.
Returns a buffer of Element on device whose content is copied from hostBuffer.
Returns a buffer of Element on device whose content is copied from hostBuffer.
Creates single kernel from this Program.
Creates single kernel from this Program.
com.thoughtworks.compute.OpenCL.Exceptions.InvalidValue if the this Program has more than one kernel.
Contains N-dimensional array types on CPU.
You may want to import Tensor, which is the base type of N-dimensional arrays:
import com.thoughtworks.compute.cpu.TensorA Tensor of scalar value can be broadcast to N-dimensional arrays.
Multiple
Tensors of the sameshapecan be merged into a largerTensorvia theTensor.joinfunction. Given aSeqof three 2x2Tensors,when
joining them,val merged: Tensor = Tensor.join(mySubtensors)then the result should be a 2x2x3
Tensor.A
Tensorcan besplitinto smallTensors on the direction of a specific dimension. Given a 3D tensor whoseshapeis 2x3x4,when
splitit at the dimension #0,then the result should be a
Seqof two 3x4 tensors.When
splitit at the dimension #1,then the result should be a
Seqof three 2x4 tensors.In Compute.scala, an N-dimensional array is typed as Tensor, which can be created from scala.collection.Seq or scala.Array.