Skip to content

Commit ac866ce

Browse files
authored
Use new APIs in TensorTest.swift (#11248)
1 parent ceaf147 commit ac866ce

File tree

3 files changed

+130
-183
lines changed

3 files changed

+130
-183
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public extension Tensor {
5454
func withUnsafeBytes<T: Scalar, R>(_ body: (UnsafeBufferPointer<T>) throws -> R) throws -> R {
5555
guard dataType == T.dataType else { throw Error(code: .invalidArgument) }
5656
var result: Result<R, Error>?
57-
bytes { pointer, count, _ in
57+
__bytes { pointer, count, _ in
5858
result = Result { try body(
5959
UnsafeBufferPointer(
6060
start: pointer.assumingMemoryBound(to: T.self),
@@ -74,7 +74,7 @@ public extension Tensor {
7474
func withUnsafeMutableBytes<T: Scalar, R>(_ body: (UnsafeMutableBufferPointer<T>) throws -> R) throws -> R {
7575
guard dataType == T.dataType else { throw Error(code: .invalidArgument) }
7676
var result: Result<R, Error>?
77-
mutableBytes { pointer, count, _ in
77+
__mutableBytes { pointer, count, _ in
7878
result = Result { try body(
7979
UnsafeMutableBufferPointer(
8080
start: pointer.assumingMemoryBound(to: T.self),

extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ __attribute__((deprecated("This API is experimental.")))
176176
* - and the data type.
177177
*/
178178
- (void)bytesWithHandler:(NS_NOESCAPE void (^)(const void *pointer, NSInteger count, ExecuTorchDataType dataType))handler
179-
NS_SWIFT_NAME(bytes(_:));
179+
NS_REFINED_FOR_SWIFT;
180180

181181
/**
182182
* Executes a block with a pointer to the tensor's mutable byte data.
@@ -187,7 +187,7 @@ __attribute__((deprecated("This API is experimental.")))
187187
* - and the data type.
188188
*/
189189
- (void)mutableBytesWithHandler:(NS_NOESCAPE void (^)(void *pointer, NSInteger count, ExecuTorchDataType dataType))handler
190-
NS_SWIFT_NAME(mutableBytes(_:));
190+
NS_REFINED_FOR_SWIFT;
191191

192192
/**
193193
* Resizes the tensor to a new shape.

0 commit comments

Comments
 (0)