def _proto_float_to_np_array(input: "CoreML.Specification.WeightParams"):
    """Convert input with float values stored in floatValue or float16Value to np array."""
    if len(input.floatValue) > 0:
        return _np.array(input.floatValue)
    elif len(input.float16Value) > 0:
        return _np.frombuffer(input.float16Value, dtype="float16")
    else:
        raise AssertionError(
            "No values found in input. Please make sure either "
            "`floatValue` or `float16Value` of the input is set."
        )
Convert input with float values stored in floatValue or float16Value to np array.
coremltools/models/neural_network/optimization_utils.py