public static DimensionSizes of(TensorType type) {
        Builder b = new Builder(type.rank());
        for (int i = 0; i < type.rank(); i++) {
            if ( type.dimensions().get(i).type() != TensorType.Dimension.Type.indexedBound)
                throw new IllegalArgumentException(type + " contains dimensions without a size");
            b.set(i, type.dimensions().get(i).size().get());
        }
        return b.build();
    }
Create sizes from a type containing bound indexed dimensions only.

@throws IllegalStateException if the type contains dimensions which are not bound and indexed
vespajlib/src/main/java/com/yahoo/tensor/DimensionSizes.java