L iddlmZmZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZmZd gZGd d e Zy) )OptionalUnionN)Tensor) constraints) Dirichlet)ExponentialFamily) broadcast_all)_Number_sizeBetac ^eZdZdZej ej dZejZdZ dde e e fde e e fde eddffd Zdfd Zede fd Zede fd Zede fd Zddede fdZdZdZede fdZede fdZedee e ffdZdZxZS)r ar Beta distribution parameterized by :attr:`concentration1` and :attr:`concentration0`. Example:: >>> # xdoctest: +IGNORE_WANT("non-deterministic") >>> m = Beta(torch.tensor([0.5]), torch.tensor([0.5])) >>> m.sample() # Beta distributed with concentration concentration1 and concentration0 tensor([ 0.1046]) Args: concentration1 (float or Tensor): 1st concentration parameter of the distribution (often referred to as alpha) concentration0 (float or Tensor): 2nd concentration parameter of the distribution (often referred to as beta) concentration1concentration0TNrr validate_argsreturncVt|tr:t|tr*tjt |t |g}n't ||\}}tj ||gd}t|||_t|)|jj|y)Nr) isinstancer torchtensorfloatr stackr _dirichletsuper__init__ _batch_shape)selfrrrconcentration1_concentration0 __class__s ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/torch/distributions/beta.pyrz Beta.__init__)s ng .:ng3V,1LL~&n(=>- ).;. *NN-2KK0"- )$ )  55]Sc|jt|}tj|}|jj ||_t t||d|j|_|S)NFr) _get_checked_instancer rSizerexpandrr_validate_args)r batch_shape _instancenewr!s r"r'z Beta.expand?s`((y9jj- // < dC!+U!C!00 r#cN|j|j|jzz SNrrs r"meanz Beta.meanGs$""d&9&9Drgs7" +3<3& (eG eGr#