@@ -1063,4 +1063,111 @@ __attribute__((deprecated("This API is experimental.")))
10631063
10641064@end
10651065
1066+ #pragma mark - RandomInteger Category
1067+
1068+ @interface ExecuTorchTensor (RandomInteger)
1069+
1070+ /* *
1071+ * Creates a tensor with random integer values in the specified range,
1072+ * with full specification of shape, strides, data type, and shape dynamism.
1073+ *
1074+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1075+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1076+ * @param shape An NSArray of NSNumber objects representing the desired shape.
1077+ * @param strides An NSArray of NSNumber objects representing the desired strides.
1078+ * @param dataType An ExecuTorchDataType value specifying the element type.
1079+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
1080+ * @return A new ExecuTorchTensor instance filled with random integer values.
1081+ */
1082+ + (instancetype )randomIntegerTensorWithLow : (NSInteger )low
1083+ high : (NSInteger )high
1084+ shape : (NSArray <NSNumber *> *)shape
1085+ strides : (NSArray <NSNumber *> *)strides
1086+ dataType : (ExecuTorchDataType)dataType
1087+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1088+ NS_SWIFT_NAME(randint(low:high:shape:strides:dataType:shapeDynamism:));
1089+
1090+ /* *
1091+ * Creates a tensor with random integer values in the specified range,
1092+ * with the given shape and data type.
1093+ *
1094+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1095+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1096+ * @param shape An NSArray of NSNumber objects representing the desired shape.
1097+ * @param dataType An ExecuTorchDataType value specifying the element type.
1098+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
1099+ * @return A new ExecuTorchTensor instance filled with random integer values.
1100+ */
1101+ + (instancetype )randomIntegerTensorWithLow : (NSInteger )low
1102+ high : (NSInteger )high
1103+ shape : (NSArray <NSNumber *> *)shape
1104+ dataType : (ExecuTorchDataType)dataType
1105+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1106+ NS_SWIFT_NAME(randint(low:high:shape:dataType:shapeDynamism:));
1107+
1108+ /* *
1109+ * Creates a tensor with random integer values in the specified range,
1110+ * with the given shape (using dynamic bound shape) and data type.
1111+ *
1112+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1113+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1114+ * @param shape An NSArray of NSNumber objects representing the desired shape.
1115+ * @param dataType An ExecuTorchDataType value specifying the element type.
1116+ * @return A new ExecuTorchTensor instance filled with random integer values.
1117+ */
1118+ + (instancetype )randomIntegerTensorWithLow : (NSInteger )low
1119+ high : (NSInteger )high
1120+ shape : (NSArray <NSNumber *> *)shape
1121+ dataType : (ExecuTorchDataType)dataType
1122+ NS_SWIFT_NAME(randint(low:high:shape:dataType:));
1123+
1124+ /* *
1125+ * Creates a tensor with random integer values in the specified range, similar to an existing tensor,
1126+ * with the given data type and shape dynamism.
1127+ *
1128+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
1129+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1130+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1131+ * @param dataType An ExecuTorchDataType value specifying the element type.
1132+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
1133+ * @return A new ExecuTorchTensor instance filled with random integer values.
1134+ */
1135+ + (instancetype )randomIntegerTensorLikeTensor : (ExecuTorchTensor *)tensor
1136+ low : (NSInteger )low
1137+ high : (NSInteger )high
1138+ dataType : (ExecuTorchDataType)dataType
1139+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1140+ NS_SWIFT_NAME(randint(like:low:high:dataType:shapeDynamism:));
1141+
1142+ /* *
1143+ * Creates a tensor with random integer values in the specified range, similar to an existing tensor,
1144+ * with the given data type.
1145+ *
1146+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
1147+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1148+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1149+ * @param dataType An ExecuTorchDataType value specifying the element type.
1150+ * @return A new ExecuTorchTensor instance filled with random integer values.
1151+ */
1152+ + (instancetype )randomIntegerTensorLikeTensor : (ExecuTorchTensor *)tensor
1153+ low : (NSInteger )low
1154+ high : (NSInteger )high
1155+ dataType : (ExecuTorchDataType)dataType
1156+ NS_SWIFT_NAME(randint(like:low:high:dataType:));
1157+
1158+ /* *
1159+ * Creates a tensor with random integer values in the specified range, similar to an existing tensor.
1160+ *
1161+ * @param tensor An existing ExecuTorchTensor instance.
1162+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1163+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1164+ * @return A new ExecuTorchTensor instance filled with random integer values.
1165+ */
1166+ + (instancetype )randomIntegerTensorLikeTensor : (ExecuTorchTensor *)tensor
1167+ low : (NSInteger )low
1168+ high : (NSInteger )high
1169+ NS_SWIFT_NAME(randint(like:low:high:));
1170+
1171+ @end
1172+
10661173NS_ASSUME_NONNULL_END
0 commit comments