e3fcbb639e115e8afe9600bd06aee81acfda6704,reagent/training/world_model/seq2reward_trainer.py,Seq2RewardTrainer,get_loss,#Seq2RewardTrainer#Any#,57

Before Change


        gamma_mask = torch.Tensor(
            [[gamma ** i for i in range(seq_len)] for _ in range(batch_size)]
        ).transpose(0, 1)
        target_acc_reward = torch.sum(target_rewards * gamma_mask, 0).unsqueeze(1)
        // make sure the prediction and target tensors have the same size
        // the size should both be (BATCH_SIZE, 1) in this case.
        assert (

After Change


            .to(training_batch.reward.device)
        )

        target_acc_rewards = torch.cumsum(training_batch.reward * gamma_mask, dim=0)
        target_acc_reward = target_acc_rewards[
            valid_reward_len - 1, torch.arange(batch_size)
        ].unsqueeze(1)

        // make sure the prediction and target tensors have the same size
        // the size should both be (BATCH_SIZE, 1) in this case.
        assert (
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: facebookresearch/Horizon
Commit Name: e3fcbb639e115e8afe9600bd06aee81acfda6704
Time: 2020-10-13
Author: czxttkl@fb.com
File Name: reagent/training/world_model/seq2reward_trainer.py
Class Name: Seq2RewardTrainer
Method Name: get_loss


Project Name: maciejkula/spotlight
Commit Name: 70e4d7fe60a9658bb27b9f5fb67592a1222b2ec3
Time: 2017-07-06
Author: maciej.kula@gmail.com
File Name: spotlight/sequence/representations.py
Class Name: PoolNet
Method Name: user_representation


Project Name: arraiy/torchgeometry
Commit Name: 5d2affa2bf09c53a6d34e288878fe1965fbc91e4
Time: 2020-11-24
Author: sj8716643@126.com
File Name: kornia/augmentation/random_generator/random_generator.py
Class Name:
Method Name: random_crop_size_generator