MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / SelectComponent

Function SelectComponent

tensorpack/dataflow/common.py:586–602  ·  view source on GitHub ↗

Select / reorder components from datapoints. Args: ds (DataFlow): input DataFlow. idxs (list[int] or list[str]): a list of component indices/keys. Example: .. code-block:: none original df produces: [c1, c2, c3] idxs: [2,1] this df: [c3, c

(ds, idxs)

Source from the content-addressed store, hash-verified

584
585
586def SelectComponent(ds, idxs):
587 """
588 Select / reorder components from datapoints.
589
590 Args:
591 ds (DataFlow): input DataFlow.
592 idxs (list[int] or list[str]): a list of component indices/keys.
593
594 Example:
595
596 .. code-block:: none
597
598 original df produces: [c1, c2, c3]
599 idxs: [2,1]
600 this df: [c3, c2]
601 """
602 return MapData(ds, lambda dp: [dp[i] for i in idxs])
603
604
605class LocallyShuffleData(ProxyDataFlow, RNGDataFlow):

Callers

nothing calls this directly

Calls 1

MapDataClass · 0.85

Tested by

no test coverage detected