def image_decoder_slice_pipe(max_batch_size, input_data, device):
     pipe = Pipeline(batch_size=max_batch_size, num_threads=4, device_id=0)
     encoded = fn.external_source(source=input_data, cycle=False, device='cpu')
     anch = fn.constant(fdata=.1)
     sh = fn.constant(fdata=.4)
     decoded = fn.decoders.image_slice(encoded, anch, sh, axes=0, device=device)
     pipe.set_outputs(decoded)
     return pipe
 def pipe(max_batch_size, input_data, device):
     pipe = Pipeline(batch_size=max_batch_size, num_threads=4, device_id=0)
     anch = fn.constant(fdata=.1, device='cpu')
     sh = fn.constant(fdata=.5, device='cpu')
     data = fn.external_source(source=input_data, cycle=False, device=device)
     processed = fn.slice(data, anch, sh, axes=0, device=device)
     pipe.set_outputs(processed)
     return pipe
 def pipe(max_batch_size, input_data, device):
     pipe = Pipeline(batch_size=max_batch_size, num_threads=4, device_id=0)
     # just to drive the variable batch size.
     batch_size_setter = fn.external_source(source=input_data, cycle=False, device=device)
     data = fn.constant(fdata=3.1415, shape=(10, 10), device=device)
     pipe.set_outputs(data, batch_size_setter)
     return pipe
Esempio n. 4
0
 def pipe(max_batch_size, input_data, device):
     pipe = Pipeline(batch_size=max_batch_size, num_threads=4, device_id=0)
     shape = fn.external_source(source=input_data,
                                cycle=False,
                                device='cpu')
     data = fn.constant(fdata=3.1415, shape=shape, device=device)
     pipe.set_outputs(data)
     return pipe
Esempio n. 5
0
 def make_pipe():
     fake_data = fn.constant(idata=0, shape=[10, 10, 3], dtype=types.FLOAT, device=device)
     axes = fn.random.uniform(range=wrong_axes_range, shape=(2,), dtype=types.INT32)
     rel_start = fn.random.uniform(range=[0.0, 0.3], shape=(2,), dtype=types.FLOAT)
     rel_shape = fn.random.uniform(range=[0.4, 0.6], shape=(2,), dtype=types.FLOAT)
     if named_args:
         sliced = fn.slice(fake_data, rel_start=rel_start, rel_shape=rel_shape, axes=axes)
     else:
         sliced = fn.slice(fake_data, rel_start, rel_shape, axes=axes)
     return sliced
Esempio n. 6
0
 def make_pipe():
     fake_data = fn.constant(idata=0,
                             shape=[10, 10, 3],
                             dtype=types.FLOAT,
                             device=device)
     axes = fn.random.uniform(range=wrong_axes_range,
                              shape=(2, ),
                              dtype=types.INT32)
     padded = fn.pad(fake_data, axes=axes)
     return padded
Esempio n. 7
0
def dali_const_dataset(batch_size, sample_size, device_id):
    pipeline = Pipeline(batch_size, 4, device_id)
    const = fn.constant(device='gpu', fdata=sample_size * [1.])
    pipeline.set_outputs(const)
    dali_dataset = dali_tf.DALIDataset(
        pipeline=pipeline,
        batch_size=batch_size,
        output_shapes=((batch_size, sample_size)),
        output_dtypes=(tf.float32),
        device_id=device_id)
    return dali_dataset
Esempio n. 8
0
 def make_pipe():
     fake_data = fn.constant(idata=0,
                             shape=[10, 10, 3],
                             dtype=types.FLOAT,
                             device="cpu")
     rel_start = fn.random.uniform(range=[0.0, 0.3],
                                   shape=(2, ),
                                   dtype=types.FLOAT,
                                   device="gpu")
     rel_shape = fn.random.uniform(range=[0.4, 0.6],
                                   shape=(2, ),
                                   dtype=types.FLOAT,
                                   device="gpu")
     sliced = fn.slice(fake_data, rel_start, rel_shape, device="cpu")
     return sliced
Esempio n. 9
0
def nan_check_pipeline(source):
    return fn.constant(fdata=next(source))
Esempio n. 10
0
 def pipeline():
     data = fn.constant(idata=255,
                        shape=(10, 10, 3),
                        dtype=type,
                        device=device)
     return op(data)