MCPcopy Create free account
hub / github.com/apple/ml-pointersect / __init__

Method __init__

cdslib/core/nn/modules/vrnn.py:25–160  ·  view source on GitHub ↗

Create Variational RNN. Args: param_graves: Please see the documentation of :py:class:`ParamGraves`. dim_latent: int Actual dimension of the latent variable. Note that it can be different from dim_z, which is t

(
        self,
        param_graves: ParamGraves = ParamGraves(),
        dim_latent: int = HyperParams.TBD.INT,  # actual dimension of the latent variable
        dim_f: int = HyperParams.TBD.INT,  # feature dimension
        # side information
        dim_g: int = 0,  # side information
        # query net
        dim_query: int = 256,  # dimension of posterior query
        num_query_layers: int = 1,
        dim_query_layers: T.Union[int, T.Sequence[int]] = 256,  # feature dimension of the query net (#layer -1)
        query_add_norm: bool = False,  # whether to add layer norm to the query net
        query_dropout_prob: float = 0.0,
        query_nonlinearity: str = "relu",
        # multi-head attention
        num_attn_heads: int = 4,
        attn_dropout_prob: float = 0.1,
        # posterior
        num_posterior_layers: int = 1,
        dim_posterior_layers: T.Union[int, T.Sequence[int]] = 256,
        min_posterior_std: float = 0.0,
        # feature dimension of the posterior net (#layer -1)
        posterior_add_norm: bool = False,  # whether to add layer norm
        posterior_dropout_prob: float = 0.0,
        posterior_type="indep",
        posterior_nonlinearity: str = "relu",
        # prior
        num_prior_layers: int = 1,
        dim_prior_layers: T.Union[int, T.Sequence[int]] = 256,  # feature dimension of the prior net (#layer -1)
        prior_add_norm: bool = False,  # whether to add layer norm
        prior_dropout_prob: float = 0.0,
        prior_nonlinearity: str = "relu",
        min_prior_std: float = 0.0,
        # transform
        num_transform_layers: int = 1,
        dim_transform_layers: T.Union[int, T.Sequence[int]] = 256,  # feature dimension (#layer -1)
        transform_add_norm: bool = False,
        transform_dropout_prob: float = 0.0,
        transform_nonlinearity: str = "relu",
        flag_bckwrd_compatible: bool = False,  # set to True to load older pre-trained model
    )

Source from the content-addressed store, hash-verified

23 """A dictionary that contains the hyper-parameters of NetworkGraves."""
24
25 def __init__(
26 self,
27 param_graves: ParamGraves = ParamGraves(),
28 dim_latent: int = HyperParams.TBD.INT, # actual dimension of the latent variable
29 dim_f: int = HyperParams.TBD.INT, # feature dimension
30 # side information
31 dim_g: int = 0, # side information
32 # query net
33 dim_query: int = 256, # dimension of posterior query
34 num_query_layers: int = 1,
35 dim_query_layers: T.Union[int, T.Sequence[int]] = 256, # feature dimension of the query net (#layer -1)
36 query_add_norm: bool = False, # whether to add layer norm to the query net
37 query_dropout_prob: float = 0.0,
38 query_nonlinearity: str = "relu",
39 # multi-head attention
40 num_attn_heads: int = 4,
41 attn_dropout_prob: float = 0.1,
42 # posterior
43 num_posterior_layers: int = 1,
44 dim_posterior_layers: T.Union[int, T.Sequence[int]] = 256,
45 min_posterior_std: float = 0.0,
46 # feature dimension of the posterior net (#layer -1)
47 posterior_add_norm: bool = False, # whether to add layer norm
48 posterior_dropout_prob: float = 0.0,
49 posterior_type="indep",
50 posterior_nonlinearity: str = "relu",
51 # prior
52 num_prior_layers: int = 1,
53 dim_prior_layers: T.Union[int, T.Sequence[int]] = 256, # feature dimension of the prior net (#layer -1)
54 prior_add_norm: bool = False, # whether to add layer norm
55 prior_dropout_prob: float = 0.0,
56 prior_nonlinearity: str = "relu",
57 min_prior_std: float = 0.0,
58 # transform
59 num_transform_layers: int = 1,
60 dim_transform_layers: T.Union[int, T.Sequence[int]] = 256, # feature dimension (#layer -1)
61 transform_add_norm: bool = False,
62 transform_dropout_prob: float = 0.0,
63 transform_nonlinearity: str = "relu",
64 flag_bckwrd_compatible: bool = False, # set to True to load older pre-trained model
65 ):
66 """
67 Create Variational RNN.
68
69 Args:
70 param_graves:
71 Please see the documentation of :py:class:`ParamGraves`.
72 dim_latent: int
73 Actual dimension of the latent variable.
74 Note that it can be different from dim_z, which is the actual input dimension to net_graves.
75 dim_f: int
76 Feature dimension used to extract latent variables from with attention.
77
78 .. side information
79 dim_g: int
80 Dimension of side information to be appended to the sampled latent variable
81
82 .. query net

Callers 1

__init__Method · 0.45

Calls 1

ParamGravesClass · 0.85

Tested by

no test coverage detected