String toString(ToStringContext<NAMETYPE> context, Slice<NAMETYPE> owner) {
            StringBuilder b = new StringBuilder();
            Optional<String> dimensionName = dimension;
            if (context != null && dimensionName.isEmpty()) { // This isn't just toString(): Output canonical form or fail
                TensorType type = context.typeContext().isPresent() ? owner.argument.type(context.typeContext().get()) : null;
                if (type == null || type.dimensions().size() != 1)
                    throw new IllegalArgumentException("The tensor dimension name being sliced by " + owner +
                                                       " cannot be uniquely resolved. Use the full form: " +
                                                       "'slice{myDimensionName:" + valueToString(context) + "}'");
                else
                    dimensionName = Optional.of(type.dimensions().get(0).name());
            }
            dimensionName.ifPresent(d -> b.append(d).append(":"));
            b.append(valueToString(context));
            return b.toString();
        }
Returns the index expression for this dimension, or empty if it is not a number
vespajlib/src/main/java/com/yahoo/tensor/functions/Slice.java