private static boolean validHexString(TensorType type, String valueString) {
        long sz = 1;
        for (var d : type.dimensions()) {
            sz *= d.size().orElse(0L);
        }
        int numHexDigits = (int)(sz * 2 * type.valueType().sizeOfCell());
        if (sz == 0
            || type.dimensions().isEmpty()
            || valueString.length() != numHexDigits
            || valueString.chars().anyMatch(ch -> (Character.digit(ch, 16) == -1)))
        {
            return false;
        }
        return true;
    }
Derives the tensor type from the first address string in the given tensor string
vespajlib/src/main/java/com/yahoo/tensor/TensorParser.java