toDoubleTensor and toIntTensor renaming

This commit is contained in:
Roland Grinis 2021-04-30 19:49:43 +01:00
parent 8a039326d4
commit 74773686b4
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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())