v0.3.0-dev-9 #324

Merged
altavir merged 265 commits from dev into master 2021-05-08 17:16:29 +03:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 74773686b4 - Show all commits

View File

@ -77,5 +77,5 @@ internal val TensorStructure<Int>.tensor: IntTensor
else -> this.toBufferedTensor().asTensor() else -> this.toBufferedTensor().asTensor()
} }
public fun TensorStructure<Double>.toTypedTensor(): DoubleTensor = this.tensor public fun TensorStructure<Double>.toDoubleTensor(): DoubleTensor = this.tensor
public fun TensorStructure<Int>.toTypedTensor(): IntTensor = 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 bufferedTensorArray = ndArray.toBufferedTensor() // strides are flipped so data copied
val tensorArray = bufferedTensorArray.asTensor() // data not contiguous so copied again val tensorArray = bufferedTensorArray.asTensor() // data not contiguous so copied again
val tensorArrayPublic = ndArray.toTypedTensor() // public API, data copied twice val tensorArrayPublic = ndArray.toDoubleTensor() // public API, data copied twice
val sharedTensorArray = tensorArrayPublic.toTypedTensor() // no data copied by matching type val sharedTensorArray = tensorArrayPublic.toDoubleTensor() // no data copied by matching type
assertTrue(tensorArray.mutableBuffer.array() contentEquals sharedTensorArray.mutableBuffer.array()) assertTrue(tensorArray.mutableBuffer.array() contentEquals sharedTensorArray.mutableBuffer.array())