/usr/local/lib64/python3.6/site-packages/torch/cuda/__pycache__
NameSizeModeActions
comm.cpython-36.pyc3720644editdlrm
error.cpython-36.pyc1430644editdlrm
graphs.cpython-36.pyc158110644editdlrm
memory.cpython-36.pyc217170644editdlrm
nccl.cpython-36.pyc34440644editdlrm
nvtx.cpython-36.pyc19660644editdlrm
profiler.cpython-36.pyc16320644editdlrm
random.cpython-36.pyc55200644editdlrm
sparse.cpython-36.pyc1440644editdlrm
streams.cpython-36.pyc94850644editdlrm
_utils.cpython-36.pyc18920644editdlrm
__init__.cpython-36.pyc232100644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/cuda/__pycache__/random.cpython-36.pyc (5520B)
3 Egg @s ddlZddlmZmZmZmZddlmZmZm Z m Z ddlm Z ddd d d d d ddg Z dee eejfe dddZee dddZd e ee eejfdddd Zee dddd Ze dddd Ze dddd Zdddd ZddddZe dddZdS)!N)castIterableListUnion) _lazy_init _lazy_call device_countcurrent_device)Tensor get_rng_stateget_rng_state_all set_rng_stateset_rng_state_all manual_seedmanual_seed_allseedseed_all initial_seedcuda)devicereturncCsZtt|trtj|}nt|tr2tjd|}|j}|dkrFt}tjj |}|j S)aSReturns the random number generator state of the specified GPU as a ByteTensor. Args: device (torch.device or int, optional): The device to return the RNG state of. Default: ``'cuda'`` (i.e., ``torch.device('cuda')``, the current CUDA device). .. warning:: This function eagerly initializes CUDA. rN) r isinstancestrtorchrintindexr rdefault_generatorsZ get_state)ridxdefault_generatorr!=/usr/local/lib64/python3.6/site-packages/torch/cuda/random.pyr s      )rcCs*g}x ttD]}|jt|qW|S)zRReturns a list of ByteTensor representing the random number states of all devices.)ranger appendr )resultsir!r!r"r"s) new_staterrcsT|jtjdttr$tjnttr:tjdfdd}t|dS)a0Sets the random number generator state of the specified GPU. Args: new_state (torch.ByteTensor): The desired state device (torch.device or int, optional): The device to set the RNG state. Default: ``'cuda'`` (i.e., ``torch.device('cuda')``, the current CUDA device). )Z memory_formatrcs6ttjj}|dkrt}tjj|}|jdS)N)rrrrr rrZ set_state)rr )rnew_state_copyr!r"cb9s  zset_rng_state..cbN)clonerZcontiguous_formatrrrrr)r'rr)r!)rr(r"r+s    ) new_statesrcCs$xt|D]\}}t||q WdS)zSets the random number generator state of all devices. Args: new_states (Iterable of torch.ByteTensor): The desired state for each deviceN) enumerater)r+r&stater!r!r"rCs)rrcs$tfdd}t|dddS)aSets the seed for generating random numbers for the current GPU. It's safe to call this function if CUDA is not available; in that case, it is silently ignored. Args: seed (int): The desired seed. .. warning:: If you are working with a multi-GPU model, this function is insufficient to get determinism. To seed all GPUs, use :func:`manual_seed_all`. cs t}tjj|}|jdS)N)r rrrr)rr )rr!r"r)Zs zmanual_seed..cbT)rN)rr)rr)r!)rr"rLs  cs$tfdd}t|dddS)zSets the seed for generating random numbers on all GPUs. It's safe to call this function if CUDA is not available; in that case, it is silently ignored. Args: seed (int): The desired seed. cs.x(ttD]}tjj|}|jq WdS)N)r#r rrrr)r&r )rr!r"r)ls zmanual_seed_all..cbT)rN)rr)rr)r!)rr"rbs cCsdd}t|dS)atSets the seed for generating random numbers to a random number for the current GPU. It's safe to call this function if CUDA is not available; in that case, it is silently ignored. .. warning:: If you are working with a multi-GPU model, this function will only initialize the seed on one GPU. To initialize all GPUs, use :func:`seed_all`. cSst}tjj|}|jdS)N)r rrrr)rr r!r!r"r)}s zseed..cbN)r)r)r!r!r"rts cCsdd}t|dS)zSets the seed for generating random numbers to a random number on all GPUs. It's safe to call this function if CUDA is not available; in that case, it is silently ignored. cSsPd}d}xBttD]4}tjj|}|s>|j|j}d}q|j|qWdS)NrFT)r#r rrrrrr)Z random_seedZseededr&r r!r!r"r)s zseed_all..cbN)r)r)r!r!r"rs cCs tt}tjj|}|jS)zzReturns the current random seed of the current GPU. .. warning:: This function eagerly initializes CUDA. )rr rrrr)rr r!r!r"rs )r)r)rtypingrrrrrrr r r __all__rrrr rrrrrrrrr!r!r!r"s