Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/__init__.pyi +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_aoti.pyi +24 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_cpu.pyi +13 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_cudnn.pyi +14 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_cusparselt.pyi +1 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_autograd.pyi +26 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_VF.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/__config__.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/__future__.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/__init__.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_classes.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_compile.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_custom_ops.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_environment.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_guards.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_jit_internal.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_linalg_utils.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_lobpcg.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_lowrank.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_namedtensor_internals.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_ops.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_size_docs.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_sources.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_storage_docs.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_tensor.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_tensor_str.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_utils.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_utils_internal.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_vmap_internals.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_weights_only_unpickler.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/functional.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/hub.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/library.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/quasirandom.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/random.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/return_types.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/serialization.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/storage.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/torch_version.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/types.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/version.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__init__.py +172 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/__init__.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/bernoulli.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/beta.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/binomial.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/categorical.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/cauchy.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/chi2.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/constraint_registry.cpython-310.pyc +0 -0
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/__init__.pyi
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_aoti.pyi
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ctypes import c_void_p
|
| 2 |
+
|
| 3 |
+
from torch import Tensor
|
| 4 |
+
|
| 5 |
+
# Defined in torch/csrc/inductor/aoti_runner/pybind.cpp
|
| 6 |
+
|
| 7 |
+
# Tensor to AtenTensorHandle
|
| 8 |
+
def unsafe_alloc_void_ptrs_from_tensors(tensors: list[Tensor]) -> list[c_void_p]: ...
|
| 9 |
+
def unsafe_alloc_void_ptr_from_tensor(tensor: Tensor) -> c_void_p: ...
|
| 10 |
+
|
| 11 |
+
# AtenTensorHandle to Tensor
|
| 12 |
+
def alloc_tensors_by_stealing_from_void_ptrs(
|
| 13 |
+
handles: list[c_void_p],
|
| 14 |
+
) -> list[Tensor]: ...
|
| 15 |
+
def alloc_tensor_by_stealing_from_void_ptr(
|
| 16 |
+
handle: c_void_p,
|
| 17 |
+
) -> Tensor: ...
|
| 18 |
+
|
| 19 |
+
class AOTIModelContainerRunnerCpu: ...
|
| 20 |
+
class AOTIModelContainerRunnerCuda: ...
|
| 21 |
+
class AOTIModelContainerRunnerXpu: ...
|
| 22 |
+
|
| 23 |
+
# Defined in torch/csrc/inductor/aoti_package/pybind.cpp
|
| 24 |
+
class AOTIModelPackageLoader: ...
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_cpu.pyi
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from torch.types import _bool, _int
|
| 2 |
+
|
| 3 |
+
# Defined in torch/csrc/cpu/Module.cpp
|
| 4 |
+
|
| 5 |
+
def _is_avx2_supported() -> _bool: ...
|
| 6 |
+
def _is_avx512_supported() -> _bool: ...
|
| 7 |
+
def _is_avx512_vnni_supported() -> _bool: ...
|
| 8 |
+
def _is_avx512_bf16_supported() -> _bool: ...
|
| 9 |
+
def _is_amx_tile_supported() -> _bool: ...
|
| 10 |
+
def _is_amx_fp16_supported() -> _bool: ...
|
| 11 |
+
def _init_amx() -> _bool: ...
|
| 12 |
+
def _L1d_cache_size() -> _int: ...
|
| 13 |
+
def _L2_cache_size() -> _int: ...
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_cudnn.pyi
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from enum import IntEnum
|
| 2 |
+
|
| 3 |
+
# Defined in torch/csrc/cuda/shared/cudnn.cpp
|
| 4 |
+
is_cuda: bool
|
| 5 |
+
|
| 6 |
+
def getRuntimeVersion() -> tuple[int, int, int]: ...
|
| 7 |
+
def getCompileVersion() -> tuple[int, int, int]: ...
|
| 8 |
+
def getVersionInt() -> int: ...
|
| 9 |
+
|
| 10 |
+
class RNNMode(IntEnum):
|
| 11 |
+
rnn_relu = ...
|
| 12 |
+
rnn_tanh = ...
|
| 13 |
+
lstm = ...
|
| 14 |
+
gru = ...
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_cusparselt.pyi
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
def getVersionInt() -> int: ...
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/_C/_distributed_autograd.pyi
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
# This module is defined in torch/csrc/distributed/autograd/init.cpp
|
| 6 |
+
|
| 7 |
+
class DistAutogradContext:
|
| 8 |
+
def _context_id(self) -> int: ...
|
| 9 |
+
def _recv_functions(self) -> dict[int, Any]: ...
|
| 10 |
+
def _send_functions(self) -> dict[int, Any]: ...
|
| 11 |
+
def _known_worker_ids(self) -> set[int]: ...
|
| 12 |
+
|
| 13 |
+
def _new_context() -> DistAutogradContext: ...
|
| 14 |
+
def _release_context(context_id: int) -> None: ...
|
| 15 |
+
def _get_max_id() -> int: ...
|
| 16 |
+
def _is_valid_context(worker_id: int) -> bool: ...
|
| 17 |
+
def _retrieve_context(context_id: int) -> DistAutogradContext: ...
|
| 18 |
+
def _current_context() -> DistAutogradContext: ...
|
| 19 |
+
def _init(worker_id: int) -> None: ...
|
| 20 |
+
def _get_debug_info() -> dict[str, str]: ...
|
| 21 |
+
def backward(
|
| 22 |
+
context_id: int,
|
| 23 |
+
roots: list[torch.Tensor],
|
| 24 |
+
retain_graph: bool = False,
|
| 25 |
+
) -> None: ...
|
| 26 |
+
def get_gradients(context_id: int) -> dict[torch.Tensor, torch.Tensor]: ...
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_VF.cpython-310.pyc
ADDED
|
Binary file (1.25 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/__config__.cpython-310.pyc
ADDED
|
Binary file (829 Bytes). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/__future__.cpython-310.pyc
ADDED
|
Binary file (3.46 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (81.9 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_classes.cpython-310.pyc
ADDED
|
Binary file (2.57 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_compile.cpython-310.pyc
ADDED
|
Binary file (1.91 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_custom_ops.cpython-310.pyc
ADDED
|
Binary file (12.9 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_environment.cpython-310.pyc
ADDED
|
Binary file (340 Bytes). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_guards.cpython-310.pyc
ADDED
|
Binary file (30.6 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_jit_internal.cpython-310.pyc
ADDED
|
Binary file (36.4 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_linalg_utils.cpython-310.pyc
ADDED
|
Binary file (5.21 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_lobpcg.cpython-310.pyc
ADDED
|
Binary file (30.5 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_lowrank.cpython-310.pyc
ADDED
|
Binary file (9.82 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_namedtensor_internals.cpython-310.pyc
ADDED
|
Binary file (5.01 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_ops.cpython-310.pyc
ADDED
|
Binary file (35.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_size_docs.cpython-310.pyc
ADDED
|
Binary file (1.22 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_sources.cpython-310.pyc
ADDED
|
Binary file (4.21 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_storage_docs.cpython-310.pyc
ADDED
|
Binary file (1.6 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_tensor.cpython-310.pyc
ADDED
|
Binary file (49.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_tensor_str.cpython-310.pyc
ADDED
|
Binary file (16.3 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_utils.cpython-310.pyc
ADDED
|
Binary file (28.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_utils_internal.cpython-310.pyc
ADDED
|
Binary file (7.96 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_vmap_internals.cpython-310.pyc
ADDED
|
Binary file (6.94 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/_weights_only_unpickler.cpython-310.pyc
ADDED
|
Binary file (13.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/functional.cpython-310.pyc
ADDED
|
Binary file (72.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/hub.cpython-310.pyc
ADDED
|
Binary file (27.6 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/library.cpython-310.pyc
ADDED
|
Binary file (51.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/quasirandom.cpython-310.pyc
ADDED
|
Binary file (7.03 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/random.cpython-310.pyc
ADDED
|
Binary file (6.24 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/return_types.cpython-310.pyc
ADDED
|
Binary file (1.64 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/serialization.cpython-310.pyc
ADDED
|
Binary file (59.9 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/storage.cpython-310.pyc
ADDED
|
Binary file (47 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/torch_version.cpython-310.pyc
ADDED
|
Binary file (2.6 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/types.cpython-310.pyc
ADDED
|
Binary file (3.49 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/__pycache__/version.cpython-310.pyc
ADDED
|
Binary file (522 Bytes). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__init__.py
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
r"""
|
| 2 |
+
The ``distributions`` package contains parameterizable probability distributions
|
| 3 |
+
and sampling functions. This allows the construction of stochastic computation
|
| 4 |
+
graphs and stochastic gradient estimators for optimization. This package
|
| 5 |
+
generally follows the design of the `TensorFlow Distributions`_ package.
|
| 6 |
+
|
| 7 |
+
.. _`TensorFlow Distributions`:
|
| 8 |
+
https://arxiv.org/abs/1711.10604
|
| 9 |
+
|
| 10 |
+
It is not possible to directly backpropagate through random samples. However,
|
| 11 |
+
there are two main methods for creating surrogate functions that can be
|
| 12 |
+
backpropagated through. These are the score function estimator/likelihood ratio
|
| 13 |
+
estimator/REINFORCE and the pathwise derivative estimator. REINFORCE is commonly
|
| 14 |
+
seen as the basis for policy gradient methods in reinforcement learning, and the
|
| 15 |
+
pathwise derivative estimator is commonly seen in the reparameterization trick
|
| 16 |
+
in variational autoencoders. Whilst the score function only requires the value
|
| 17 |
+
of samples :math:`f(x)`, the pathwise derivative requires the derivative
|
| 18 |
+
:math:`f'(x)`. The next sections discuss these two in a reinforcement learning
|
| 19 |
+
example. For more details see
|
| 20 |
+
`Gradient Estimation Using Stochastic Computation Graphs`_ .
|
| 21 |
+
|
| 22 |
+
.. _`Gradient Estimation Using Stochastic Computation Graphs`:
|
| 23 |
+
https://arxiv.org/abs/1506.05254
|
| 24 |
+
|
| 25 |
+
Score function
|
| 26 |
+
^^^^^^^^^^^^^^
|
| 27 |
+
|
| 28 |
+
When the probability density function is differentiable with respect to its
|
| 29 |
+
parameters, we only need :meth:`~torch.distributions.Distribution.sample` and
|
| 30 |
+
:meth:`~torch.distributions.Distribution.log_prob` to implement REINFORCE:
|
| 31 |
+
|
| 32 |
+
.. math::
|
| 33 |
+
|
| 34 |
+
\Delta\theta = \alpha r \frac{\partial\log p(a|\pi^\theta(s))}{\partial\theta}
|
| 35 |
+
|
| 36 |
+
where :math:`\theta` are the parameters, :math:`\alpha` is the learning rate,
|
| 37 |
+
:math:`r` is the reward and :math:`p(a|\pi^\theta(s))` is the probability of
|
| 38 |
+
taking action :math:`a` in state :math:`s` given policy :math:`\pi^\theta`.
|
| 39 |
+
|
| 40 |
+
In practice we would sample an action from the output of a network, apply this
|
| 41 |
+
action in an environment, and then use ``log_prob`` to construct an equivalent
|
| 42 |
+
loss function. Note that we use a negative because optimizers use gradient
|
| 43 |
+
descent, whilst the rule above assumes gradient ascent. With a categorical
|
| 44 |
+
policy, the code for implementing REINFORCE would be as follows::
|
| 45 |
+
|
| 46 |
+
probs = policy_network(state)
|
| 47 |
+
# Note that this is equivalent to what used to be called multinomial
|
| 48 |
+
m = Categorical(probs)
|
| 49 |
+
action = m.sample()
|
| 50 |
+
next_state, reward = env.step(action)
|
| 51 |
+
loss = -m.log_prob(action) * reward
|
| 52 |
+
loss.backward()
|
| 53 |
+
|
| 54 |
+
Pathwise derivative
|
| 55 |
+
^^^^^^^^^^^^^^^^^^^
|
| 56 |
+
|
| 57 |
+
The other way to implement these stochastic/policy gradients would be to use the
|
| 58 |
+
reparameterization trick from the
|
| 59 |
+
:meth:`~torch.distributions.Distribution.rsample` method, where the
|
| 60 |
+
parameterized random variable can be constructed via a parameterized
|
| 61 |
+
deterministic function of a parameter-free random variable. The reparameterized
|
| 62 |
+
sample therefore becomes differentiable. The code for implementing the pathwise
|
| 63 |
+
derivative would be as follows::
|
| 64 |
+
|
| 65 |
+
params = policy_network(state)
|
| 66 |
+
m = Normal(*params)
|
| 67 |
+
# Any distribution with .has_rsample == True could work based on the application
|
| 68 |
+
action = m.rsample()
|
| 69 |
+
next_state, reward = env.step(action) # Assuming that reward is differentiable
|
| 70 |
+
loss = -reward
|
| 71 |
+
loss.backward()
|
| 72 |
+
"""
|
| 73 |
+
|
| 74 |
+
from . import transforms
|
| 75 |
+
from .bernoulli import Bernoulli
|
| 76 |
+
from .beta import Beta
|
| 77 |
+
from .binomial import Binomial
|
| 78 |
+
from .categorical import Categorical
|
| 79 |
+
from .cauchy import Cauchy
|
| 80 |
+
from .chi2 import Chi2
|
| 81 |
+
from .constraint_registry import biject_to, transform_to
|
| 82 |
+
from .continuous_bernoulli import ContinuousBernoulli
|
| 83 |
+
from .dirichlet import Dirichlet
|
| 84 |
+
from .distribution import Distribution
|
| 85 |
+
from .exp_family import ExponentialFamily
|
| 86 |
+
from .exponential import Exponential
|
| 87 |
+
from .fishersnedecor import FisherSnedecor
|
| 88 |
+
from .gamma import Gamma
|
| 89 |
+
from .geometric import Geometric
|
| 90 |
+
from .gumbel import Gumbel
|
| 91 |
+
from .half_cauchy import HalfCauchy
|
| 92 |
+
from .half_normal import HalfNormal
|
| 93 |
+
from .independent import Independent
|
| 94 |
+
from .inverse_gamma import InverseGamma
|
| 95 |
+
from .kl import _add_kl_info, kl_divergence, register_kl
|
| 96 |
+
from .kumaraswamy import Kumaraswamy
|
| 97 |
+
from .laplace import Laplace
|
| 98 |
+
from .lkj_cholesky import LKJCholesky
|
| 99 |
+
from .log_normal import LogNormal
|
| 100 |
+
from .logistic_normal import LogisticNormal
|
| 101 |
+
from .lowrank_multivariate_normal import LowRankMultivariateNormal
|
| 102 |
+
from .mixture_same_family import MixtureSameFamily
|
| 103 |
+
from .multinomial import Multinomial
|
| 104 |
+
from .multivariate_normal import MultivariateNormal
|
| 105 |
+
from .negative_binomial import NegativeBinomial
|
| 106 |
+
from .normal import Normal
|
| 107 |
+
from .one_hot_categorical import OneHotCategorical, OneHotCategoricalStraightThrough
|
| 108 |
+
from .pareto import Pareto
|
| 109 |
+
from .poisson import Poisson
|
| 110 |
+
from .relaxed_bernoulli import RelaxedBernoulli
|
| 111 |
+
from .relaxed_categorical import RelaxedOneHotCategorical
|
| 112 |
+
from .studentT import StudentT
|
| 113 |
+
from .transformed_distribution import TransformedDistribution
|
| 114 |
+
from .transforms import * # noqa: F403
|
| 115 |
+
from .uniform import Uniform
|
| 116 |
+
from .von_mises import VonMises
|
| 117 |
+
from .weibull import Weibull
|
| 118 |
+
from .wishart import Wishart
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
_add_kl_info()
|
| 122 |
+
del _add_kl_info
|
| 123 |
+
|
| 124 |
+
__all__ = [
|
| 125 |
+
"Bernoulli",
|
| 126 |
+
"Beta",
|
| 127 |
+
"Binomial",
|
| 128 |
+
"Categorical",
|
| 129 |
+
"Cauchy",
|
| 130 |
+
"Chi2",
|
| 131 |
+
"ContinuousBernoulli",
|
| 132 |
+
"Dirichlet",
|
| 133 |
+
"Distribution",
|
| 134 |
+
"Exponential",
|
| 135 |
+
"ExponentialFamily",
|
| 136 |
+
"FisherSnedecor",
|
| 137 |
+
"Gamma",
|
| 138 |
+
"Geometric",
|
| 139 |
+
"Gumbel",
|
| 140 |
+
"HalfCauchy",
|
| 141 |
+
"HalfNormal",
|
| 142 |
+
"Independent",
|
| 143 |
+
"InverseGamma",
|
| 144 |
+
"Kumaraswamy",
|
| 145 |
+
"LKJCholesky",
|
| 146 |
+
"Laplace",
|
| 147 |
+
"LogNormal",
|
| 148 |
+
"LogisticNormal",
|
| 149 |
+
"LowRankMultivariateNormal",
|
| 150 |
+
"MixtureSameFamily",
|
| 151 |
+
"Multinomial",
|
| 152 |
+
"MultivariateNormal",
|
| 153 |
+
"NegativeBinomial",
|
| 154 |
+
"Normal",
|
| 155 |
+
"OneHotCategorical",
|
| 156 |
+
"OneHotCategoricalStraightThrough",
|
| 157 |
+
"Pareto",
|
| 158 |
+
"RelaxedBernoulli",
|
| 159 |
+
"RelaxedOneHotCategorical",
|
| 160 |
+
"StudentT",
|
| 161 |
+
"Poisson",
|
| 162 |
+
"Uniform",
|
| 163 |
+
"VonMises",
|
| 164 |
+
"Weibull",
|
| 165 |
+
"Wishart",
|
| 166 |
+
"TransformedDistribution",
|
| 167 |
+
"biject_to",
|
| 168 |
+
"kl_divergence",
|
| 169 |
+
"register_kl",
|
| 170 |
+
"transform_to",
|
| 171 |
+
]
|
| 172 |
+
__all__.extend(transforms.__all__)
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (6.02 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/bernoulli.cpython-310.pyc
ADDED
|
Binary file (4.91 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/beta.cpython-310.pyc
ADDED
|
Binary file (4.02 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/binomial.cpython-310.pyc
ADDED
|
Binary file (5.55 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/categorical.cpython-310.pyc
ADDED
|
Binary file (6.09 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/cauchy.cpython-310.pyc
ADDED
|
Binary file (3.63 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/chi2.cpython-310.pyc
ADDED
|
Binary file (1.63 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/torch/distributions/__pycache__/constraint_registry.cpython-310.pyc
ADDED
|
Binary file (9.99 kB). View file
|
|
|