summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/tensor/functions/CellCast.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/functions/CellCast.java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/functions/CellCast.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/functions/CellCast.java b/vespajlib/src/main/java/com/yahoo/tensor/functions/CellCast.java
index d052e383c85..b6ea0d04a50 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/functions/CellCast.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/functions/CellCast.java
@@ -64,12 +64,13 @@ public class CellCast<NAMETYPE extends Name> extends PrimitiveTensorFunction<NAM
TensorType.Value fromValueType = tensor.type().valueType();
for (Iterator<Tensor.Cell> i = tensor.cellIterator(); i.hasNext(); ) {
Tensor.Cell cell = i.next();
- if (fromValueType == TensorType.Value.FLOAT) {
- builder.cell(cell.getKey(), cell.getFloatValue());
- } else if (fromValueType == TensorType.Value.DOUBLE) {
- builder.cell(cell.getKey(), cell.getDoubleValue());
- } else {
- builder.cell(cell.getKey(), cell.getValue());
+ switch (fromValueType) {
+ case DOUBLE: builder.cell(cell.getKey(), cell.getDoubleValue()); break;
+ case FLOAT: builder.cell(cell.getKey(), cell.getFloatValue()); break;
+ case BFLOAT16: builder.cell(cell.getKey(), cell.getFloatValue()); break;
+ case INT8: builder.cell(cell.getKey(), cell.getFloatValue()); break;
+ default:
+ builder.cell(cell.getKey(), cell.getValue());
}
}
return builder.build();