private PrimitiveTensorFunction<NAMETYPE> toPrimitive(String dimension) {
        TensorType type = new TensorType.Builder(TensorType.Value.INT8).indexed(dimension, 1).build();
        Generate<NAMETYPE> expansion = new Generate<>(type, ScalarFunctions.constant(1.0));
        return new Join<>(expansion, argument, ScalarFunctions.multiply());
    }
The <i>expand</i> tensor function returns a tensor with a new dimension of
size 1 is added, equivalent to "tensor * tensor(dim_name[1])(1)".

@author lesters
vespajlib/src/main/java/com/yahoo/tensor/functions/Expand.java