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

Method forward

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

Run the network T (= seq_len) times and generate T outputs, where T is the sequence length of xs. Args: xs: (seq_len, batch, dim_x) Past input sequence (starting from x0, which is usually zero). Can be constructed by calling construct_tea

(
        self,
        xs: torch.Tensor,
        cs: torch.Tensor,
        fs: torch.Tensor,
        gs: torch.Tensor = None,
        init_hidden_states: T.Dict[str, torch.Tensor] = None,
        valid_lens_fs: T.Sequence[int] = None,
        pz_multiplier: float = 0.0,
        qz_multiplier: float = 1.0,
        pz_std_multiplier: float = 1.0,
        qz_std_multiplier: float = 1.0,
    )

Source from the content-addressed store, hash-verified

481 }
482
483 def forward(
484 self,
485 xs: torch.Tensor,
486 cs: torch.Tensor,
487 fs: torch.Tensor,
488 gs: torch.Tensor = None,
489 init_hidden_states: T.Dict[str, torch.Tensor] = None,
490 valid_lens_fs: T.Sequence[int] = None,
491 pz_multiplier: float = 0.0,
492 qz_multiplier: float = 1.0,
493 pz_std_multiplier: float = 1.0,
494 qz_std_multiplier: float = 1.0,
495 ):
496 """
497 Run the network T (= seq_len) times and generate T outputs, where T is the sequence length of xs.
498
499 Args:
500 xs: (seq_len, batch, dim_x)
501 Past input sequence (starting from x0, which is usually zero).
502 Can be constructed by calling construct_teacher_vectors(xs_gt, past_to_use=1).
503 cs: (num_chars, batch, dim_c)
504 Content sequence (can be onehot encoded or some embedding)
505 gs: (seq_len, batch, dim_g)
506 Side information sequence (gs[t] is concatenated to
507 sampled_latent before transformed into z and given to the denoder_rnn)
508 fs: (seq_len_2, batch, dim_f)
509 Feature sequence that the latent variables will be extracted from
510 init_hidden_states:
511 A dict containing the hidden states of the model
512 'attn_rnn_h'
513 'decode_rnn_h'
514 'attn_c'
515 'attn_mean_idxs'
516
517 Returns:
518 A dict containing:
519 ps: (seq_len, batch, dim_p)
520 attn_cs: (seq_len, batch, dim_c)
521 attn_weights: (seq_len, batch, num_chars+1)
522 attn_fs_weights: (seq_len, batch, seq_len_2)
523 attn_hs: (seq_len, batch, dim_attn_h)
524 decode_hs: (seq_len, batch, dim_decode_h)
525 hidden_states: A dict containing the hidden states of the model
526
527 - 'attn_rnn_h'
528 - 'decode_rnn_h'
529 - 'attn_c'
530 - 'attn_mean_idxs'
531
532 .. outputs from zt_fun
533
534 zs: (seq_len, batch, dim_z)
535 queries: (seq_len, batch, dim_query)
536 sampled_latents: (seq_len, batch, dim_latent)
537 pz_means: (seq_len, batch, dim_latent)
538 pz_stds: (seq_len, batch, dim_latent)
539 qz_means: (seq_len, batch, dim_latent)
540 qz_stds: (seq_len, batch, dim_latent)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected