@@ -692,7 +692,8 @@ __attribute__((deprecated("This API is experimental.")))
692692 strides : (NSArray <NSNumber *> *)strides
693693 dataType : (ExecuTorchDataType)dataType
694694 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
695- NS_SWIFT_NAME(empty(shape:strides:dataType:shapeDynamism:));
695+ NS_SWIFT_NAME(empty(shape:strides:dataType:shapeDynamism:))
696+ NS_RETURNS_RETAINED;
696697
697698/* *
698699 * Creates an empty tensor with the specified shape, data type, and shape dynamism.
@@ -705,7 +706,8 @@ __attribute__((deprecated("This API is experimental.")))
705706+ (instancetype )emptyTensorWithShape : (NSArray <NSNumber *> *)shape
706707 dataType : (ExecuTorchDataType)dataType
707708 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
708- NS_SWIFT_NAME(empty(shape:dataType:shapeDynamism:));
709+ NS_SWIFT_NAME(empty(shape:dataType:shapeDynamism:))
710+ NS_RETURNS_RETAINED;
709711
710712/* *
711713 * 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.")))
716718 */
717719+ (instancetype )emptyTensorWithShape : (NSArray <NSNumber *> *)shape
718720 dataType : (ExecuTorchDataType)dataType
719- NS_SWIFT_NAME(empty(shape:dataType:));
721+ NS_SWIFT_NAME(empty(shape:dataType:))
722+ NS_RETURNS_RETAINED;
720723
721724/* *
722725 * 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.")))
729732+ (instancetype )emptyTensorLikeTensor : (ExecuTorchTensor *)tensor
730733 dataType : (ExecuTorchDataType)dataType
731734 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
732- NS_SWIFT_NAME(empty(like:dataType:shapeDynamism:));
735+ NS_SWIFT_NAME(empty(like:dataType:shapeDynamism:))
736+ NS_RETURNS_RETAINED;
733737
734738/* *
735739 * Creates an empty tensor similar to the given tensor, with the specified data type.
@@ -740,7 +744,8 @@ __attribute__((deprecated("This API is experimental.")))
740744 */
741745+ (instancetype )emptyTensorLikeTensor : (ExecuTorchTensor *)tensor
742746 dataType : (ExecuTorchDataType)dataType
743- NS_SWIFT_NAME(empty(like:dataType:));
747+ NS_SWIFT_NAME(empty(like:dataType:))
748+ NS_RETURNS_RETAINED;
744749
745750/* *
746751 * Creates an empty tensor similar to the given tensor.
@@ -749,7 +754,8 @@ __attribute__((deprecated("This API is experimental.")))
749754 * @return A new, empty ExecuTorchTensor instance with the same properties as the provided tensor.
750755 */
751756+ (instancetype )emptyTensorLikeTensor : (ExecuTorchTensor *)tensor
752- NS_SWIFT_NAME(empty(like:));
757+ NS_SWIFT_NAME(empty(like:))
758+ NS_RETURNS_RETAINED;
753759
754760@end
755761
@@ -772,7 +778,8 @@ __attribute__((deprecated("This API is experimental.")))
772778 strides : (NSArray <NSNumber *> *)strides
773779 dataType : (ExecuTorchDataType)dataType
774780 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
775- NS_SWIFT_NAME(full(shape:scalar:strides:dataType:shapeDynamism:));
781+ NS_SWIFT_NAME(full(shape:scalar:strides:dataType:shapeDynamism:))
782+ NS_RETURNS_RETAINED;
776783
777784/* *
778785 * 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.")))
787794 scalar : (NSNumber *)scalar
788795 dataType : (ExecuTorchDataType)dataType
789796 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
790- NS_SWIFT_NAME(full(shape:scalar:dataType:shapeDynamism:));
797+ NS_SWIFT_NAME(full(shape:scalar:dataType:shapeDynamism:))
798+ NS_RETURNS_RETAINED;
791799
792800/* *
793801 * 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.")))
801809+ (instancetype )fullTensorWithShape : (NSArray <NSNumber *> *)shape
802810 scalar : (NSNumber *)scalar
803811 dataType : (ExecuTorchDataType)dataType
804- NS_SWIFT_NAME(full(shape:scalar:dataType:));
812+ NS_SWIFT_NAME(full(shape:scalar:dataType:))
813+ NS_RETURNS_RETAINED;
805814
806815/* *
807816 * 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.")))
816825 scalar : (NSNumber *)scalar
817826 dataType : (ExecuTorchDataType)dataType
818827 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
819- NS_SWIFT_NAME(full(like:scalar:dataType:shapeDynamism:));
828+ NS_SWIFT_NAME(full(like:scalar:dataType:shapeDynamism:))
829+ NS_RETURNS_RETAINED;
820830
821831/* *
822832 * 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.")))
829839+ (instancetype )fullTensorLikeTensor : (ExecuTorchTensor *)tensr
830840 scalar : (NSNumber *)scalar
831841 dataType : (ExecuTorchDataType)dataType
832- NS_SWIFT_NAME(full(like:scalar:dataType:));
842+ NS_SWIFT_NAME(full(like:scalar:dataType:))
843+ NS_RETURNS_RETAINED;
833844
834845/* *
835846 * Creates a tensor filled with the specified scalar value, similar to an existing tensor.
@@ -840,7 +851,8 @@ __attribute__((deprecated("This API is experimental.")))
840851 */
841852+ (instancetype )fullTensorLikeTensor : (ExecuTorchTensor *)tensr
842853 scalar : (NSNumber *)scalar
843- NS_SWIFT_NAME(full(like:scalar:));
854+ NS_SWIFT_NAME(full(like:scalar:))
855+ NS_RETURNS_RETAINED;
844856
845857@end
846858
@@ -859,7 +871,8 @@ __attribute__((deprecated("This API is experimental.")))
859871+ (instancetype )onesTensorWithShape : (NSArray <NSNumber *> *)shape
860872 dataType : (ExecuTorchDataType)dataType
861873 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
862- NS_SWIFT_NAME(ones(shape:dataType:shapeDynamism:));
874+ NS_SWIFT_NAME(ones(shape:dataType:shapeDynamism:))
875+ NS_RETURNS_RETAINED;
863876
864877/* *
865878 * Creates a tensor filled with ones, with the specified shape and data type.
@@ -870,7 +883,8 @@ __attribute__((deprecated("This API is experimental.")))
870883 */
871884+ (instancetype )onesTensorWithShape : (NSArray <NSNumber *> *)shape
872885 dataType : (ExecuTorchDataType)dataType
873- NS_SWIFT_NAME(ones(shape:dataType:));
886+ NS_SWIFT_NAME(ones(shape:dataType:))
887+ NS_RETURNS_RETAINED;
874888
875889/* *
876890 * 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.")))
883897+ (instancetype )onesTensorLikeTensor : (ExecuTorchTensor *)tensor
884898 dataType : (ExecuTorchDataType)dataType
885899 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
886- NS_SWIFT_NAME(ones(like:dataType:shapeDynamism:));
900+ NS_SWIFT_NAME(ones(like:dataType:shapeDynamism:))
901+ NS_RETURNS_RETAINED;
887902
888903/* *
889904 * 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.")))
894909 */
895910+ (instancetype )onesTensorLikeTensor : (ExecuTorchTensor *)tensor
896911 dataType : (ExecuTorchDataType)dataType
897- NS_SWIFT_NAME(ones(like:dataType:));
912+ NS_SWIFT_NAME(ones(like:dataType:))
913+ NS_RETURNS_RETAINED;
898914
899915/* *
900916 * Creates a tensor filled with ones similar to an existing tensor.
@@ -903,7 +919,8 @@ __attribute__((deprecated("This API is experimental.")))
903919 * @return A new ExecuTorchTensor instance filled with ones.
904920 */
905921+ (instancetype )onesTensorLikeTensor : (ExecuTorchTensor *)tensor
906- NS_SWIFT_NAME(ones(like:));
922+ NS_SWIFT_NAME(ones(like:))
923+ NS_RETURNS_RETAINED;
907924
908925@end
909926
@@ -922,7 +939,8 @@ __attribute__((deprecated("This API is experimental.")))
922939+ (instancetype )zerosTensorWithShape : (NSArray <NSNumber *> *)shape
923940 dataType : (ExecuTorchDataType)dataType
924941 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
925- NS_SWIFT_NAME(zeros(shape:dataType:shapeDynamism:));
942+ NS_SWIFT_NAME(zeros(shape:dataType:shapeDynamism:))
943+ NS_RETURNS_RETAINED;
926944
927945/* *
928946 * Creates a tensor filled with zeros, with the specified shape and data type.
@@ -933,7 +951,8 @@ __attribute__((deprecated("This API is experimental.")))
933951 */
934952+ (instancetype )zerosTensorWithShape : (NSArray <NSNumber *> *)shape
935953 dataType : (ExecuTorchDataType)dataType
936- NS_SWIFT_NAME(zeros(shape:dataType:));
954+ NS_SWIFT_NAME(zeros(shape:dataType:))
955+ NS_RETURNS_RETAINED;
937956
938957/* *
939958 * 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.")))
946965+ (instancetype )zerosTensorLikeTensor : (ExecuTorchTensor *)tensor
947966 dataType : (ExecuTorchDataType)dataType
948967 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
949- NS_SWIFT_NAME(zeros(like:dataType:shapeDynamism:));
968+ NS_SWIFT_NAME(zeros(like:dataType:shapeDynamism:))
969+ NS_RETURNS_RETAINED;
950970
951971/* *
952972 * 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.")))
957977 */
958978+ (instancetype )zerosTensorLikeTensor : (ExecuTorchTensor *)tensor
959979 dataType : (ExecuTorchDataType)dataType
960- NS_SWIFT_NAME(zeros(like:dataType:));
980+ NS_SWIFT_NAME(zeros(like:dataType:))
981+ NS_RETURNS_RETAINED;
961982
962983/* *
963984 * Creates a tensor filled with zeros similar to an existing tensor.
@@ -966,7 +987,8 @@ __attribute__((deprecated("This API is experimental.")))
966987 * @return A new ExecuTorchTensor instance filled with zeros.
967988 */
968989+ (instancetype )zerosTensorLikeTensor : (ExecuTorchTensor *)tensor
969- NS_SWIFT_NAME(zeros(like:));
990+ NS_SWIFT_NAME(zeros(like:))
991+ NS_RETURNS_RETAINED;
970992
971993@end
972994
@@ -987,7 +1009,8 @@ __attribute__((deprecated("This API is experimental.")))
9871009 strides : (NSArray <NSNumber *> *)strides
9881010 dataType : (ExecuTorchDataType)dataType
9891011 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
990- NS_SWIFT_NAME(rand(shape:strides:dataType:shapeDynamism:));
1012+ NS_SWIFT_NAME(rand(shape:strides:dataType:shapeDynamism:))
1013+ NS_RETURNS_RETAINED;
9911014
9921015/* *
9931016 * Creates a tensor with random values, with the specified shape and data type.
@@ -1000,7 +1023,8 @@ __attribute__((deprecated("This API is experimental.")))
10001023+ (instancetype )randomTensorWithShape : (NSArray <NSNumber *> *)shape
10011024 dataType : (ExecuTorchDataType)dataType
10021025 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1003- NS_SWIFT_NAME(rand(shape:dataType:shapeDynamism:));
1026+ NS_SWIFT_NAME(rand(shape:dataType:shapeDynamism:))
1027+ NS_RETURNS_RETAINED;
10041028
10051029/* *
10061030 * 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.")))
10111035 */
10121036+ (instancetype )randomTensorWithShape : (NSArray <NSNumber *> *)shape
10131037 dataType : (ExecuTorchDataType)dataType
1014- NS_SWIFT_NAME(rand(shape:dataType:));
1038+ NS_SWIFT_NAME(rand(shape:dataType:))
1039+ NS_RETURNS_RETAINED;
10151040
10161041/* *
10171042 * 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.")))
10241049+ (instancetype )randomTensorLikeTensor : (ExecuTorchTensor *)tensor
10251050 dataType : (ExecuTorchDataType)dataType
10261051 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1027- NS_SWIFT_NAME(rand(like:dataType:shapeDynamism:));
1052+ NS_SWIFT_NAME(rand(like:dataType:shapeDynamism:))
1053+ NS_RETURNS_RETAINED;
10281054
10291055/* *
10301056 * 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.")))
10351061 */
10361062+ (instancetype )randomTensorLikeTensor : (ExecuTorchTensor *)tensor
10371063 dataType : (ExecuTorchDataType)dataType
1038- NS_SWIFT_NAME(rand(like:dataType:));
1064+ NS_SWIFT_NAME(rand(like:dataType:))
1065+ NS_RETURNS_RETAINED;
10391066
10401067/* *
10411068 * Creates a tensor with random values similar to an existing tensor.
@@ -1044,7 +1071,8 @@ __attribute__((deprecated("This API is experimental.")))
10441071 * @return A new ExecuTorchTensor instance filled with random values.
10451072 */
10461073+ (instancetype )randomTensorLikeTensor : (ExecuTorchTensor *)tensor
1047- NS_SWIFT_NAME(rand(like:));
1074+ NS_SWIFT_NAME(rand(like:))
1075+ NS_RETURNS_RETAINED;
10481076
10491077@end
10501078
@@ -1066,7 +1094,8 @@ __attribute__((deprecated("This API is experimental.")))
10661094 strides : (NSArray <NSNumber *> *)strides
10671095 dataType : (ExecuTorchDataType)dataType
10681096 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1069- NS_SWIFT_NAME(randn(shape:strides:dataType:shapeDynamism:));
1097+ NS_SWIFT_NAME(randn(shape:strides:dataType:shapeDynamism:))
1098+ NS_RETURNS_RETAINED;
10701099
10711100/* *
10721101 * Creates a tensor with random values drawn from a normal distribution,
@@ -1080,7 +1109,8 @@ __attribute__((deprecated("This API is experimental.")))
10801109+ (instancetype )randomNormalTensorWithShape : (NSArray <NSNumber *> *)shape
10811110 dataType : (ExecuTorchDataType)dataType
10821111 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1083- NS_SWIFT_NAME(randn(shape:dataType:shapeDynamism:));
1112+ NS_SWIFT_NAME(randn(shape:dataType:shapeDynamism:))
1113+ NS_RETURNS_RETAINED;
10841114
10851115/* *
10861116 * Creates a tensor with random values drawn from a normal distribution,
@@ -1092,7 +1122,8 @@ __attribute__((deprecated("This API is experimental.")))
10921122 */
10931123+ (instancetype )randomNormalTensorWithShape : (NSArray <NSNumber *> *)shape
10941124 dataType : (ExecuTorchDataType)dataType
1095- NS_SWIFT_NAME(randn(shape:dataType:));
1125+ NS_SWIFT_NAME(randn(shape:dataType:))
1126+ NS_RETURNS_RETAINED;
10961127
10971128/* *
10981129 * Creates a tensor with random normal values similar to an existing tensor,
@@ -1106,7 +1137,8 @@ __attribute__((deprecated("This API is experimental.")))
11061137+ (instancetype )randomNormalTensorLikeTensor : (ExecuTorchTensor *)tensor
11071138 dataType : (ExecuTorchDataType)dataType
11081139 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1109- NS_SWIFT_NAME(randn(like:dataType:shapeDynamism:));
1140+ NS_SWIFT_NAME(randn(like:dataType:shapeDynamism:))
1141+ NS_RETURNS_RETAINED;
11101142
11111143/* *
11121144 * Creates a tensor with random normal values similar to an existing tensor,
@@ -1118,7 +1150,8 @@ __attribute__((deprecated("This API is experimental.")))
11181150 */
11191151+ (instancetype )randomNormalTensorLikeTensor : (ExecuTorchTensor *)tensor
11201152 dataType : (ExecuTorchDataType)dataType
1121- NS_SWIFT_NAME(randn(like:dataType:));
1153+ NS_SWIFT_NAME(randn(like:dataType:))
1154+ NS_RETURNS_RETAINED;
11221155
11231156/* *
11241157 * Creates a tensor with random normal values similar to an existing tensor.
@@ -1127,7 +1160,8 @@ __attribute__((deprecated("This API is experimental.")))
11271160 * @return A new ExecuTorchTensor instance filled with values from a normal distribution.
11281161 */
11291162+ (instancetype )randomNormalTensorLikeTensor : (ExecuTorchTensor *)tensor
1130- NS_SWIFT_NAME(randn(like:));
1163+ NS_SWIFT_NAME(randn(like:))
1164+ NS_RETURNS_RETAINED;
11311165
11321166@end
11331167
@@ -1153,7 +1187,8 @@ __attribute__((deprecated("This API is experimental.")))
11531187 strides : (NSArray <NSNumber *> *)strides
11541188 dataType : (ExecuTorchDataType)dataType
11551189 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1156- NS_SWIFT_NAME(randint(low:high:shape:strides:dataType:shapeDynamism:));
1190+ NS_SWIFT_NAME(randint(low:high:shape:strides:dataType:shapeDynamism:))
1191+ NS_RETURNS_RETAINED;
11571192
11581193/* *
11591194 * Creates a tensor with random integer values in the specified range,
@@ -1171,7 +1206,8 @@ __attribute__((deprecated("This API is experimental.")))
11711206 shape : (NSArray <NSNumber *> *)shape
11721207 dataType : (ExecuTorchDataType)dataType
11731208 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1174- NS_SWIFT_NAME(randint(low:high:shape:dataType:shapeDynamism:));
1209+ NS_SWIFT_NAME(randint(low:high:shape:dataType:shapeDynamism:))
1210+ NS_RETURNS_RETAINED;
11751211
11761212/* *
11771213 * Creates a tensor with random integer values in the specified range,
@@ -1187,7 +1223,8 @@ __attribute__((deprecated("This API is experimental.")))
11871223 high : (NSInteger )high
11881224 shape : (NSArray <NSNumber *> *)shape
11891225 dataType : (ExecuTorchDataType)dataType
1190- NS_SWIFT_NAME(randint(low:high:shape:dataType:));
1226+ NS_SWIFT_NAME(randint(low:high:shape:dataType:))
1227+ NS_RETURNS_RETAINED;
11911228
11921229/* *
11931230 * 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.")))
12051242 high : (NSInteger )high
12061243 dataType : (ExecuTorchDataType)dataType
12071244 shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1208- NS_SWIFT_NAME(randint(like:low:high:dataType:shapeDynamism:));
1245+ NS_SWIFT_NAME(randint(like:low:high:dataType:shapeDynamism:))
1246+ NS_RETURNS_RETAINED;
12091247
12101248/* *
12111249 * 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.")))
12211259 low : (NSInteger )low
12221260 high : (NSInteger )high
12231261 dataType : (ExecuTorchDataType)dataType
1224- NS_SWIFT_NAME(randint(like:low:high:dataType:));
1262+ NS_SWIFT_NAME(randint(like:low:high:dataType:))
1263+ NS_RETURNS_RETAINED;
12251264
12261265/* *
12271266 * 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.")))
12341273+ (instancetype )randomIntegerTensorLikeTensor : (ExecuTorchTensor *)tensor
12351274 low : (NSInteger )low
12361275 high : (NSInteger )high
1237- NS_SWIFT_NAME(randint(like:low:high:));
1276+ NS_SWIFT_NAME(randint(like:low:high:))
1277+ NS_RETURNS_RETAINED;
12381278
12391279@end
12401280
0 commit comments