v0.3.0-dev-9 #324
@ -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")
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user