/usr/local/lib64/python3.6/site-packages/caffe2/python/__pycache__
NameSizeModeActions
allcompare_test.cpython-36.pyc27100644editdlrm
attention.cpython-36.pyc49380644editdlrm
benchmark_generator.cpython-36.pyc39100644editdlrm
binarysize.cpython-36.pyc48530644editdlrm
brew.cpython-36.pyc38490644editdlrm
brew_test.cpython-36.pyc104520644editdlrm
build.cpython-36.pyc3400644editdlrm
cached_reader.cpython-36.pyc29540644editdlrm
caffe_translator.cpython-36.pyc241650644editdlrm
caffe_translator_test.cpython-36.pyc29290644editdlrm
checkpoint.cpython-36.pyc279730644editdlrm
checkpoint_test.cpython-36.pyc94620644editdlrm
cnn.cpython-36.pyc84350644editdlrm
context.cpython-36.pyc40080644editdlrm
context_test.cpython-36.pyc26650644editdlrm
control.cpython-36.pyc144660644editdlrm
control_ops_grad.cpython-36.pyc163650644editdlrm
control_ops_grad_test.cpython-36.pyc15020644editdlrm
control_ops_util.cpython-36.pyc83320644editdlrm
control_test.cpython-36.pyc118700644editdlrm
convert.cpython-36.pyc1480644editdlrm
convert_test.cpython-36.pyc5680644editdlrm
convnet_benchmarks.cpython-36.pyc129450644editdlrm
convnet_benchmarks_test.cpython-36.pyc10900644editdlrm
core.cpython-36.pyc944280644editdlrm
core_gradients_test.cpython-36.pyc248250644editdlrm
core_test.cpython-36.pyc339420644editdlrm
crf.cpython-36.pyc76220644editdlrm
crf_predict.cpython-36.pyc10440644editdlrm
crf_viterbi_test.cpython-36.pyc16770644editdlrm
dataio.cpython-36.pyc239780644editdlrm
dataio_test.cpython-36.pyc132670644editdlrm
dataset.cpython-36.pyc128790644editdlrm
data_parallel_model.cpython-36.pyc514160644editdlrm
data_parallel_model_test.cpython-36.pyc389230644editdlrm
data_workers.cpython-36.pyc131420644editdlrm
data_workers_test.cpython-36.pyc45220644editdlrm
db_file_reader.cpython-36.pyc53610644editdlrm
db_test.cpython-36.pyc13280644editdlrm
device_checker.cpython-36.pyc40140644editdlrm
dyndep.cpython-36.pyc15680644editdlrm
embedding_generation_benchmark.cpython-36.pyc42030644editdlrm
experiment_util.cpython-36.pyc32330644editdlrm
extension_loader.cpython-36.pyc5430644editdlrm
fakefp16_transform_lib.cpython-36.pyc5460644editdlrm
filler_test.cpython-36.pyc9250644editdlrm
functional.cpython-36.pyc35310644editdlrm
functional_test.cpython-36.pyc41320644editdlrm
fused_8bit_rowwise_conversion_ops_test.cpython-36.pyc36310644editdlrm
gradient_checker.cpython-36.pyc106220644editdlrm
gradient_check_test.cpython-36.pyc167880644editdlrm
gru_cell.cpython-36.pyc25960644editdlrm
hip_test_util.cpython-36.pyc6690644editdlrm
hsm_util.cpython-36.pyc18230644editdlrm
hypothesis_test.cpython-36.pyc843120644editdlrm
hypothesis_test_util.cpython-36.pyc200390644editdlrm
ideep_test_util.cpython-36.pyc10810644editdlrm
layers_test.cpython-36.pyc573720644editdlrm
layer_model_helper.cpython-36.pyc216410644editdlrm
layer_model_instantiator.cpython-36.pyc36650644editdlrm
layer_parameter_sharing_test.cpython-36.pyc56260644editdlrm
layer_test_util.cpython-36.pyc52730644editdlrm
lazy.cpython-36.pyc4240644editdlrm
lazy_dyndep.cpython-36.pyc24750644editdlrm
lazy_dyndep_test.cpython-36.pyc48070644editdlrm
lengths_reducer_fused_8bit_rowwise_ops_test.cpython-36.pyc43920644editdlrm
lengths_reducer_rowwise_8bit_ops_test.cpython-36.pyc36840644editdlrm
lstm_benchmark.cpython-36.pyc72820644editdlrm
memonger.cpython-36.pyc321700644editdlrm
memonger_test.cpython-36.pyc231000644editdlrm
mkl_test_util.cpython-36.pyc11910644editdlrm
model_device_test.cpython-36.pyc33760644editdlrm
model_helper.cpython-36.pyc186180644editdlrm
model_helper_test.cpython-36.pyc19910644editdlrm
modifier_context.cpython-36.pyc26500644editdlrm
muji.cpython-36.pyc55660644editdlrm
muji_test.cpython-36.pyc35670644editdlrm
net_builder.cpython-36.pyc267860644editdlrm
net_builder_test.cpython-36.pyc92550644editdlrm
net_drawer.cpython-36.pyc100560644editdlrm
net_printer.cpython-36.pyc143670644editdlrm
net_printer_test.cpython-36.pyc33230644editdlrm
nomnigraph.cpython-36.pyc51250644editdlrm
nomnigraph_test.cpython-36.pyc145910644editdlrm
nomnigraph_transformations.cpython-36.pyc24310644editdlrm
nomnigraph_transformations_test.cpython-36.pyc40730644editdlrm
normalizer.cpython-36.pyc19410644editdlrm
normalizer_context.cpython-36.pyc15530644editdlrm
normalizer_test.cpython-36.pyc8700644editdlrm
numa_benchmark.cpython-36.pyc18860644editdlrm
numa_test.cpython-36.pyc16260644editdlrm
observer_test.cpython-36.pyc41810644editdlrm
operator_fp_exceptions_test.cpython-36.pyc13050644editdlrm
optimizer.cpython-36.pyc456060644editdlrm
optimizer_context.cpython-36.pyc20080644editdlrm
optimizer_test.cpython-36.pyc247470644editdlrm
optimizer_test_util.cpython-36.pyc68080644editdlrm
parallelize_bmuf_distributed_test.cpython-36.pyc69900644editdlrm
parallel_workers.cpython-36.pyc91480644editdlrm
parallel_workers_test.cpython-36.pyc38240644editdlrm
pipeline.cpython-36.pyc129400644editdlrm
pipeline_test.cpython-36.pyc27150644editdlrm
predictor_constants.cpython-36.pyc3040644editdlrm
python_op_test.cpython-36.pyc105020644editdlrm
queue_util.cpython-36.pyc50550644editdlrm
record_queue.cpython-36.pyc42250644editdlrm
recurrent.cpython-36.pyc98930644editdlrm
regularizer.cpython-36.pyc186040644editdlrm
regularizer_context.cpython-36.pyc15620644editdlrm
regularizer_test.cpython-36.pyc88250644editdlrm
rnn_cell.cpython-36.pyc447850644editdlrm
schema.cpython-36.pyc417630644editdlrm
schema_test.cpython-36.pyc137870644editdlrm
scope.cpython-36.pyc26000644editdlrm
scope_test.cpython-36.pyc40680644editdlrm
session.cpython-36.pyc73460644editdlrm
session_test.cpython-36.pyc23530644editdlrm
sparse_to_dense_mask_test.cpython-36.pyc52980644editdlrm
sparse_to_dense_test.cpython-36.pyc30030644editdlrm
task.cpython-36.pyc222070644editdlrm
task_test.cpython-36.pyc11780644editdlrm
test_util.cpython-36.pyc37290644editdlrm
text_file_reader.cpython-36.pyc22390644editdlrm
timeout_guard.cpython-36.pyc31060644editdlrm
toy_regression_test.cpython-36.pyc23600644editdlrm
transformations.cpython-36.pyc18330644editdlrm
transformations_test.cpython-36.pyc96080644editdlrm
tt_core.cpython-36.pyc64680644editdlrm
tt_core_test.cpython-36.pyc18240644editdlrm
utils.cpython-36.pyc122450644editdlrm
utils_test.cpython-36.pyc14160644editdlrm
visualize.cpython-36.pyc60270644editdlrm
workspace.cpython-36.pyc226900644editdlrm
workspace_test.cpython-36.pyc290550644editdlrm
_import_c_extension.cpython-36.pyc15240644editdlrm
__init__.cpython-36.pyc26070644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/caffe2/python/__pycache__/control.cpython-36.pyc (14466B)
3 EgmK@sdZddlmZddlmZdaeaddZddZ d d Z d d Z d dZ ddZ ddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd6d2d3Zd7d4d5Zd1S)8z Implement functions for controlling execution of nets and steps, including Do DoParallel For-loop While-loop Do-While-loop Switch If )core) viewitemscCs@d||f}|}x |tkr0d|tf}td7aqWtj||S)Nz%s/%sz%s_%dr)_used_step_names _current_idxadd) control_name base_nameZ concat_nameZ next_namer A/usr/local/lib64/python3.6/site-packages/caffe2/python/control.py_get_next_step_names     r cCsHt|dkrtdn.t|dkr<|d}t|tsD|g}nt|}|S)zx input is a tuple. Example: (a, b, c) --> [a, b, c] (a) --> [a] ([a, b, c]) --> [a, b, c] rzinput cannot be empty.r)len ValueError isinstancelist)inputoutputr r r _MakeList(s   rcCs,t|trtdd|DSt|tjSdS)Ncss|]}t|tjVqdS)N)rrNet).0nr r r =sz_IsNets..)rrallrr) nets_or_stepsr r r _IsNets;s rcGs6t|f}t|}t|r"||Std|g|SdS)Nprepend)rrDo)rnetsr r r _PrependNetsBs  rcGs6t|f}t|}t|r"||S|td|gSdS)Nappend)rrr)rrr r r _AppendNetsKs  r cCs6t|jjdks"td|jjtj|jjdS)zW The condition blob is the last external_output that must be a single bool rz6Condition net %s must has at least one external outputr)r ProtoZexternal_outputAssertionErrornamer BlobReference) condition_netr r r GetConditionBlobFromNetTs r'cGsLt|}tjd}x4|D],\}}|jg|gg|tjjd}|j|qW|S)aA net assigning constant bool values to blobs. It is mainly used for initializing condition blobs, for example, in multi-task learning, we need to access reader_done blobs before reader_net run. In that case, the reader_done blobs must be initialized. Args: blobs_with_bool_value: one or more (blob, bool_value) pairs. The net will assign each bool_value to the corresponding blob. returns bool_net: A net assigning constant bool values to blobs. Examples: - BoolNet((blob_1, bool_value_1), ..., (blob_n, bool_value_n)) - BoolNet([(blob_1, net1), ..., (blob_n, bool_value_n)]) - BoolNet((cond_1, bool_value_1)) bool_net)shapevalueZdtype)rrrZ ConstantFillZDataTypeZBOOLAddExternalOutput)Zblobs_with_bool_valuer(ZblobZ bool_valueout_blobr r r BoolNetbs  r-cCs@t|tjrt|}n|}tjd}|j|}|j|||fS)a/Not of a condition blob or net Args: condition_blob_or_net can be either blob or net. If condition_blob_or_net is Net, the condition is its last external_output that must be a single bool. returns not_net: the net NOT the input out_blob: the output blob of the not_net not_net)rrrr'Notr+)condition_blob_or_netcondition_blobr.r,r r r NotNets     r2cCs&tjd}|j|}|j|||fS)zMake a condition net that copies the condition_blob Args: condition_blob is a single bool. returns not_net: the net NOT the input out_blob: the output blob of the not_net Zcopy_condition_blob_net)rrZCopyr+)r1r&r,r r r _CopyConditionBlobNets   r3c Cs t|ts|St|dkr*|r&|dSdStj|}xtt|D]}||j}|j|jjksft|j |jj kszt|jj j |j |jj j |j t ||}|dkr|}n|j|||g}x,t||jD]\}} |j|| 7<qWqBW|j||S)a Merge multi condition nets into a single condition nets. Args: name: name of the new condition net. condition_nets: a list of condition nets. The last external_output of each condition net must be single bool value. relation: can be 'And' or 'Or'. Returns: - A new condition net. Its last external output is relation of all condition_nets. rrN)rrr rrranger"Z device_optionr#typeopextendZexternal_inputr' __getattr__rZ _attr_dictr+) r$condition_netsrelationZ merged_netiZ net_proto curr_cond last_condkvr r r MergeConditionNetss&      r@c Cs|sdSt|tstdt|dkrBt|d}t|\}}|Stj|}x@tt|D]0}t||}|dkrx|} qZ|j || |g} qZW|j | |S)a Combine conditions of multi nets into a single condition nets. Unlike MergeConditionNets, the actual body of condition_nets is not copied into the combine condition net. One example is about multi readers. Each reader net has a reader_done condition. When we want to check whether all readers are done, we can use this function to build a new net. Args: name: name of the new condition net. condition_nets: a list of condition nets. The last external_output of each condition net must be single bool value. relation: can be 'And' or 'Or'. Returns: - A new condition net. Its last external output is relation of all condition_nets. Nz&condition_nets must be a list of nets.rr) rrrr r'r3rrr4r8r+) r$r9r:r1r&_Z combined_netr;r<r=r r r CombineConditionss"       rBcGsBt|}t|dkr,t|dtjr,|dStjtd||SdS)z Execute the sequence of nets or steps once. Examples: - Do('myDo', net1, net2, ..., net_n) - Do('myDo', list_of_nets) - Do('myDo', step1, step2, ..., step_n) - Do('myDo', list_of_steps) rrrN)rr rr ExecutionStepscoped_execution_stepr )r$rr r r rs rcGsFt|}t|dkr,t|dtjr,|dStjtd||ddSdS)a Execute the nets or steps in parallel, waiting for all of them to finish Examples: - DoParallel('pDo', net1, net2, ..., net_n) - DoParallel('pDo', list_of_nets) - DoParallel('pDo', step1, step2, ..., step_n) - DoParallel('pDo', list_of_steps) rr DoParallelT)Zconcurrent_substepsN)rr rrrCrDr )r$rr r r rEs rEcstt|\}t|tjr&t||n t|fdd}trhtdf}td||dS|dSdS)a Execute nets_or_steps once if condition_blob_or_net evaluates as true. If condition_blob_or_net is Net, the condition is its last external_output that must be a single bool. And this net will be executed before nets_or_steps so as to get the condition. cstjt|ddS)NT)should_stop_blob only_once)rrDr )r)r$r stop_blobr r if_step7s z_RunOnceIf..if_stepFz /_RunOnceIfz_RunOnceIf-inner _RunOnceIfN)r2rrrrrr-r)r$r0rcondition_not_netrIr(r )r$rrHr rJ(s      rJcCsNt|tjr t|}t||}nt|\}}t||}tjtd|||ddS)zq Similar to _RunOnceIf() but Execute nets_or_steps once if condition_blob_or_net evaluates as false. _RunOnceIfNotT)rFrG)rrrr'rr3rDr )r$r0rr1Zcopy_netr r r rLGs    rLcCsdtjd}|jg|d}tjd}|j|g}tjtd|t|||d}t|dt|d||S)a Execute nets_or_steps iter_num times. Args: nets_or_steps: a ExecutionStep or a Net or a list of ExecutionSteps or a list nets. iter_num: the number times to execute the nets_or_steps. Returns: A ExecutionStep instance. zinit-net)Z init_countzFor-iterz For-inner)rFz/Forz /For-init-net)rrZ CreateCounterZ CountDownrDr rr)r$rZiter_numZinit_netZiter_cntZiter_netZ iter_doneZfor_stepr r r For[s    rMcstt|\}t|tjr&t||n t|fdd}trhtdf}td||dS|dSdS)aX Execute nets_or_steps when condition_blob_or_net returns true. Args: condition_blob_or_net: If it is an instance of Net, its last external_output must be a single bool. nets_or_steps: a ExecutionStep or a Net or a list of ExecutionSteps or a list nets. Returns: A ExecutionStep instance. cstjt|dS)N)rF)rrDr )r)r$rrHr r while_stepszWhile..while_stepFz/Whilez While-innerWhileN)r2rrrrrr-r)r$r0rrKrNr(r )r$rrHr rOus     rOcCsDt|tjr t|}t||}ntjt|}tjtd|||dS)zc Similar to While() but execute nets_or_steps when condition_blob_or_net returns false Until)rF) rrrr'rr%strrDr )r$r0rrHr r r rPs  rPcCs^t|\}}t|tjr&t|||}n t||}t|df}t|d|tjtd|||dS)a Execute nets_or_steps when condition_blob_or_net returns true. It will execute nets_or_steps before evaluating condition_blob_or_net. Args: condition_blob_or_net: if it is an instance of Net, tts last external_output must be a single bool. nets_or_steps: a ExecutionStep or a Net or a list of ExecutionSteps or a list nets. Returns: A ExecutionStep instance. Fz/DoWhilez DoWhile-inner)rF) r2rrrr r-rrDr )r$r0rrKrHr(r r r DoWhiles     rRcCslt|tjs,tj|}tjtd|||dSt||}t|}t|df}t |d|tjtd|||dS)a Similar to DoWhile() but execute nets_or_steps when condition_blob_or_net returns false. It will execute nets_or_steps before evaluating condition_blob_or_net. Special case: if condition_blob_or_net is a blob and is pre-set to true, then only the first net/step of nets_or_steps will be executed and loop is exited. So you need to be careful about the initial value the condition blob when using DoUntil(), esp when DoUntil() is called twice. DoUntil)rFFz/DoUntilz DoUntil-inner) rrrr%rDr r r'r-r)r$r0rrHr(r r r rSs    rScs(t|}tjtdfdd|DS)a Execute the steps for which the condition is true. Each condition is a tuple (condition_blob_or_net, nets_or_steps). Note: 1. Multi steps can be executed if their conditions are true. 2. The conditions_blob_or_net (if it is Net) of all steps will be executed once. Examples: - Switch('name', (cond_1, net_1), (cond_2, net_2), ..., (cond_n, net_n)) - Switch('name', [(cond_1, net1), (cond_2, net_2), ..., (cond_n, net_n)]) - Switch('name', (cond_1, net_1)) Switchcs g|]\}}td||qS)z/Switch)rJ)rcondstep)r$r r szSwitch..)rrrDr )r$ conditionsr )r$r rTsrTcs(t|}tjtdfdd|DS)zU Similar to Switch() but execute the steps for which the condition is False. SwitchNotcs g|]\}}td||qS)z /SwitchNot)rL)rrUrV)r$r r rW szSwitchNot..)rrrDr )r$rXr )r$r rYs  rYNcCsV|st|d||St|tjr*t|}n|}t|dt|d||t|d||S)a condition_blob_or_net is first evaluated or executed. If the condition is true, true_nets_or_steps is then executed, otherwise, false_nets_or_steps is executed. If condition_blob_or_net is Net, the condition is its last external_output that must be a single bool. And this Net will be executred before both true/false_nets_or_steps so as to get the condition. z/Ifz/If-truez /If-false)rJrrrr'rrL)r$r0true_nets_or_stepsfalse_nets_or_stepsr1r r r Ifs   r\cCsV|st|d||St|tjr*t|}n|}t|dt|d||t|d||S)zy If condition_blob_or_net returns false, executes true_nets_or_steps, otherwise executes false_nets_or_steps z/IfNotz /IfNot-truez /IfNot-false)rLrrrr'rrJ)r$r0rZr[r1r r r IfNot+s  r])N)N) __doc__Z caffe2.pythonrZ future.utilsrrsetrr rrrr r'r-r2r3r@rBrrErJrLrMrOrPrRrSrTrYr\r]r r r r  s8      ),(!!