Skip to content

Commit

Permalink
Restrict visibility of per-data type to-binary methods to private
Browse files Browse the repository at this point in the history
  • Loading branch information
agrski committed Apr 5, 2023
1 parent eb801b7 commit e62b1fe
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fun ModelInferResponse.withBinaryContents(): ModelInferResponse {
}
}

fun InferTensorContents.toUint8Bytes(): ByteArray = this.uintContentsList
private fun InferTensorContents.toUint8Bytes(): ByteArray = this.uintContentsList
.flatMap {
ByteBuffer
.allocate(1)
Expand All @@ -84,7 +84,7 @@ fun InferTensorContents.toUint8Bytes(): ByteArray = this.uintContentsList
}
.toByteArray()

fun InferTensorContents.toUint16Bytes(): ByteArray = this.uintContentsList
private fun InferTensorContents.toUint16Bytes(): ByteArray = this.uintContentsList
.flatMap {
ByteBuffer
.allocate(UShort.SIZE_BYTES)
Expand All @@ -94,7 +94,7 @@ fun InferTensorContents.toUint16Bytes(): ByteArray = this.uintContentsList
.toList()
}.toByteArray()

fun InferTensorContents.toUint32Bytes(): ByteArray = this.uintContentsList
private fun InferTensorContents.toUint32Bytes(): ByteArray = this.uintContentsList
.flatMap {
ByteBuffer
.allocate(UInt.SIZE_BYTES)
Expand All @@ -105,7 +105,7 @@ fun InferTensorContents.toUint32Bytes(): ByteArray = this.uintContentsList
}
.toByteArray()

fun InferTensorContents.toUint64Bytes(): ByteArray = this.uint64ContentsList
private fun InferTensorContents.toUint64Bytes(): ByteArray = this.uint64ContentsList
.flatMap {
ByteBuffer
.allocate(ULong.SIZE_BYTES)
Expand All @@ -116,7 +116,7 @@ fun InferTensorContents.toUint64Bytes(): ByteArray = this.uint64ContentsList
}
.toByteArray()

fun InferTensorContents.toInt8Bytes(): ByteArray = this.intContentsList
private fun InferTensorContents.toInt8Bytes(): ByteArray = this.intContentsList
.flatMap {
ByteBuffer
.allocate(1)
Expand All @@ -126,7 +126,7 @@ fun InferTensorContents.toInt8Bytes(): ByteArray = this.intContentsList
}
.toByteArray()

fun InferTensorContents.toInt16Bytes(): ByteArray = this.intContentsList
private fun InferTensorContents.toInt16Bytes(): ByteArray = this.intContentsList
.flatMap {
ByteBuffer
.allocate(Short.SIZE_BYTES)
Expand All @@ -137,7 +137,7 @@ fun InferTensorContents.toInt16Bytes(): ByteArray = this.intContentsList
}
.toByteArray()

fun InferTensorContents.toInt32Bytes(): ByteArray = this.intContentsList
private fun InferTensorContents.toInt32Bytes(): ByteArray = this.intContentsList
.flatMap {
ByteBuffer
.allocate(Int.SIZE_BYTES)
Expand All @@ -148,7 +148,7 @@ fun InferTensorContents.toInt32Bytes(): ByteArray = this.intContentsList
}
.toByteArray()

fun InferTensorContents.toInt64Bytes(): ByteArray = this.int64ContentsList
private fun InferTensorContents.toInt64Bytes(): ByteArray = this.int64ContentsList
.flatMap {
ByteBuffer
.allocate(Long.SIZE_BYTES)
Expand All @@ -159,7 +159,7 @@ fun InferTensorContents.toInt64Bytes(): ByteArray = this.int64ContentsList
}
.toByteArray()

fun InferTensorContents.toFp32Bytes(): ByteArray = this.fp32ContentsList
private fun InferTensorContents.toFp32Bytes(): ByteArray = this.fp32ContentsList
.flatMap {
ByteBuffer
.allocate(Float.SIZE_BYTES)
Expand All @@ -170,7 +170,7 @@ fun InferTensorContents.toFp32Bytes(): ByteArray = this.fp32ContentsList
}
.toByteArray()

fun InferTensorContents.toFp64Bytes(): ByteArray = this.fp64ContentsList
private fun InferTensorContents.toFp64Bytes(): ByteArray = this.fp64ContentsList
.flatMap {
ByteBuffer
.allocate(Double.SIZE_BYTES)
Expand All @@ -181,7 +181,7 @@ fun InferTensorContents.toFp64Bytes(): ByteArray = this.fp64ContentsList
}
.toByteArray()

fun InferTensorContents.toBoolBytes(): ByteArray = this.boolContentsList
private fun InferTensorContents.toBoolBytes(): ByteArray = this.boolContentsList
.flatMap {
ByteBuffer
.allocate(1)
Expand All @@ -191,7 +191,7 @@ fun InferTensorContents.toBoolBytes(): ByteArray = this.boolContentsList
}
.toByteArray()

fun InferTensorContents.toRawBytes(): ByteArray = this.bytesContentsList
private fun InferTensorContents.toRawBytes(): ByteArray = this.bytesContentsList
.flatMap {
ByteBuffer
.allocate(it.size() + Int.SIZE_BYTES)
Expand Down

0 comments on commit e62b1fe

Please sign in to comment.