/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__/utils.cpython-36.pyc (12245B)
3 Ege7@s&ddlmZddlmZddlmZmZddlmZddl Z ddl Z ddl Z ddl Z ddl ZddlmZmZmZmZdZdZd/d d Zd d Zd dZd0ddZddZddZddZddZddZddZddZ Gdd d e!Z"d!d"Z#d#d$Z$d1d%d&Z%d'd(Z&d)d*Z'd+d,Z(d-d.Z)dS)2) caffe2_pb2) viewitems) DecodeErrorMessage) text_formatN) integer_types binary_type text_type string_typesZoptimizer_iterationZiteration_mutexcslpgttsgtddDs8tdjfdd}||}||}||kpjt|t|kS)zM Two ops are identical except for each field in the `ignore_fields`. css|]}t|tVqdS)N) isinstancer ).0fr?/usr/local/lib64/python3.6/site-packages/caffe2/python/utils.py sz OpAlmostEqual..z*Expect each field is text type, but got {}cs0tj|}x D]}|j|r|j|qW|S)N)copydeepcopyHasFieldZ ClearField)opfield) ignore_fieldsrrclean_op#s    zOpAlmostEqual..clean_op)r listallAssertionErrorformatstr)Zop_aZop_brrr)rr OpAlmostEquals   rcCsP|jdkr0tj|jtjdj|j|j|j|jStj|jtjdj|j j SdS)Nr)dtype) numnpasarraydatafloat32reshapeZchannelsheightwidthshapeZdim)ZblobrrrCaffeBlobToNumpyArray/s  r(cCs\|jtjjkr(tj|jtjdj|j S|jtjj krPtj|j tj dj|j S|jtjj krxtj|jtjdj|j S|jtjjkrtj|jtjdj|j S|jtjjkrtj|jtjdj|j S|jtjjkrtj|jtjdj|j S|jtjjkrtj|jtjdj|j S|jtjjkrFtj|jtjdj|j Stdt|jdS)N)rz$Tensor data type not supported yet: ) data_typer TensorProtoFLOATr r! float_datar#r$dimsDOUBLE double_datafloat64INT64 int64_dataint64INT32 int32_dataintINT16int16UINT16uint16INT8int8UINT8uint8 RuntimeErrorr)tensorrrrCaffe2TensorToNumpyArray:s4rAcCstj}|jj|j|r ||_|jtjkrTtjj |_ |j jt |j jtn|jtjkrtjj|_ |jjt |j jtjnb|jtjkrtjj|_ |jjt |j jtjn,|jtjks|jtjkrtjj|_ |jj|j jtjjn|jtjkr8tjj|_ |jjt |j jtjn|jtjkrntjj|_ |jjt |j jtjn~|jtjkrtjj |_ |jjt |j jtjnH|jtj!krtjj"|_ |jjt |j jtj!nt#dt$|j|S)Nz#Numpy data type not supported yet: )%rr*r-extendr'namerr r#r+r)r,rflattenZastypefloatr0r.r/r3r1r2r6Zint32r4r5tolistr8r7r:r9r<r;r>r=r?r)ZarrrCr@rrrNumpyArrayToCaffe2TensorYs>             rGcCsVtj}||_t|tjj}t|tjrN|j j tj krN|j j |jj|St|tjrh|jj}nt|tjr~tj|}t |tkr||_nt |tkst |tkr||_nt|tr||_nt|tr|jd|_nnt|tjr|jj|nPt|tr|j|_n6|rPt dd|DrP|j j dd|Dn|rt dd|Dr|j!j dd|Dn|rt dd|Dr|j"j dd|Dn|rt d d|Dr|j#j |nv|rt d d|Dr|j"j d d|DnD|r.css(|] }t|tjkr|jn|VqdS)N)rHr rIitem)r rJrrrrscss,|]$}t|tkp"t|ttjgkVqdS)N)rHrboolr int_)r rJrrrrscss(|] }t|tjkr|jn|VqdS)N)rHr rMrK)r rJrrrrscss"|]}t|tpt|tVqdS)N)r rr )r rJrrrrscss&|]}t|tr|jdn|VqdS)zutf-8N)r r encode)r rJrrrrscss|]}t|tjVqdS)N)r rNetDef)r rJrrrrscss|]}t|tVqdS)N)r r)r rJrrrrscss|]}|jVqdS)N)SerializeToString)r rJrrrrszBUnknown iterable argument type: key={} value={}, value type={}[{}]css|]}t|VqdS)N)rH)r rJrrrrsz5Unknown argument type: key={} value={}, value type={})'rZArgumentrCr collectionsabcIterabler ZndarrayrrHr#ZfloatsrBrDrFZgenericZasscalarrEr rrLirsr rNrOnZCopyFromrrPrintsstringsnets ValueErrorrset)keyvalueargumentiterablerrr MakeArgument}s\           "r`c Cs@|}ytj|||Stjtfk r:|j||SXdS)a,Reads a protobuffer with the given proto class. Inputs: cls: a protobuffer class. s: a string of either binary or text protobuffer content. Outputs: proto: the protobuffer of cls Throws: google.protobuf.message.DecodeError: if we cannot decode the message. N)rParse ParseErrorUnicodeDecodeErrorZParseFromString)clsrUobjrrrTryReadProtoWithClasss   rfcCs.x(t|D]\}}t||kr ||Sq WdS)zNGets a specific field from a protocol buffer that matches the given class N)rrH)re function_maprdfuncrrrGetContentFromProtos ric CsLxFt|D]2\}}yt||}||Stk r:w Yq Xq WtddS)Nz$Cannot find a fit protobuffer class.)rrfr)rUrgrdrhrerrrGetContentFromProtoStrings  rjcCsJt|}t||j}WdQRXt|d}|j|jWdQRXdS)z:Convert a text file of the given protobuf class to binary.Nw)openrfreadwriterP)Z proto_classfilenameZ out_filenamer protoZfidrrrConvertProtoToBinarys  rqcCsddlm}m}|j|jdgdg|j|jdd|jd}|dddf|dddftj |dddftj |dddfdS) z|Get GPU memory usage stats from CUDAContext/HIPContext. This requires flag --caffe2_gpu_memory_tracking to be enabledr) workspacecoreZGetGPUMemoryUsageZ ____mem____) device_optionN)Z total_by_gpuZ max_by_gputotalZ max_total) caffe2.pythonrrrsRunOperatorOnceCreateOperator DeviceOptionZ GpuDeviceTypeZ FetchBlobr sum)rrrsbrrrGetGPUMemoryUsageStatss r}cCs<ddlm}m}|j|jdt|t||jtjddS)Nr)rrrsZFree)rt) rwrrrsrxryrrzrCPU)Zblobsrrrsrrr ResetBlobs src@seZdZdZeddZdS) DebugModea= This class allows to drop you into an interactive debugger if there is an unhandled exception in your python script Example of usage: def main(): # your code here pass if __name__ == '__main__': from caffe2.python.utils import DebugMode DebugMode.run(main) c Csly|Stk rYnLtk rfddl}tdttjdt|jtjdYnXdS)NrzjEntering interactive debugger. Type "bt" to print the full stacktrace. Type "help" to see command listing.ru)KeyboardInterrupt Exceptionpdbprintsysexc_infoZ post_mortemexit)rdrhrrrrrun's z DebugMode.runN)__name__ __module__ __qualname____doc__ classmethodrrrrrrsrcCs||krtdj|||dS)Nz {}. {} != {})rr)ar|msgrrrraiseIfNotEqual;srcstjfdd}|S)z Use this method to decorate your function with DebugMode's functionality Example: @debug def test_foo(self): raise Exception("Bar") csfdd}tj|S)Ncs S)Nrr)argsr kwargsrrrhNsz$debug..wrapper..func)rr)rrrh)r )rrrwrapperLszdebug..wrapper) functoolswraps)r rr)r rdebug@s rcCs|dk r |nt}|dk r|nt}ddlm}|j|s|j|jtjdgd@|j g|dg||j j d}|j g|g}|j ||g|gWdQRXn |j|}|S)z Often, a mutex guarded iteration counter is needed. This function creates a mutex iter in the net uniquely (if the iter already existing, it does nothing) This function returns the iter blob Nr)rszdevice_type_override:cpu)Z extra_inforu)r'r]r)OPTIMIZER_ITERATION_NAMEITERATION_MUTEX_NAMErwrsZ BlobIsDefinedZ DeviceScoperzrr~Z ConstantFillZDataTyper1Z CreateMutexZ AtomicIterZ GetBlobRef)Zinit_netnetiterZ iter_mutexZiter_valrs iterationrrrBuildUniqueMutexIterUs"    rc st|tkstixnt|D]b}||jkrt||ttrjksxtdj||fddDd|<qWS)Nzsz$EnumClassKeyVals..r) rHrdiruppergetattrr r valuesr)rdkr)rrJrEnumClassKeyValszs   $ rcCsi}x|D]}|jdsq x|jjD]n}|jdkr4q$|j|jkrb|j|jrbt||j||j<Pq$|j|jkr$t||j}t|dkr$|||j<Pq$Wd||j<q W|S)z Convert a list of arguments to a name, value dictionary. Assumes that each argument has a name. Otherwise, the argument is skipped. rCrN) rZ DESCRIPTORfieldsrClabelZLABEL_OPTIONALrZLABEL_REPEATEDlen)rZansargdlist_rrr ArgsToDicts"       rcCs6|jdkst|jd|jdfttd|jdS)Nrur)ndimr transposetuplerange)r@rrr NHWC2NCHWsrcCs,|jdkst|jdttd|jdS)Nrru)r)ru)rrrrr)r@rrr NCHW2NHWCsr)N)N)NNr)*Z caffe2.protorZ future.utilsrZgoogle.protobuf.messagerrZgoogle.protobufrrrQrrZnumpyr sixrrr r rrrr(rArGr`rfrirjrqr}robjectrrrrrrrrrrrrs@      $H  $