noether.data.pipeline.sample_processors.default_tensor¶
Classes¶
Create a tensor with a fixed dummy value, with a specified size. |
Module Contents¶
- class noether.data.pipeline.sample_processors.default_tensor.DefaultTensorSampleProcessor(item_key_name, feature_dim, size=None, matching_item_key=None, default_value=0.0)¶
Bases:
noether.data.pipeline.SampleProcessorCreate a tensor with a fixed dummy value, with a specified size.
# dummy example processor = DefaultTensorSampleProcessor( item_key_name="default_tensor", feature_dim=128, size=10, default_value=0.5, ) input_sample = {} output_sample = processor(input_sample) # output_sample['default_tensor'] will be a tensor of shape (10, 128) filled with 0.5
- Parameters:
item_key_name (str) – key of the created default tensor in the output sample dict.
default_value (float) – value to fill the created default tensor with.
feature_dim (int) – size of the feature dimension of the created default tensor.
size (int | None) – size of the first dimension of the created default tensor.
matching_item_key (str | None) – key of an existing tensor in the input sample dict to match the size of the first dimension.
- item_key_name¶
- feature_dim¶
- size = None¶
- matching_item_key = None¶
- default_value = 0.0¶