/usr/local/lib64/python3.6/site-packages/torch/distributions/__pycache__
NameSizeModeActions
bernoulli.cpython-36.pyc44450644editdlrm
beta.cpython-36.pyc36820644editdlrm
binomial.cpython-36.pyc47610644editdlrm
categorical.cpython-36.pyc58130644editdlrm
cauchy.cpython-36.pyc33100644editdlrm
chi2.cpython-36.pyc14190644editdlrm
constraints.cpython-36.pyc222170644editdlrm
constraint_registry.cpython-36.pyc98950644editdlrm
continuous_bernoulli.cpython-36.pyc80770644editdlrm
dirichlet.cpython-36.pyc40850644editdlrm
distribution.cpython-36.pyc118220644editdlrm
exponential.cpython-36.pyc33630644editdlrm
exp_family.cpython-36.pyc28760644editdlrm
fishersnedecor.cpython-36.pyc32120644editdlrm
gamma.cpython-36.pyc34550644editdlrm
geometric.cpython-36.pyc41830644editdlrm
gumbel.cpython-36.pyc28640644editdlrm
half_cauchy.cpython-36.pyc29300644editdlrm
half_normal.cpython-36.pyc28210644editdlrm
independent.cpython-36.pyc45060644editdlrm
kl.cpython-36.pyc258440644editdlrm
kumaraswamy.cpython-36.pyc30400644editdlrm
laplace.cpython-36.pyc34420644editdlrm
lkj_cholesky.cpython-36.pyc45750644editdlrm
logistic_normal.cpython-36.pyc23200644editdlrm
log_normal.cpython-36.pyc24380644editdlrm
lowrank_multivariate_normal.cpython-36.pyc80740644editdlrm
mixture_same_family.cpython-36.pyc70730644editdlrm
multinomial.cpython-36.pyc50200644editdlrm
multivariate_normal.cpython-36.pyc85340644editdlrm
negative_binomial.cpython-36.pyc41490644editdlrm
normal.cpython-36.pyc41380644editdlrm
one_hot_categorical.cpython-36.pyc51730644editdlrm
pareto.cpython-36.pyc25160644editdlrm
poisson.cpython-36.pyc26820644editdlrm
relaxed_bernoulli.cpython-36.pyc55950644editdlrm
relaxed_categorical.cpython-36.pyc55630644editdlrm
studentT.cpython-36.pyc34830644editdlrm
transformed_distribution.cpython-36.pyc73350644editdlrm
transforms.cpython-36.pyc429810644editdlrm
uniform.cpython-36.pyc35800644editdlrm
utils.cpython-36.pyc68020644editdlrm
von_mises.cpython-36.pyc50790644editdlrm
weibull.cpython-36.pyc27370644editdlrm
__init__.cpython-36.pyc59810644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/distributions/__pycache__/utils.cpython-36.pyc (6802B)
3 Eg4@sddlmZddlmZddlZddljjZddl m Z m Z ddl m Z dZddZd d Zd d ZdddZddZdddZGdddZGdddeeZdddZdddZdS) )update_wrapper)NumberN)DictAny)has_torch_functiongox?cstdd|Dstdtdd|Dsttjdx*|D]"}t|tjr@t|j|jdPq@Wfdd|D}tj |Stj |S) a Given a list of values (possibly containing numbers), returns a list where each value is broadcasted based on the following rules: - `torch.*Tensor` instances are broadcasted as per :ref:`_broadcasting-semantics`. - numbers.Number instances (scalars) are upcast to tensors having the same size and type as the first tensor passed to `values`. If all the values are scalars, then they are upcasted to scalar Tensors. Args: values (list of `numbers.Number`, `torch.*Tensor` or objects implementing __torch_function__) Raises: ValueError: if any of the values is not a `numbers.Number` instance, a `torch.*Tensor` instance, or an instance implementing __torch_function__ css.|]&}t|tjp$t|fp$t|tVqdS)N) isinstancetorchTensorrr).0vr E/usr/local/lib64/python3.6/site-packages/torch/distributions/utils.py sz broadcast_all..zqInput arguments must all be instances of numbers.Number, torch.Tensor or objects implementing __torch_function__.cSs"g|]}t|tjpt|fqSr )rrr r)r r r r r sz!broadcast_all..)dtype)rdevicecs4g|],}t|tjst|fr"|n tj|fqSr )rrr rZtensor)r r )optionsr r r%s) all ValueErrordictrZget_default_dtyperr rrZbroadcast_tensors)valuesvalue new_valuesr )rr broadcast_all s     rcCsBtjjr.tjtj|||dtj|||dStj|||djS)N)rr)r_C_get_tracing_statenormalZzerosZonesemptyZnormal_)shaperrr r r _standard_normal+s rcCs0|dkr |S|jd| d}|j|jdS)z Sum out ``dim`` many rightmost dimensions of a given tensor. Args: value (Tensor): A tensor of ``.dim()`` at least ``dim``. dim (int): The number of rightmost dims to sum out. rN)r!r!)rZreshapesum)rdimZrequired_shaper r r _sum_rightmost3sr$FcCs|rtj|Stj|ddS)a Converts a tensor of logits into probabilities. Note that for the binary case, each value denotes log odds, whereas for the multi-dimensional case, the values along the last dimension denote the log probabilities (possibly unnormalized) of the events. r )r#r!)rZsigmoidFZsoftmax)Zlogits is_binaryr r r logits_to_probsAs r'cCs tj|jj}|j|d|dS)Nr )minmax)rfinforepsclamp)probsr+r r r clamp_probsMsr.cCs,t|}|r"tj|tj| Stj|S)a$ Converts a tensor of probabilities into logits. For the binary case, this denotes the probability of occurrence of the event indexed by `1`. For the multi-dimensional case, the values along the last dimension denote the probabilities of occurrence of each of the events. )r.rloglog1p)r-r&Z ps_clampedr r r probs_to_logitsRsr1c@s"eZdZdZddZdddZdS) lazy_propertyz Used as a decorator for lazy loading of class attributes. This uses a non-data descriptor that calls the wrapped method to compute the property on first call; thereafter replacing the wrapped method into an instance attribute. cCs||_t||dS)N)wrappedr)selfr3r r r __init__fszlazy_property.__init__Nc CsD|dkrt|jStj|j|}WdQRXt||jj||S)N)_lazy_property_and_propertyr3rZ enable_gradsetattr__name__)r4instanceZobj_typerr r r __get__js   zlazy_property.__get__)N)r8 __module__ __qualname____doc__r5r:r r r r r2_sr2c@seZdZdZddZdS)r6zWe want lazy properties to look like multiple things. * property when Sphinx autodoc looks * lazy_property when Distribution validate_args looks cCs tj||S)N)propertyr5)r4r3r r r r5ysz$_lazy_property_and_property.__init__N)r8r;r<r=r5r r r r r6ssr6cCs|jd}tjj rJ|| ks(||krJtd|d| d|ddtj||jd}||jd d|dk}|d|f}|S) z Convert a `D x D` matrix or a batch of matrices into a (batched) vector which comprises of lower triangular elements from the matrix in row order. r zdiag (z) provided is outside [z, z].)r.r!r!)rrrrrarangerview)matdiagnr? tril_maskvecr r r tril_matrix_to_vec}s " rFcCsdd| dd|dd|jd dt||ddd}tj|jj}tjj rt|||krt d|jd ddt |tj rtj|j nt|}|j |jd dtj||f}tj||jd }||jdd|dk}||d |f<|S)z Convert a vector or a batch of vectors into a batched `D x D` lower triangular matrix containing elements from the vector in row order. r g?zThe size of last dimension is z which cannot be expressed as z3the lower triangular part of a square D x D matrix.N)r.r!r!r!r!)rabsrr*rr+rrroundrrr longZ new_zerosSizer?rr@)rErBrCr+rAr?rDr r r vec_to_tril_matrixsH"" rN)F)F)r)r) functoolsrZnumbersrrZtorch.nn.functionalnnZ functionalr%typingrrZtorch.overridesrZeuler_constantrrr$r'r.r1r2r>r6rFrNr r r r s