@@ -381,6 +381,8 @@ struct Input : torch::CustomClassHolder {
381381 DataType dtype;
382382 // / Expected tensor format for the input
383383 TensorFormat format;
384+ // / Expected allowed domain for tensor input
385+ std::vector<double > tensor_domain;
384386
385387 Input () {}
386388 /* *
@@ -394,6 +396,22 @@ struct Input : torch::CustomClassHolder {
394396 */
395397 TORCHTRT_API Input (std::vector<int64_t > shape, TensorFormat format = TensorFormat::kContiguous );
396398
399+ /* *
400+ * @brief Construct a new Input spec object for static input size from
401+ * c10::ArrayRef (the type produced by tensor.sizes()), vector, optional arguments
402+ * allow the user to configure expected input shape tensor format
403+ * dtype (Expected data type for the input) defaults to PyTorch
404+ * / traditional TRT convection (FP32 for FP32 only, FP16 for FP32 and FP16, FP32 for Int8)
405+ *
406+ * @param shape Input tensor shape
407+ * @param tensor_domain Allowed range for tensor inputs [low, high)
408+ * @param format Expected tensor format for the input (Defaults to contiguous)
409+ */
410+ TORCHTRT_API Input (
411+ std::vector<int64_t > shape,
412+ std::vector<double > tensor_domain,
413+ TensorFormat format = TensorFormat::kContiguous );
414+
397415 /* *
398416 * @brief Construct a new Input spec object for static input size from
399417 * vector, optional arguments allow the user to configure expected input shape
@@ -406,6 +424,23 @@ struct Input : torch::CustomClassHolder {
406424 */
407425 TORCHTRT_API Input (std::vector<int64_t > shape, DataType dtype, TensorFormat format = TensorFormat::kContiguous );
408426
427+ /* *
428+ * @brief Construct a new Input spec object for static input size from
429+ * vector, optional arguments allow the user to configure expected input shape
430+ * tensor format
431+ *
432+ * @param shape Input tensor shape
433+ * @param dtype Expected data type for the input (Defaults to the type of the weights in the first tensor
434+ * calculation if detectable else Float32)
435+ * @param tensor_domain Allowed range for tensor inputs [low, high)
436+ * @param format Expected tensor format for the input (Defaults to contiguous)
437+ */
438+ TORCHTRT_API Input (
439+ std::vector<int64_t > shape,
440+ DataType dtype,
441+ std::vector<double > tensor_domain,
442+ TensorFormat format = TensorFormat::kContiguous );
443+
409444 /* *
410445 * @brief Construct a new Input spec object for static input size from
411446 * c10::ArrayRef (the type produced by tensor.sizes()), vector, optional arguments
@@ -418,6 +453,22 @@ struct Input : torch::CustomClassHolder {
418453 */
419454 TORCHTRT_API Input (c10::ArrayRef<int64_t > shape, TensorFormat format = TensorFormat::kContiguous );
420455
456+ /* *
457+ * @brief Construct a new Input spec object for static input size from
458+ * c10::ArrayRef (the type produced by tensor.sizes()), vector, optional arguments
459+ * allow the user to configure expected input shape tensor format
460+ * dtype (Expected data type for the input) defaults to PyTorch
461+ * / traditional TRT convection (FP32 for FP32 only, FP16 for FP32 and FP16, FP32 for Int8)
462+ *
463+ * @param shape Input tensor shape
464+ * @param tensor_domain Allowed range for tensor inputs [low, high)
465+ * @param format Expected tensor format for the input (Defaults to contiguous)
466+ */
467+ TORCHTRT_API Input (
468+ c10::ArrayRef<int64_t > shape,
469+ std::vector<double > tensor_domain,
470+ TensorFormat format = TensorFormat::kContiguous );
471+
421472 /* *
422473 * @brief Construct a new Input spec object for static input size from
423474 * c10::ArrayRef (the type produced by tensor.sizes()), vector, optional arguments
@@ -430,6 +481,23 @@ struct Input : torch::CustomClassHolder {
430481 */
431482 TORCHTRT_API Input (c10::ArrayRef<int64_t > shape, DataType dtype, TensorFormat format = TensorFormat::kContiguous );
432483
484+ /* *
485+ * @brief Construct a new Input spec object for static input size from
486+ * c10::ArrayRef (the type produced by tensor.sizes()), vector, optional arguments
487+ * allow the user to configure expected input shape tensor format
488+ *
489+ * @param shape Input tensor shape
490+ * @param dtype Expected data type for the input (Defaults to the type of the weights in the first tensor
491+ * calculation if detectable else Float32)
492+ * @param tensor_domain Allowed range for tensor inputs [low, high)
493+ * @param format Expected tensor format for the input (Defaults to contiguous)
494+ */
495+ TORCHTRT_API Input (
496+ c10::ArrayRef<int64_t > shape,
497+ DataType dtype,
498+ std::vector<double > tensor_domain,
499+ TensorFormat format = TensorFormat::kContiguous );
500+
433501 /* *
434502 * @brief Construct a new Input spec object dynamic input size from
435503 * c10::ArrayRef (the type produced by tensor.sizes()) for min, opt, and max
@@ -446,6 +514,24 @@ struct Input : torch::CustomClassHolder {
446514 std::vector<int64_t > opt_shape,
447515 std::vector<int64_t > max_shape,
448516 TensorFormat format = TensorFormat::kContiguous );
517+ /* *
518+ * @brief Construct a new Input spec object dynamic input size from
519+ * c10::ArrayRef (the type produced by tensor.sizes()) for min, opt, and max
520+ * supported sizes. dtype (Expected data type for the input) defaults to PyTorch
521+ * / traditional TRT convection (FP32 for FP32 only, FP16 for FP32 and FP16, FP32 for Int8)
522+ *
523+ * @param min_shape Minimum shape for input tensor
524+ * @param opt_shape Target optimization shape for input tensor
525+ * @param max_shape Maximum acceptible shape for input tensor
526+ * @param tensor_domain Allowed range for tensor inputs [low, high)
527+ * @param format Expected tensor format for the input (Defaults to contiguous)
528+ */
529+ TORCHTRT_API Input (
530+ std::vector<int64_t > min_shape,
531+ std::vector<int64_t > opt_shape,
532+ std::vector<int64_t > max_shape,
533+ std::vector<double > tensor_domain,
534+ TensorFormat format = TensorFormat::kContiguous );
449535
450536 /* *
451537 * @brief Construct a new Input spec object for a dynamic input size from vectors
@@ -466,6 +552,44 @@ struct Input : torch::CustomClassHolder {
466552 DataType dtype,
467553 TensorFormat format = TensorFormat::kContiguous );
468554
555+ /* *
556+ * @brief Construct a new Input spec object for a dynamic input size from vectors
557+ * for minimum shape, optimal shape, and max shape supported sizes optional arguments
558+ * allow the user to configure expected input shape tensor format
559+ *
560+ * @param min_shape Minimum shape for input tensor
561+ * @param opt_shape Target optimization shape for input tensor
562+ * @param max_shape Maximum acceptible shape for input tensor
563+ * @param dtype Expected data type for the input (Defaults to the type of the weights in the first tensor
564+ * calculation if detectable else Float32)
565+ * @param tensor_domain Allowed range for tensor inputs [low, high)
566+ * @param format Expected tensor format for the input (Defaults to contiguous)
567+ */
568+ TORCHTRT_API Input (
569+ std::vector<int64_t > min_shape,
570+ std::vector<int64_t > opt_shape,
571+ std::vector<int64_t > max_shape,
572+ DataType dtype,
573+ std::vector<double > tensor_domain,
574+ TensorFormat format = TensorFormat::kContiguous );
575+
576+ /* *
577+ * @brief Construct a new Input spec object dynamic input size from
578+ * c10::ArrayRef (the type produced by tensor.sizes()) for min, opt, and max
579+ * supported sizes. dtype (Expected data type for the input) defaults to PyTorch
580+ * / traditional TRT convection (FP32 for FP32 only, FP16 for FP32 and FP16, FP32 for Int8)
581+ *
582+ * @param min_shape Minimum shape for input tensor
583+ * @param opt_shape Target optimization shape for input tensor
584+ * @param max_shape Maximum acceptible shape for input tensor
585+ * @param format Expected tensor format for the input (Defaults to contiguous)
586+ */
587+ TORCHTRT_API Input (
588+ c10::ArrayRef<int64_t > min_shape,
589+ c10::ArrayRef<int64_t > opt_shape,
590+ c10::ArrayRef<int64_t > max_shape,
591+ TensorFormat format = TensorFormat::kContiguous );
592+
469593 /* *
470594 * @brief Construct a new Input spec object dynamic input size from
471595 * c10::ArrayRef (the type produced by tensor.sizes()) for min, opt, and max
@@ -475,12 +599,33 @@ struct Input : torch::CustomClassHolder {
475599 * @param min_shape Minimum shape for input tensor
476600 * @param opt_shape Target optimization shape for input tensor
477601 * @param max_shape Maximum acceptible shape for input tensor
602+ * @param tensor_domain Allowed range for tensor inputs [low, high)
478603 * @param format Expected tensor format for the input (Defaults to contiguous)
479604 */
480605 TORCHTRT_API Input (
481606 c10::ArrayRef<int64_t > min_shape,
482607 c10::ArrayRef<int64_t > opt_shape,
483608 c10::ArrayRef<int64_t > max_shape,
609+ std::vector<double > tensor_domain,
610+ TensorFormat format = TensorFormat::kContiguous );
611+
612+ /* *
613+ * @brief Construct a new Input spec object dynamic input size from
614+ * c10::ArrayRef (the type produced by tensor.sizes()) for min, opt, and max
615+ * supported sizes
616+ *
617+ * @param min_shape Minimum shape for input tensor
618+ * @param opt_shape Target optimization shape for input tensor
619+ * @param max_shape Maximum acceptible shape for input tensor
620+ * @param dtype Expected data type for the input (Defaults to the type of the weights in the first tensor
621+ * calculation if detectable else Float32)
622+ * @param format Expected tensor format for the input (Defaults to contiguous)
623+ */
624+ TORCHTRT_API Input (
625+ c10::ArrayRef<int64_t > min_shape,
626+ c10::ArrayRef<int64_t > opt_shape,
627+ c10::ArrayRef<int64_t > max_shape,
628+ DataType dtype,
484629 TensorFormat format = TensorFormat::kContiguous );
485630
486631 /* *
@@ -493,13 +638,15 @@ struct Input : torch::CustomClassHolder {
493638 * @param max_shape Maximum acceptible shape for input tensor
494639 * @param dtype Expected data type for the input (Defaults to the type of the weights in the first tensor
495640 * calculation if detectable else Float32)
641+ * @param tensor_domain Allowed range for tensor inputs [low, high)
496642 * @param format Expected tensor format for the input (Defaults to contiguous)
497643 */
498644 TORCHTRT_API Input (
499645 c10::ArrayRef<int64_t > min_shape,
500646 c10::ArrayRef<int64_t > opt_shape,
501647 c10::ArrayRef<int64_t > max_shape,
502648 DataType dtype,
649+ std::vector<double > tensor_domain,
503650 TensorFormat format = TensorFormat::kContiguous );
504651
505652 /* *
0 commit comments