/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__/fc.cpython-36.pyc (6159B)
3 EgP$@s^ddlmZddlmZddlmZddlmZddlZddl Z ddZ Gdd d eeZ dS) )get_current_scope)schema) ModelLayer)SamplingTrainableMixinNcCs|dkstdj||S)Nfp32fp16znOnly support fp32 and fp16 for the fully connected layer in the predictor net, the provided FC precision is {})rr)AssertionErrorformat) fc_versionr C/usr/local/lib64/python3.6/site-packages/caffe2/python/layers/fc.pyget_fc_predictor_versions r c s^eZdZdfdd Zedd Zd d Zd d ZddZddZ ddZ e ddZ Z S)FCNfcF?c stt|j|||f|t|tjs2tdj|t|j dj dksPtd| dksftdj| | |_ t j |j dj | dd}|dkstdj|d|_| dk r6t| dkstd| \}}|dk s|dk std |dkp|dkp||kstd i|_|dk r"||jd <|dk r6||jd <|dkrDd }tj||}|r\|nd| |df}|rv|nd| |df}tj| |||_||_|jdkst|jdkr|r||gn||g}|jd|||| d|_|jd|g||| d|_ng|_g|_xtt|jD]f\}}|r,||gn||g}|jj|jdj||||| d|jj|jdj||g||| dqW| dkr|f}n,t|j dj d| d}t||g}tjt j|f|jd|_dS)NzIncorrect input type {}rz1FC expects limited dimensions of the input tensorrzaxis {} should >= 1.z'FC expects input dimensions > 0, got {}zUclip_param must be a tuple / list of length 2 and in the form of (clip_min, clip max)z8clip_min, and clip_max in clip_param cannot both be Nonez?clip_param = [clip_min, clip_max] must have clip_min < clip_maxminmaxg?Z UniformFill)rrw) param_nameshape initializerZ optimizerZ regularizerbzw_sub_{}zb_sub_{}output) superr__init__ isinstancerZScalarrr lenZ field_typesraxisnpprod clip_argsmathsqrtcalculate_fc_output_dimsoutput_dim_vec transposedZ create_paramrrw_vecb_vec enumerateappendlisttupleZfloat32Zget_next_blob_reference output_schema)selfmodel input_recordZ output_dimsZ weight_initZ bias_initZ weight_optimZ bias_optimnameZ weight_regZbias_regZ clip_param max_fc_sizerr'Z#uniform_weight_init_scale_numeratorkwargsZ input_dimsZclip_minZclip_maxZscaleZ weight_shapeidx output_dimZ output_shape) __class__r r rs                 z FC.__init__cCsz| s|dkrdS||ks*tdj||ttj||}ttj|d|d}|g|d}|j|t||S)NrzwCurrently we split along the output dimension. So we need max_fc_size >= input_dim. But, max_fc_size: {}, input_dim: {}r)rr intr floorr+sum)r3Z input_dimr6Zoutput_dim_allowedZnum_fcr&r r r r%ws zFC.calculate_fc_output_dimscCs|dkr\|jr4|j|jj||fd|ji|jS|j|jj||fd|ji|jSn<|dkr|j|jj||fd|ji|jStdj |dS)z Args: net: the caffe2 net to insert operator params: weight and bias for FC outputs: the output blobs version: support fp32 and fp16 for now. rrrzunsupported FC type version {}N) r'Z FCTransposedr1 field_blobsrr4rZ FbFCPacked Exceptionr )r/netparamsoutputsversionr r r _insert_fc_opss&      zFC._insert_fc_opsc s@|jdk rNfdd|D}x,t||D]\}}j|g|gf|jq(W|}|jdksft|jdkr~|j||jj|n|dtt|d}|tt|dd}t|t|kst g} xNt t|jD]<} j dj | } |j|| || g| g|} | j | qWj| |jj|jjddgdS) z Args: params : the weight and bias, passed by either add_ops or add_train_ops function version : fp16 or fp32, might support in8 in the future. Ncsg|]}jdt|qS)z clipped_%s)NextScopedBlobstr).0p)r=r r szFC._add_ops..rrz output_sub_{}rZ _concat_dims)r"zipZClipr&rrAr.r;r8rrangerBr r+ZConcat) r/r=r>r@Zclipped_paramsrEcpr(r)Zoutput_blob_veciZ output_blobZ insert_retr )r=r _add_opss*   z FC._add_opscCs0tjtjddi}|d}|j||j|dS)zFBoth the predict net and the eval net will call this function r rN)rgetr __name__rK param_blobs)r/r= version_infoZpredictor_fc_fp_versionr r r add_opssz FC.add_opscCs|j||jddS)Nr)rKZtrain_param_blobs)r/r=r r r add_train_opsszFC.add_train_opscCs*|jdkst|jdkr |jgS|jSdS)Nr)r&rrr()r/r r r get_fp16_compatible_parameterssz!FC.get_fp16_compatible_parameterscCs4|jdkst|jdkr$|j|jgS|j|jSdS)Nr)r&rrrr(r))r/r r r rNs zFC.param_blobs) NNNNrNNNNrFr)rM __module__ __qualname__r staticmethodr%rArKrPrQrRpropertyrN __classcell__r r )r7r rsY !# r) Zcaffe2.python.helpers.arg_scoperZ caffe2.pythonrZcaffe2.python.layers.layersrZ-caffe2.python.layers.sampling_trainable_mixinrr#Znumpyr r rr r r r s