diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h b/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h index 92131bf825e..1be47b42bbd 100644 --- a/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h @@ -692,7 +692,8 @@ __attribute__((deprecated("This API is experimental."))) strides:(NSArray *)strides dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(empty(shape:strides:dataType:shapeDynamism:)); + NS_SWIFT_NAME(empty(shape:strides:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates an empty tensor with the specified shape, data type, and shape dynamism. @@ -705,7 +706,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)emptyTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(empty(shape:dataType:shapeDynamism:)); + NS_SWIFT_NAME(empty(shape:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates an empty tensor with the specified shape and data type, using dynamic bound shape. @@ -716,7 +718,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)emptyTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(empty(shape:dataType:)); + NS_SWIFT_NAME(empty(shape:dataType:)) + NS_RETURNS_RETAINED; /** * Creates an empty tensor similar to the given tensor, with the specified data type and shape dynamism. @@ -729,7 +732,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)emptyTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(empty(like:dataType:shapeDynamism:)); + NS_SWIFT_NAME(empty(like:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates an empty tensor similar to the given tensor, with the specified data type. @@ -740,7 +744,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)emptyTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(empty(like:dataType:)); + NS_SWIFT_NAME(empty(like:dataType:)) + NS_RETURNS_RETAINED; /** * Creates an empty tensor similar to the given tensor. @@ -749,7 +754,8 @@ __attribute__((deprecated("This API is experimental."))) * @return A new, empty ExecuTorchTensor instance with the same properties as the provided tensor. */ + (instancetype)emptyTensorLikeTensor:(ExecuTorchTensor *)tensor - NS_SWIFT_NAME(empty(like:)); + NS_SWIFT_NAME(empty(like:)) + NS_RETURNS_RETAINED; @end @@ -772,7 +778,8 @@ __attribute__((deprecated("This API is experimental."))) strides:(NSArray *)strides dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(full(shape:scalar:strides:dataType:shapeDynamism:)); + NS_SWIFT_NAME(full(shape:scalar:strides:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with the specified scalar value, with the given shape, data type, and shape dynamism. @@ -787,7 +794,8 @@ __attribute__((deprecated("This API is experimental."))) scalar:(NSNumber *)scalar dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(full(shape:scalar:dataType:shapeDynamism:)); + NS_SWIFT_NAME(full(shape:scalar:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with the specified scalar value, with the given shape and data type, @@ -801,7 +809,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)fullTensorWithShape:(NSArray *)shape scalar:(NSNumber *)scalar dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(full(shape:scalar:dataType:)); + NS_SWIFT_NAME(full(shape:scalar:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with the specified scalar value, similar to an existing tensor, with the given data type and shape dynamism. @@ -816,7 +825,8 @@ __attribute__((deprecated("This API is experimental."))) scalar:(NSNumber *)scalar dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(full(like:scalar:dataType:shapeDynamism:)); + NS_SWIFT_NAME(full(like:scalar:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with the specified scalar value, similar to an existing tensor, with the given data type. @@ -829,7 +839,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)fullTensorLikeTensor:(ExecuTorchTensor *)tensr scalar:(NSNumber *)scalar dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(full(like:scalar:dataType:)); + NS_SWIFT_NAME(full(like:scalar:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with the specified scalar value, similar to an existing tensor. @@ -840,7 +851,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)fullTensorLikeTensor:(ExecuTorchTensor *)tensr scalar:(NSNumber *)scalar - NS_SWIFT_NAME(full(like:scalar:)); + NS_SWIFT_NAME(full(like:scalar:)) + NS_RETURNS_RETAINED; @end @@ -859,7 +871,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)onesTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(ones(shape:dataType:shapeDynamism:)); + NS_SWIFT_NAME(ones(shape:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with ones, with the specified shape and data type. @@ -870,7 +883,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)onesTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(ones(shape:dataType:)); + NS_SWIFT_NAME(ones(shape:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with ones similar to an existing tensor, with the specified data type and shape dynamism. @@ -883,7 +897,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)onesTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(ones(like:dataType:shapeDynamism:)); + NS_SWIFT_NAME(ones(like:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with ones similar to an existing tensor, with the specified data type. @@ -894,7 +909,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)onesTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(ones(like:dataType:)); + NS_SWIFT_NAME(ones(like:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with ones similar to an existing tensor. @@ -903,7 +919,8 @@ __attribute__((deprecated("This API is experimental."))) * @return A new ExecuTorchTensor instance filled with ones. */ + (instancetype)onesTensorLikeTensor:(ExecuTorchTensor *)tensor - NS_SWIFT_NAME(ones(like:)); + NS_SWIFT_NAME(ones(like:)) + NS_RETURNS_RETAINED; @end @@ -922,7 +939,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)zerosTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(zeros(shape:dataType:shapeDynamism:)); + NS_SWIFT_NAME(zeros(shape:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with zeros, with the specified shape and data type. @@ -933,7 +951,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)zerosTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(zeros(shape:dataType:)); + NS_SWIFT_NAME(zeros(shape:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with zeros similar to an existing tensor, with the specified data type and shape dynamism. @@ -946,7 +965,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)zerosTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(zeros(like:dataType:shapeDynamism:)); + NS_SWIFT_NAME(zeros(like:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with zeros similar to an existing tensor, with the specified data type. @@ -957,7 +977,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)zerosTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(zeros(like:dataType:)); + NS_SWIFT_NAME(zeros(like:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor filled with zeros similar to an existing tensor. @@ -966,7 +987,8 @@ __attribute__((deprecated("This API is experimental."))) * @return A new ExecuTorchTensor instance filled with zeros. */ + (instancetype)zerosTensorLikeTensor:(ExecuTorchTensor *)tensor - NS_SWIFT_NAME(zeros(like:)); + NS_SWIFT_NAME(zeros(like:)) + NS_RETURNS_RETAINED; @end @@ -987,7 +1009,8 @@ __attribute__((deprecated("This API is experimental."))) strides:(NSArray *)strides dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(rand(shape:strides:dataType:shapeDynamism:)); + NS_SWIFT_NAME(rand(shape:strides:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random values, with the specified shape and data type. @@ -1000,7 +1023,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)randomTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(rand(shape:dataType:shapeDynamism:)); + NS_SWIFT_NAME(rand(shape:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random values, with the specified shape (using dynamic bound shape) and data type. @@ -1011,7 +1035,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)randomTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(rand(shape:dataType:)); + NS_SWIFT_NAME(rand(shape:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random values similar to an existing tensor, with the specified data type and shape dynamism. @@ -1024,7 +1049,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)randomTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(rand(like:dataType:shapeDynamism:)); + NS_SWIFT_NAME(rand(like:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random values similar to an existing tensor, with the specified data type. @@ -1035,7 +1061,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)randomTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(rand(like:dataType:)); + NS_SWIFT_NAME(rand(like:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random values similar to an existing tensor. @@ -1044,7 +1071,8 @@ __attribute__((deprecated("This API is experimental."))) * @return A new ExecuTorchTensor instance filled with random values. */ + (instancetype)randomTensorLikeTensor:(ExecuTorchTensor *)tensor - NS_SWIFT_NAME(rand(like:)); + NS_SWIFT_NAME(rand(like:)) + NS_RETURNS_RETAINED; @end @@ -1066,7 +1094,8 @@ __attribute__((deprecated("This API is experimental."))) strides:(NSArray *)strides dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(randn(shape:strides:dataType:shapeDynamism:)); + NS_SWIFT_NAME(randn(shape:strides:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random values drawn from a normal distribution, @@ -1080,7 +1109,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)randomNormalTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(randn(shape:dataType:shapeDynamism:)); + NS_SWIFT_NAME(randn(shape:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random values drawn from a normal distribution, @@ -1092,7 +1122,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)randomNormalTensorWithShape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(randn(shape:dataType:)); + NS_SWIFT_NAME(randn(shape:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random normal values similar to an existing tensor, @@ -1106,7 +1137,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)randomNormalTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(randn(like:dataType:shapeDynamism:)); + NS_SWIFT_NAME(randn(like:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random normal values similar to an existing tensor, @@ -1118,7 +1150,8 @@ __attribute__((deprecated("This API is experimental."))) */ + (instancetype)randomNormalTensorLikeTensor:(ExecuTorchTensor *)tensor dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(randn(like:dataType:)); + NS_SWIFT_NAME(randn(like:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random normal values similar to an existing tensor. @@ -1127,7 +1160,8 @@ __attribute__((deprecated("This API is experimental."))) * @return A new ExecuTorchTensor instance filled with values from a normal distribution. */ + (instancetype)randomNormalTensorLikeTensor:(ExecuTorchTensor *)tensor - NS_SWIFT_NAME(randn(like:)); + NS_SWIFT_NAME(randn(like:)) + NS_RETURNS_RETAINED; @end @@ -1153,7 +1187,8 @@ __attribute__((deprecated("This API is experimental."))) strides:(NSArray *)strides dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(randint(low:high:shape:strides:dataType:shapeDynamism:)); + NS_SWIFT_NAME(randint(low:high:shape:strides:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random integer values in the specified range, @@ -1171,7 +1206,8 @@ __attribute__((deprecated("This API is experimental."))) shape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(randint(low:high:shape:dataType:shapeDynamism:)); + NS_SWIFT_NAME(randint(low:high:shape:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random integer values in the specified range, @@ -1187,7 +1223,8 @@ __attribute__((deprecated("This API is experimental."))) high:(NSInteger)high shape:(NSArray *)shape dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(randint(low:high:shape:dataType:)); + NS_SWIFT_NAME(randint(low:high:shape:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random integer values in the specified range, similar to an existing tensor, @@ -1205,7 +1242,8 @@ __attribute__((deprecated("This API is experimental."))) high:(NSInteger)high dataType:(ExecuTorchDataType)dataType shapeDynamism:(ExecuTorchShapeDynamism)shapeDynamism - NS_SWIFT_NAME(randint(like:low:high:dataType:shapeDynamism:)); + NS_SWIFT_NAME(randint(like:low:high:dataType:shapeDynamism:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random integer values in the specified range, similar to an existing tensor, @@ -1221,7 +1259,8 @@ __attribute__((deprecated("This API is experimental."))) low:(NSInteger)low high:(NSInteger)high dataType:(ExecuTorchDataType)dataType - NS_SWIFT_NAME(randint(like:low:high:dataType:)); + NS_SWIFT_NAME(randint(like:low:high:dataType:)) + NS_RETURNS_RETAINED; /** * Creates a tensor with random integer values in the specified range, similar to an existing tensor. @@ -1234,7 +1273,8 @@ __attribute__((deprecated("This API is experimental."))) + (instancetype)randomIntegerTensorLikeTensor:(ExecuTorchTensor *)tensor low:(NSInteger)low high:(NSInteger)high - NS_SWIFT_NAME(randint(like:low:high:)); + NS_SWIFT_NAME(randint(like:low:high:)) + NS_RETURNS_RETAINED; @end