"git@developer.sourcefind.cn:OpenDAS/fastmoe.git" did not exist on "302835707fd29dbaab7f95c0f39ce3d10ef2fb97"
Commit 997bb727 authored by Haroun Habeeb's avatar Haroun Habeeb Committed by Facebook GitHub Bot
Browse files

support building d2go transform list from a list of strings instead of just config

Summary:
for sythetic data, we want to enable having different transforms for different dataloaders.

To do that, we need to be able to construct different kinds of transforms.

This means that using the cfg's hard-coded location isn't convenient - we'd have to edit the cfg during run time and call the build function multiple times

Differential Revision: D32486576

fbshipit-source-id: 767b63c5c787e31a67dbf8710ab9bab84a0651db
parent bb49d171
......@@ -94,17 +94,19 @@ def parse_tfm_gen_repr(tfm_gen_repr: str) -> Tuple[str, Optional[str]]:
)
def build_transform_gen(cfg: CfgNode, is_train: bool) -> List[d2T.Transform]:
def build_transform_gen(
cfg: CfgNode, is_train: bool, tfm_gen_repr_list: Optional[List[str]] = None
) -> List[d2T.Transform]:
"""
This function builds a list of TransformGen or Transform objects using the a list of
strings from cfg.D2GO_DATA.AUG_OPS.TRAIN/TEST. Each string (aka. `tfm_gen_repr`)
will be split into `name` and `arg_str` (separated by "::"); the `name`
will be used to lookup the registry while `arg_str` will be used as argument.
This function builds a list of TransformGen or Transform objects using a list of
strings (`tfm_gen_repr_list). If list is not provided, cfg.D2GO_DATA.AUG_OPS.TRAIN/TEST is used.
Each string (aka. `tfm_gen_repr`) will be split into `name` and `arg_str` (separated by "::");
the `name` will be used to lookup the registry while `arg_str` will be used as argument.
Each function in registry needs to take `cfg`, `arg_str` and `is_train` as
input, and return a list of TransformGen or Transform objects.
"""
tfm_gen_repr_list = (
tfm_gen_repr_list = tfm_gen_repr_list or (
cfg.D2GO_DATA.AUG_OPS.TRAIN if is_train else cfg.D2GO_DATA.AUG_OPS.TEST
)
tfm_gens = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment