@@ -980,4 +980,111 @@ __attribute__((deprecated("This API is experimental.")))
980980
981981@end
982982
983+ #pragma mark - RandomInteger Category
984+
985+ @interface ExecuTorchTensor (RandomInteger)
986+
987+ /* *
988+ * Creates a tensor with random integer values in the specified range,
989+ * with full specification of shape, strides, data type, and shape dynamism.
990+ *
991+ * @param low An NSInteger specifying the inclusive lower bound of random values.
992+ * @param high An NSInteger specifying the exclusive upper bound of random values.
993+ * @param shape An NSArray of NSNumber objects representing the desired shape.
994+ * @param strides An NSArray of NSNumber objects representing the desired strides.
995+ * @param dataType An ExecuTorchDataType value specifying the element type.
996+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
997+ * @return A new ExecuTorchTensor instance filled with random integer values.
998+ */
999+ + (instancetype )randomIntegerTensorWithLow : (NSInteger )low
1000+ high : (NSInteger )high
1001+ shape : (NSArray <NSNumber *> *)shape
1002+ strides : (NSArray <NSNumber *> *)strides
1003+ dataType : (ExecuTorchDataType)dataType
1004+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1005+ NS_SWIFT_NAME(randint(low:high:shape:strides:dataType:shapeDynamism:));
1006+
1007+ /* *
1008+ * Creates a tensor with random integer values in the specified range,
1009+ * with the given shape and data type.
1010+ *
1011+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1012+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1013+ * @param shape An NSArray of NSNumber objects representing the desired shape.
1014+ * @param dataType An ExecuTorchDataType value specifying the element type.
1015+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
1016+ * @return A new ExecuTorchTensor instance filled with random integer values.
1017+ */
1018+ + (instancetype )randomIntegerTensorWithLow : (NSInteger )low
1019+ high : (NSInteger )high
1020+ shape : (NSArray <NSNumber *> *)shape
1021+ dataType : (ExecuTorchDataType)dataType
1022+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1023+ NS_SWIFT_NAME(randint(low:high:shape:dataType:shapeDynamism:));
1024+
1025+ /* *
1026+ * Creates a tensor with random integer values in the specified range,
1027+ * with the given shape (using dynamic bound shape) and data type.
1028+ *
1029+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1030+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1031+ * @param shape An NSArray of NSNumber objects representing the desired shape.
1032+ * @param dataType An ExecuTorchDataType value specifying the element type.
1033+ * @return A new ExecuTorchTensor instance filled with random integer values.
1034+ */
1035+ + (instancetype )randomIntegerTensorWithLow : (NSInteger )low
1036+ high : (NSInteger )high
1037+ shape : (NSArray <NSNumber *> *)shape
1038+ dataType : (ExecuTorchDataType)dataType
1039+ NS_SWIFT_NAME(randint(low:high:shape:dataType:));
1040+
1041+ /* *
1042+ * Creates a tensor with random integer values in the specified range, similar to an existing tensor,
1043+ * with the given data type and shape dynamism.
1044+ *
1045+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
1046+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1047+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1048+ * @param dataType An ExecuTorchDataType value specifying the element type.
1049+ * @param shapeDynamism An ExecuTorchShapeDynamism value specifying whether the shape is static or dynamic.
1050+ * @return A new ExecuTorchTensor instance filled with random integer values.
1051+ */
1052+ + (instancetype )randomIntegerTensorLikeTensor : (ExecuTorchTensor *)tensor
1053+ low : (NSInteger )low
1054+ high : (NSInteger )high
1055+ dataType : (ExecuTorchDataType)dataType
1056+ shapeDynamism : (ExecuTorchShapeDynamism)shapeDynamism
1057+ NS_SWIFT_NAME(randint(like:low:high:dataType:shapeDynamism:));
1058+
1059+ /* *
1060+ * Creates a tensor with random integer values in the specified range, similar to an existing tensor,
1061+ * with the given data type.
1062+ *
1063+ * @param tensor An existing ExecuTorchTensor instance whose shape and strides are used.
1064+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1065+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1066+ * @param dataType An ExecuTorchDataType value specifying the element type.
1067+ * @return A new ExecuTorchTensor instance filled with random integer values.
1068+ */
1069+ + (instancetype )randomIntegerTensorLikeTensor : (ExecuTorchTensor *)tensor
1070+ low : (NSInteger )low
1071+ high : (NSInteger )high
1072+ dataType : (ExecuTorchDataType)dataType
1073+ NS_SWIFT_NAME(randint(like:low:high:dataType:));
1074+
1075+ /* *
1076+ * Creates a tensor with random integer values in the specified range, similar to an existing tensor.
1077+ *
1078+ * @param tensor An existing ExecuTorchTensor instance.
1079+ * @param low An NSInteger specifying the inclusive lower bound of random values.
1080+ * @param high An NSInteger specifying the exclusive upper bound of random values.
1081+ * @return A new ExecuTorchTensor instance filled with random integer values.
1082+ */
1083+ + (instancetype )randomIntegerTensorLikeTensor : (ExecuTorchTensor *)tensor
1084+ low : (NSInteger )low
1085+ high : (NSInteger )high
1086+ NS_SWIFT_NAME(randint(like:low:high:));
1087+
1088+ @end
1089+
9831090NS_ASSUME_NONNULL_END
0 commit comments