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 10 additions and 1 deletions
Showing only changes of commit 4aa1df0628 - Show all commits

View File

@ -14,8 +14,12 @@ public class RealTensor(
TensorStrides(shape),
RealBuffer(buffer)
) {
override fun item(): Double = buffer[0]
override fun item(): Double {
check(buffer.size > 0) { "The tensor is empty" }
return buffer[0]
}
}
public class RealTensorAlgebra : TensorPartialDivisionAlgebra<Double, RealTensor> {
@ -116,6 +120,10 @@ public class RealTensorAlgebra : TensorPartialDivisionAlgebra<Double, RealTensor
TODO("Not yet implemented")
}
override fun RealTensor.view_as(other: RealTensor): RealTensor {
TODO("Not yet implemented")
}
override fun RealTensor.abs(): RealTensor {
TODO("Not yet implemented")
}

View File

@ -40,6 +40,7 @@ public interface TensorAlgebra<T, TensorType : TensorStructure<T>>{
//https://pytorch.org/docs/stable/tensor_view.html
public fun TensorType.view(shape: IntArray): TensorType
public fun TensorType.view_as(other: TensorType): TensorType
//https://pytorch.org/docs/stable/generated/torch.abs.html
public fun TensorType.abs(): TensorType