Skip to content

Commit c706387

Browse files
authored
Use variadic arguments for execute/forward instead of a single one.
Differential Revision: D79381681 Pull Request resolved: #13088
1 parent 7a1dc2f commit c706387

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

extension/apple/ExecuTorch/Exported/ExecuTorch+Module.swift

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ public extension Module {
6363
try __executeMethod(method, withInputs: inputs.map { $0.asValue() } )
6464
}
6565

66-
/// Executes a specific method with a single input value.
67-
/// The method is loaded on demand if not already loaded.
66+
/// Executes a specific method with variadic inputs.
6867
///
6968
/// - Parameters:
7069
/// - method: The name of the method to execute.
71-
/// - input: A single `ValueConvertible` type representing the input.
70+
/// - inputs: A variadic list of `ValueConvertible` inputs.
7271
/// - Returns: An array of `Value` objects representing the outputs.
73-
/// - Throws: An error if method execution fails.
74-
func execute(_ method: String, _ input: ValueConvertible) throws -> [Value] {
75-
try __executeMethod(method, withInputs: [input.asValue()])
72+
/// - Throws: An error if loading or execution fails.
73+
func execute(_ method: String, _ inputs: ValueConvertible...) throws -> [Value] {
74+
try execute(method, inputs)
7675
}
7776

7877
/// Executes the "forward" method with the provided input values.
@@ -85,13 +84,12 @@ public extension Module {
8584
try __executeMethod("forward", withInputs: inputs.map { $0.asValue() })
8685
}
8786

88-
/// Executes the "forward" method with a single input value.
89-
/// The method is loaded on demand if not already loaded.
87+
/// Executes the "forward" method with variadic inputs.
9088
///
91-
/// - Parameter input: A single `ValueConvertible` type representing the input.
89+
/// - Parameter inputs: A variadic list of `ValueConvertible` inputs.
9290
/// - Returns: An array of `Value` objects representing the outputs.
93-
/// - Throws: An error if method execution fails.
94-
func forward(_ input: ValueConvertible) throws -> [Value] {
95-
try __executeMethod("forward", withInputs: [input.asValue()])
91+
/// - Throws: An error if loading or execution fails.
92+
func forward(_ inputs: ValueConvertible...) throws -> [Value] {
93+
try forward(inputs)
9694
}
9795
}

0 commit comments

Comments
 (0)