Add ExternalSource to dynamic mode#6395
Conversation
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
9cbee37 to
9d971a3
Compare
9d971a3 to
d10ecc5
Compare
|
!build |
|
CI MESSAGE: [55431712]: BUILD STARTED |
|
|
||
| # We don't inherit from _ops.Operator because there's nothing to reuse from there | ||
| class ExternalSource: | ||
| """Wrapper over a Python source. |
There was a problem hiding this comment.
Not particularly descriptive.
There was a problem hiding this comment.
Is this better now?
Consume data from a Python callable or iterable source.
|
CI MESSAGE: [55431712]: BUILD FAILED |
| if len(value) != self._num_outputs: | ||
| raise ValueError(f"Expected a sequence of size {self._num_outputs}, got {len(value)}") | ||
| return value | ||
|
|
There was a problem hiding this comment.
Shouldn't ExternalSource have next_epoch to be usable like readers? Somewhat tangentially - is raise/end of epoch properly handle by pipelines?
There was a problem hiding this comment.
In normal dynamic mode, ExternalSource is not particularly useful so I deliberately enabled use only through the __call__ method.
When integrating with transparent pipelining, I'm adding a method .compiled(batch_size) that's usable specifically for this. The reason it's not next_epoch is that the notion of an epoch doesn't necessarily make sense for ExternalSource. This depend on the nature of the source and the cycle argument.
Somewhat tangentially - is
raise/end of epoch properly handle by pipelines?
In pipeline mode, this really depends on cycle. To create epochs cycle="raise" is used.
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
d10ecc5 to
d861d6c
Compare
|
!build |
|
CI MESSAGE: [55574360]: BUILD STARTED |
|
CI MESSAGE: [55574360]: BUILD PASSED |
Category:
New feature (non-breaking change which adds functionality)
Description:
Add
ExternalSourceto dynamic mode. It mimicsfn.external_sourceto some extent but behaves differently, especially with batches, to integrate well with the imperative API.This is not a very useful operator in and of itself but will enable sources other than a reader in transparent pipelining.
Additional information:
Affected modules and functionalities:
Dynamic mode.
Key points relevant for the review:
Tests:
Checklist
Documentation
ndd.ExternalSourcedoesn't appear in the documentation yet because it's only really useful with transparent pipelining.DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-4745