Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(tensor): add validation to check if input can be converted to des…
…ired tensor shape
  • Loading branch information
therealansh committed May 31, 2024
commit f64f61c1c55c2a629f22c0dd1e8f77b1b9c409b7
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public open class TensorFlowInferenceModel(

internal fun FloatData.toTensor(): Tensor<Float> {
val preparedData = serializeToBuffer(floats)
require(preparedData.remaining() == shape.dims().reduce(Long::times).toInt()) {
// TODO: add more details about the shape and how to fix it.
}
return Tensor.create(longArrayOf(1L, *shape.dims()), preparedData)
}

Expand Down