/usr/local/lib64/python3.6/site-packages/caffe2/python/layers/__pycache__
NameSizeModeActions
adaptive_weight.cpython-36.pyc52870644editdlrm
add_bias.cpython-36.pyc14790644editdlrm
arc_cosine_feature_map.cpython-36.pyc54270644editdlrm
batch_huber_loss.cpython-36.pyc23280644editdlrm
batch_lr_loss.cpython-36.pyc55650644editdlrm
batch_mse_loss.cpython-36.pyc18390644editdlrm
batch_normalization.cpython-36.pyc27790644editdlrm
batch_sigmoid_cross_entropy_loss.cpython-36.pyc15420644editdlrm
batch_softmax_loss.cpython-36.pyc28770644editdlrm
blob_weighted_sum.cpython-36.pyc24200644editdlrm
bpr_loss.cpython-36.pyc14050644editdlrm
bucket_weighted.cpython-36.pyc20790644editdlrm
build_index.cpython-36.pyc20680644editdlrm
concat.cpython-36.pyc40630644editdlrm
constant_weight.cpython-36.pyc16870644editdlrm
conv.cpython-36.pyc32440644editdlrm
dropout.cpython-36.pyc17270644editdlrm
fc.cpython-36.pyc61590644editdlrm
fc_without_bias.cpython-36.pyc18910644editdlrm
fc_with_bootstrap.cpython-36.pyc86530644editdlrm
feature_sparse_to_dense.cpython-36.pyc45710644editdlrm
functional.cpython-36.pyc29350644editdlrm
gather_record.cpython-36.pyc28860644editdlrm
homotopy_weight.cpython-36.pyc31370644editdlrm
label_smooth.cpython-36.pyc26460644editdlrm
last_n_window_collector.cpython-36.pyc17790644editdlrm
layers.cpython-36.pyc137220644editdlrm
layer_normalization.cpython-36.pyc31280644editdlrm
margin_rank_loss.cpython-36.pyc18080644editdlrm
merge_id_lists.cpython-36.pyc19840644editdlrm
pairwise_similarity.cpython-36.pyc23650644editdlrm
position_weighted.cpython-36.pyc19850644editdlrm
random_fourier_features.cpython-36.pyc25500644editdlrm
reservoir_sampling.cpython-36.pyc20150644editdlrm
sampling_train.cpython-36.pyc20730644editdlrm
sampling_trainable_mixin.cpython-36.pyc18730644editdlrm
select_record_by_context.cpython-36.pyc25680644editdlrm
semi_random_features.cpython-36.pyc45570644editdlrm
sparse_dropout_with_replacement.cpython-36.pyc23790644editdlrm
sparse_feature_hash.cpython-36.pyc28900644editdlrm
sparse_itemwise_dropout_with_replacement.cpython-36.pyc24470644editdlrm
sparse_lookup.cpython-36.pyc125140644editdlrm
split.cpython-36.pyc19240644editdlrm
tags.cpython-36.pyc27840644editdlrm
uniform_sampling.cpython-36.pyc21020644editdlrm
__init__.cpython-36.pyc10480644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/caffe2/python/layers/__pycache__/layers.cpython-36.pyc (13722B)
3 EgD@sDddlZddlmZddlZddlmZddlmZm Z m Z m Z m Z ddl mZejeZejeje jejZe jejejZe jejZe jejejZd(dd Zd d Zd d Z ddZ!ddZ"Gddde#Z$iZ%ddZ&ddZ'ddZ(ddZ)edddgZ*Gdd d e#Z+d!d"Z,ed#d$d%gZ-Gd&d'd'e#Z.dS))N) namedtuple) caffe2_pb2)coreschemascopeutils workspace) TagContextTFcCsp|tkr0tj|t|||dp.tj|t|||dS|tkr`tj|t|||dp^tj|t|||dStj||SdS)N)check_field_namescheck_field_typescheck_field_metas)IdListrZ equal_schemasIdListWithEvicted IdScoreListIdScoreListWithEvicted)recordZoriginal_schemar r r rG/usr/local/lib64/python3.6/site-packages/caffe2/python/layers/layers.pyalmost_equal_schemass6rcCs`t|trd}n"t|tddr$d}ntdj|||jdk sXtdjt||||S)NvaluesF)r z values:keyszNot implemented for {}zBlob {} doesn't have metadata)rr rNotImplementedErrorformatmetadataAssertionErrorstr)rkeyrrrget_key?s  rcCst|}|jjS)N)rrcategorical_limit)rrrrrget_categorical_limitNsrcCs |djjS)Nlengths)rexpected_value)rrrrget_avg_lengthSsr!cCsx|jD]}d\}}|js*tjdd}nb|jjsP|jj}|jj}tjdd}n<|jj}|jj}tj|jjj|jjj|jjj d|jjj d}t j |j t js|dkstd|jtj|||dq WdS)NT)feature_is_request_only) feature_type feature_names feature_idsr"desired_hash_sizez7categorical_limit shouldn't be set for no-integer field)rr feature_specs)NN) all_scalarsrrZ FeatureSpecr'rr r#r$r%r&npZ issubdtypeZ field_typeintegerrZ set_metadataZMetadata)fieldfrr r'rrrset_request_onlyWs0 r-c@s eZdZdZdZdZdZdZdS)InstantiationContextz= List of contexts where layer could be instantitated Zaccumulate_predevalZ predictionZtrainingN)__name__ __module__ __qualname____doc__ACCUMULATE_PREDEVAL PREDICTIONTRAININGrrrrr.zs r.cCs"|tkstdj||t|<dS)Nz{0} already exists)_LAYER_REGISTRYrr)nameZlayerrrrregister_layersr:cCs|tkS)N)r8)r9rrr layer_existssr;cCst|S)N)r8)r9rrrget_layer_classsr<cOst|||S)N)r8)Z layer_nameargskwargsrrr create_layersr? LayerPsParamZ sparse_keyZaverage_lengthc@sZeZdZdddZeddZejddZeddZejd dZd d Zd d Z dS)LayerParameterNcCsFt|tjstdjt|d|_||_||_||_ ||_ ||_ dS)Nz!expect {0} to be a blob reference) isinstancerZ BlobReferencerrr_shape parameter optimizer initializerps_param regularizer)selfrDrErFrGrHrrr__init__s zLayerParameter.__init__cCs|jS)N) _initializer)rIrrrrFszLayerParameter.initializercCsH|dks,tjt|dds,tdjt|||_|dk rD|j|_dS)Ntypez-initializer expects an operator, got type: {}) rZ IsOperatorgetattrrrrLrK_infer_shape_from_initializershape)rIoprrrrFs  cCs|jS)N)rC)rIrrrrOszLayerParameter.shapecCs2|jdks(|j|ks(tdj||j|||_dS)NzBinconsistent shape for layer parameter: {}, expect: {}, but got {})rOrrrC)rIrOrrrrOscCsx$|jjD]}|jdkr t|jSq Wtjdy`tjd}|j j j |jg|j |j d}|j|j g|tj|tj|j}tj|Stk r}z&tjdj|j |jj|tjdSd}~XnXWdQRXdS)NrOZmodel_init_by_loading_paramsZ shape_checkerrCz6Cannot infer the shape of blob {} from operator {}: {})rFargr9listintsrZWorkspaceGuardrZNet_netrPextendNextScopedBlobrDZShapeZ RunNetOnceZ FetchBlobtolistZResetWorkspace RuntimeErrorloggerwarningrrL)rIrQnetZ shape_blobrOexprrrrNs&    z,LayerParameter._infer_shape_from_initializercCs t|jS)N)rrD)rIrrr__str__szLayerParameter.__str__)NNNNN) r0r1r2rJpropertyrFsetterrOrNr]rrrrrAs   rAcCsFt|jdkrdSx,|jD] }|o8|jo8t|jddsdSqWdS)NrFr"T)lenZfield_metadatar'rM)scalarrrrris_request_only_scalarsrbAccessedFeaturesrLidsc@seZdZd0ddZddZddZedd Zed d Zed d Z e j dd Z eddZ e j ddZ ddZ ddZ ddZddZddZd1ddZddZdejfd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/ZdS)2 ModelLayerNcKs|j||_||_||_||_|r@t|ts2|g}|j||_nd|_d|_t |j dkrbd|_x |j D]}t |sld|_PqlWd|_ d|_ d|_d|_d|_t|pg|_|jjtjjg|_d|_d|_dS)aw Base class for model layers. Layer is an abstraction that allows to provide model description in terms of meta-operators, where each of the meta-operators can have different implementations for training, evaluation and prediction, that are instantiated later. As an example SampledSoftmax can do something related to sampling depending on supervision during the training and just apply softmax if it's used for prediction/evaluation. All inputs/outputs from layers are represented as a record (instance of schema bounded to blobs) and are accessible through input_record and output_schema. If Layer needs to have only a subset of inputs/provides subset of outputs during the inference - it should provide predict_input_record and predict_output_schema correspondingly (those records are expected to be a subset of input_record/output_schema). Each layer has a list of Tags associated with it, that depends on current context and arguments. It's possible to use those tags during the instantiation time. NTrF)Znext_layer_namer9modelr> _input_recordrBrR_predict_input_record request_onlyr`r(rbZprecomputation_request_onlyZprecomputation_object_only_output_schema_predict_output_schemaZeval_output_schemasettagsupdater currentparams_export_output_for_metrics_export_params_for_metrics)rIrfprefix input_recordZpredict_input_record_fieldsrmr>rarrrrJs4  zModelLayer.__init__cCs|jjS)N) __class__r0)rIrrrget_type9szModelLayer.get_typecCs8|jdk std|jdks4tj|j|js4tddS)NzSchema is not initializedz:predict_output_schema is not a subset of the output_schema)rjrrkrZis_schema_subset)rIrrr_check_output_schema<szModelLayer._check_output_schemacCs |jp |jS)N)rhrg)rIrrrpredict_input_recordBszModelLayer.predict_input_recordcCs|jS)N)rg)rIrrrrtFszModelLayer.input_recordcCs|j|jp|jS)N)rwrkrj)rIrrrpredict_output_schemaJsz ModelLayer.predict_output_schemacCs|jdkst||_dS)N)rkr)rI output_schemarrrryOscCs|jrt|j|j|jS)N)rir-rjrw)rIrrrrzTs zModelLayer.output_schemacCs|jdkst||_dS)N)rjr)rIrzrrrrz[scCs|jS)N)rp)rIrrrget_parameters`szModelLayer.get_parameterscCsgS)zsz-ModelLayer.add_init_params..N) rprFrZCurrentDeviceScopeZHasFieldrZ OperatorDefZCopyFromranyrTrPrU)rIinit_netparamZcurrent_device_scoper)rradd_init_paramsqs    zModelLayer.add_init_paramscsbtj|jddH|jj||||||dtfdd|jDsFt|jjj SQRXdS)NT)reset) param_namerOrFrErGrHc3s|]}j|jkVqdS)N)rD)rp)rrrrsz*ModelLayer.create_param..) r NameScoper9rf create_paramallrprappendrD)rIrrOrFrErGrHr)rrrs zModelLayer.create_paramc Cs*tj|jdd|jjj|SQRXdS)NT)r)rrr9rfr[rV)rIr9rrrget_next_blob_referencesz"ModelLayer.get_next_blob_referencec Cstj|j|tjtjtjhkr.|s.td|r<|j||tj krR|j |n6|tjkrh|j |n |tjkr~|j |n |j ||tj tjhkr|jr|j|WdQRXdS)z Adds layer trainig or initialization operators to the passed in net. init_net can be None and can be called independently from add_init_params z4Only prediction and eval context don't need init_netN)rrr9r.r6r5r4rrr7 add_train_ops add_eval_opsadd_ops_to_accumulate_predadd_opsrradd_param_copy_operators)rIr[rcontextrrr add_operatorss$          zModelLayer.add_operatorscCstdS)N)r)rIr[rrrrszModelLayer.add_opscCs|j|dS)N)r)rIr[rrrrszModelLayer.add_eval_opscCs|j|dS)N)r)rIr[rrrrszModelLayer.add_train_opscCs|j|dS)N)r)rIr[rrrrsz%ModelLayer.add_ops_to_accumulate_predcCs:x4|jD]*}|jjt|j}|j|jg|jqWdS)N)rprfZmetrics_schemarrDZCopyZ field_blobs)rIr[rparam_copy_refrrrrs z#ModelLayer.add_param_copy_operatorscCs$d|_|jd}|jj||jdS)NTz/output)rqr9rfadd_metric_fieldrz)rIZ export_namerrrexport_output_for_metricss z$ModelLayer.export_output_for_metricscCsJd|_x>|jD]4}|jt|jddd}|jjt|j|qWdS)NT/_copy)rrrprrsplitrfrrD)rIrrrrrexport_params_for_metricss  z$ModelLayer.export_params_for_metrics)NN)NN)r0r1r2rJrvrwr^rxrtryr_rzr{r|r}r~rrrr.r7rrrrrrrrrrrrres2 7    ! re)TTF)/logging collectionsrZnumpyr)Z caffe2.protorZ caffe2.pythonrrrrrZcaffe2.python.layers.tagsr getLoggerr0rYsetLevelINFOListZint64r ZMapZfloat32rZListWithEvictedrZMapWithEvictedrrrrr!r-objectr.r8r:r;r<r?r@rArbrcrerrrrs:        "#J