Part module
- class nnodely.layers.part.Part(*args, **kwargs)[source]
Represents a selection of a sub-part from a relation in the neural network model.
Notes
Note
The Part relation works along the object dimension (third dimension) of the input.
- Parameters:
obj (Stream) – The stream object to create a part from.
i (int) – The starting index of the part.
j (int) – The ending index of the part.
- name
The name of the part.
- Type:
str
- dim
A dictionary containing the dimensions of the part.
- Type:
dict
- json
A dictionary containing the configuration of the part.
- Type:
dict
Examples
x = Input('x', dimensions=3).last() relation = Part(x, 0, 1)
- Raises:
IndexError – If the indices i and j are out of range.
- class nnodely.layers.part.Select(*args, **kwargs)[source]
Represents a selection of a single element from a relation in the neural network model.
Notes
Note
The Select relation works along the object dimension (third dimension) of the input.
- Parameters:
obj (Stream) – The stream object to select an element from.
i (int) – The index of the element to select.
- name
The name of the selection.
- Type:
str
- dim
A dictionary containing the dimensions of the selection.
- Type:
dict
- json
A dictionary containing the configuration of the selection.
- Type:
dict
Examples
x = Input('x', dimensions=3).last() relation = Select(x, 1)
- Raises:
IndexError – If the index i is out of range.
- class nnodely.layers.part.SamplePart(*args, **kwargs)[source]
Represents a selection of a sub-part from a relation in the neural network model.
Notes
Note
The SamplePart relation works along the time dimension (second dimension) of the input.
- Parameters:
obj (Stream) – The stream object to create a part from.
i (int) – The starting index of the part.
j (int) – The ending index of the part.
offset (int, optional) – The offset for the part. Default is None.
- name
The name of the part.
- Type:
str
- dim
A dictionary containing the dimensions of the part.
- Type:
dict
- json
A dictionary containing the configuration of the part.
- Type:
dict
Examples
x = Input('x').sw(3) relation = SamplePart(x, 0, 1)
- Raises:
KeyError – If the input does not have a sample window.
ValueError – If the indices i and j are out of range or if i is not smaller than j.
IndexError – If the offset is not within the sample window.
- class nnodely.layers.part.SampleSelect(*args, **kwargs)[source]
Represents a selection of a single element from a relation in the neural network model.
Notes
Note
The SampleSelect relation works along the time dimension (second dimension) of the input.
- Parameters:
obj (Stream) – The stream object to select an element from.
i (int) – The index of the element to select.
- name
The name of the selection.
- Type:
str
- dim
A dictionary containing the dimensions of the selection.
- Type:
dict
- json
A dictionary containing the configuration of the selection.
- Type:
dict
Examples
x = Input('x').sw(3) relation = SampleSelect(x, 1)
- Raises:
IndexError – If the index i is out of range.
KeyError – If the input does not have a sample window.
IndexError – If the offset is not within the sample window.
- class nnodely.layers.part.TimePart(*args, **kwargs)[source]
Represents a part of a stream in the neural network model along the time dimension (second dimension).
- Parameters:
obj (Stream) – The stream object to create a part from.
i (int or float) – The starting index of the part.
j (int or float) – The ending index of the part.
offset (int or float, optional) – The offset for the part. Default is None.
- name
The name of the part.
- Type:
str
- dim
A dictionary containing the dimensions of the part.
- Type:
dict
- json
A dictionary containing the configuration of the part.
- Type:
dict
Examples
x = Input('x').sw(10) time_part = TimePart(x, i=0, j=5)
- Raises:
KeyError – If the input does not have a time window.
ValueError – If the indices i and j are out of range or if i is not smaller than j.
IndexError – If the offset is not within the time window.
For more examples and tutorials, see Partitioning tutorial.