Module Import alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr AugAssignDiv NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr BinOpMult Call NameLoad NameLoad Num AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore TupleLoad Num Num Assign NameStore Call NameLoad Call NameLoad NameLoad Call NameLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr For TupleStore NameStore NameStore NameLoad body Assign NameStore BinOpMult NameLoad Call NameLoad NameLoad While BoolOpAnd CompareGt NameLoad Num CompareLt NameLoad NameLoad body Assign SubscriptStore NameLoad Index BinOpAdd BinOpMult NameLoad Num Num NameLoad AugAssignSub NameStore BinOpSub Num SubscriptLoad NameLoad Index NameLoad AugAssignAdd NameStore Num Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index BinOpMult NameLoad Num NameLoad AugAssignAdd NameStore Num For NameStore Call NameLoad NameLoad Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index BinOpAdd BinOpMult NameLoad Num Num Num Assert Call AttributeLoad CompareLt NameLoad Call NameLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad orelse Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num Num NameLoad Assign NameStore BinOpMult NameLoad Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad CompareLt SubscriptLoad AttributeLoad NameLoad attr Index NameLoad BinOpSub NameLoad NameLoad attr AttributeLoad NameLoad attr Return SubscriptLoad AttributeLoad NameLoad attr Index BinOpAdd BinOpMult NameLoad Num NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr keyword NameLoad keyword AttributeLoad NameLoad attr Assign NameStore Call Call AttributeLoad NameLoad attr Str Str Str Str NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Return NameLoad decorator_list decorator_list
N/A N/A numpy chainer cuda WalkerAlias N/A object N/A N/A Implementation of Walker's alias method.

    This method generates a random sample from given probabilities
    :math:`p_1, \dots, p_n` in :math:`O(1)` time.
    It is more efficient than :func:`~numpy.random.choice`.
    This class works on both CPU and GPU.

    Args:
        probs (float list): Probabilities of entries. They are normalized with
                            `sum(probs)`.

    See: `Wikipedia article <https://en.wikipedia.org/wiki/Alias_method>`_

     __init__ N/A N/A self probs N/A N/A N/A prob N/A N/A numpy array probs N/A numpy float32 N/A prob N/A N/A numpy sum prob N/A threshold N/A N/A numpy ndarray N/A len probs N/A numpy float32 N/A values N/A N/A numpy ndarray N/A N/A len probs 2 N/A numpy int32 N/A N/A il ir N/A 0 0 N/A pairs N/A list N/A zip prob N/A range N/A len probs N/A N/A N/A pairs sort N/A N/A prob i pairs N/A N/A p N/A prob N/A len probs N/A N/A N/A p 1 N/A ir il N/A N/A N/A values N/A N/A N/A ir 2 1 i N/A p N/A 1.0 N/A threshold N/A ir N/A ir 1 N/A N/A threshold N/A il p N/A N/A values N/A N/A il 2 i N/A il 1 N/A i N/A range ir N/A len probs N/A N/A N/A values N/A N/A N/A i 2 1 0 N/A N/A N/A N/A values N/A len threshold all N/A N/A self threshold threshold N/A N/A self values values N/A N/A self use_gpu False N/A to_gpu N/A N/A self N/A N/A N/A Make a sampler GPU mode.

         N/A N/A N/A self use_gpu N/A N/A N/A self threshold N/A N/A cuda to_gpu N/A self threshold N/A N/A self values N/A N/A cuda to_gpu N/A self values N/A N/A self use_gpu True N/A to_cpu N/A N/A self N/A N/A N/A Make a sampler CPU mode.

         N/A N/A self use_gpu N/A N/A N/A self threshold N/A N/A cuda to_cpu N/A self threshold N/A N/A self values N/A N/A cuda to_cpu N/A self values N/A N/A self use_gpu False N/A sample N/A N/A self shape N/A N/A N/A Generates a random sample based on given probabilities.

        Args:
            shape (tuple of int): Shape of a return value.

        Returns:
            Returns a generated array with the given shape. If a sampler is in
            CPU mode the return value is a :class:`numpy.ndarray` object, and
            if it is in GPU mode the return value is a :class:`cupy.ndarray`
            object.
         N/A N/A self use_gpu N/A N/A N/A N/A self sample_gpu shape N/A N/A N/A N/A self sample_cpu shape N/A sample_cpu N/A N/A self shape N/A N/A N/A ps N/A N/A N/A numpy random uniform 0 1 shape N/A pb N/A ps N/A len N/A self threshold N/A index N/A N/A pb astype N/A numpy int32 N/A left_right N/A N/A N/A N/A N/A self threshold N/A index N/A pb index astype N/A numpy int32 N/A N/A N/A self values N/A N/A N/A index 2 left_right N/A sample_gpu N/A N/A self shape N/A N/A N/A ps N/A N/A N/A N/A cuda cupy random uniform size shape dtype N/A numpy float32 N/A vs N/A N/A N/A cuda elementwise T ps, raw T threshold , raw S values, int32 b int32 vs 
            T pb = ps * b;
            int index = __float2int_rd(pb);
            // fill_uniform sometimes returns 1.0, so we need to check index
            if (index >= b) {
              index = 0;
            }
            int lr = threshold[index] < pb - index;
            vs = values[index * 2 + lr];
             walker_alias_sample ps N/A self threshold N/A self values N/A len N/A self threshold N/A vs N/A N/A