Skip to content

Commit 18fb71d

Browse files
shoumikhinpytorchbot
authored andcommitted
Update using-executorch-ios.md (#13024)
(cherry picked from commit 02d0c7f)
1 parent 29cc070 commit 18fb71d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/source/using-executorch-ios.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -584,11 +584,11 @@ do {
584584
// Execute a potentially different method by name.
585585
let outputs3 = try module.execute("another_method", inputs: [Value(inputTensor1)])
586586
587-
// Process outputs (assuming first output is a tensor).
588-
if let resultTensor = outputs1.first?.tensor {
589-
resultTensor.bytes { ptr, count, dtype in
590-
// Access result data.
591-
}
587+
// Process outputs by converting the first output Value to a typed Tensor<Float>.
588+
if let outputTensor: Tensor<Float> = outputs1.first?.tensor() {
589+
// Now you have a type-safe tensor and can access its data easily.
590+
let logits = try outputTensor.scalars()
591+
print("First 5 logits: \(logits.prefix(5))")
592592
}
593593
} catch {
594594
print("Execution failed: \(error)")

0 commit comments

Comments
 (0)