forked from kscience/kmath
toDoubleTensor and toIntTensor renaming
This commit is contained in:
parent
8a039326d4
commit
74773686b4
@ -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
|
@ -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())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user