v0.3.0-dev-9 #324
@ -77,5 +77,5 @@ internal val TensorStructure<Int>.tensor: IntTensor
|
||||
else -> this.toBufferedTensor().asTensor()
|
||||
}
|
||||
|
||||
public fun TensorStructure<Double>.toTypedTensor(): DoubleTensor = this.tensor
|
||||
public fun TensorStructure<Int>.toTypedTensor(): IntTensor = this.tensor
|
||||
public fun TensorStructure<Double>.toDoubleTensor(): DoubleTensor = this.tensor
|
||||
public fun TensorStructure<Int>.toIntTensor(): IntTensor = this.tensor
|
@ -67,8 +67,8 @@ internal class TestDoubleTensor {
|
||||
val bufferedTensorArray = ndArray.toBufferedTensor() // strides are flipped so data copied
|
||||
val tensorArray = bufferedTensorArray.asTensor() // data not contiguous so copied again
|
||||
|
||||
val tensorArrayPublic = ndArray.toTypedTensor() // public API, data copied twice
|
||||
val sharedTensorArray = tensorArrayPublic.toTypedTensor() // no data copied by matching type
|
||||
val tensorArrayPublic = ndArray.toDoubleTensor() // public API, data copied twice
|
||||
val sharedTensorArray = tensorArrayPublic.toDoubleTensor() // no data copied by matching type
|
||||
|
||||
assertTrue(tensorArray.mutableBuffer.array() contentEquals sharedTensorArray.mutableBuffer.array())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user