Two parter, see ml-explore/mlx-swift-lm#616
public func CustomFunction(
@MLXCustomFunctionBuilder.Builder _ build: () -> ([MLXArray]) -> [MLXArray]
) -> ([MLXArray]) -> [MLXArray] {
build()
}
should produce Sendable ouputs -- these are pure functions.
Also VJP:
public func VJP(_ f: @escaping ([MLXArray], [MLXArray]) -> [MLXArray]) -> MLXCustomFunctionComponent
{
.vjp(f)
}
should have a 3 parameter mode with outputs, see:
std::optional<std::function<std::vector<array>(
const std::vector<array>&,
const std::vector<array>&,
const std::vector<array>&)>> fun_vjp /* = std::nullopt */,
this can be used with:
public func depends(input: MLXArray, dependencies: [MLXArray]) -> MLXArray {
Two parter, see ml-explore/mlx-swift-lm#616
should produce Sendable ouputs -- these are pure functions.
Also VJP:
should have a 3 parameter mode with
outputs, see:std::optional<std::function<std::vector<array>( const std::vector<array>&, const std::vector<array>&, const std::vector<array>&)>> fun_vjp /* = std::nullopt */,this can be used with: