當前位置: 首頁>>代碼示例>>Python>>正文


Python pipeline.Pipeline方法代碼示例

本文整理匯總了Python中nvidia.dali.pipeline.Pipeline方法的典型用法代碼示例。如果您正苦於以下問題:Python pipeline.Pipeline方法的具體用法?Python pipeline.Pipeline怎麽用?Python pipeline.Pipeline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nvidia.dali.pipeline的用法示例。


在下文中一共展示了pipeline.Pipeline方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from nvidia.dali import pipeline [as 別名]
# 或者: from nvidia.dali.pipeline import Pipeline [as 別名]
def __init__(
            self,
            batch_size=1,
            num_threads=1,
            seed=3,
            prefetch_queue_depth=2,
        ):
            """Create a ``Pipeline``

            Parameters
            ----------
            batch_size : int, optional, default=1
                The number of examples in a batch.
            num_threads : int, optional, default=1
                The number of threads to execute the operations.
            seed : int, optional, default=3
                The seed for random generator.
            prefetch_queue_depth : int, optional, default=2
                The number of prefetch queues.

            """
            self._batch_size = batch_size
            self._num_threads = num_threads 
開發者ID:seetaresearch,項目名稱:dragon,代碼行數:25,代碼來源:pipeline.py

示例2: __init__

# 需要導入模塊: from nvidia.dali import pipeline [as 別名]
# 或者: from nvidia.dali.pipeline import Pipeline [as 別名]
def __init__(self, batch_size, num_threads, device_id, data_dir, crop, size,
                 mean, std, local_rank=0, world_size=1, dali_cpu=False, shuffle=False, fp16=False):

        # As we're recreating the Pipeline at every epoch, the seed must be -1 (random seed)
        super(HybridValPipe, self).__init__(batch_size, num_threads, device_id, seed=-1)

        # Enabling read_ahead slowed down processing ~40%
        # Note: initial_fill is for the shuffle buffer.  As we only want to see every example once, this is set to 1
        self.input = ops.FileReader(file_root=data_dir, shard_id=local_rank, num_shards=world_size, random_shuffle=shuffle, initial_fill=1)
        if dali_cpu:
            decode_device = "cpu"
            self.dali_device = "cpu"
            self.crop = ops.Crop(device="cpu", crop=(crop, crop))

        else:
            decode_device = "mixed"
            self.dali_device = "gpu"

            output_dtype = types.FLOAT
            if fp16:
                output_dtype = types.FLOAT16

            self.cmnp = ops.CropMirrorNormalize(device="gpu",
                                                output_dtype=output_dtype,
                                                output_layout=types.NCHW,
                                                crop=(crop, crop),
                                                image_type=types.RGB,
                                                mean=mean,
                                                std=std)

        self.decode = ops.ImageDecoder(device=decode_device, output_type=types.RGB)

        # Resize to desired size.  To match torchvision dataloader, use triangular interpolation
        self.res = ops.Resize(device=self.dali_device, resize_shorter=size, interp_type=types.INTERP_TRIANGULAR) 
開發者ID:yaysummeriscoming,項目名稱:DALI_pytorch_demo,代碼行數:36,代碼來源:dali.py

示例3: build

# 需要導入模塊: from nvidia.dali import pipeline [as 別名]
# 或者: from nvidia.dali.pipeline import Pipeline [as 別名]
def build(self):
            """Build the pipeline."""
            super(Pipeline, self).build() 
開發者ID:seetaresearch,項目名稱:dragon,代碼行數:5,代碼來源:pipeline.py

示例4: define_graph

# 需要導入模塊: from nvidia.dali import pipeline [as 別名]
# 或者: from nvidia.dali.pipeline import Pipeline [as 別名]
def define_graph(self):
            """Define the symbolic operations for pipeline."""
            super(Pipeline, self).define_graph() 
開發者ID:seetaresearch,項目名稱:dragon,代碼行數:5,代碼來源:pipeline.py

示例5: feed_input

# 需要導入模塊: from nvidia.dali import pipeline [as 別名]
# 或者: from nvidia.dali.pipeline import Pipeline [as 別名]
def feed_input(self, ref, data):
            """Bind an array to the edge reference.

            Parameters
            ----------
            ref : _EdgeReference
                The reference of a edge.
            data : numpy.ndarray
                The array data.

            """
            super(Pipeline, self).feed_input(ref, data) 
開發者ID:seetaresearch,項目名稱:dragon,代碼行數:14,代碼來源:pipeline.py


注:本文中的nvidia.dali.pipeline.Pipeline方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。