crypten/gradients.py [1132:1147]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @staticmethod
    def forward(ctx, *args, **kwargs):

        # preprocess inputs:
        assert len(args) >= 1
        if len(args) == 1:
            (input,) = args  # no dimension to sum over in args
            dim = kwargs.get("dim", None)
        else:
            assert len(args) == 2
            assert "dim" not in kwargs
            input, dim = args  # dimension to sum over in args
        keepdim = kwargs.get("keepdim", False)

        # compute sum:
        ctx.save_multiple_for_backward((input.size(), dim, keepdim))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



crypten/gradients.py [1191:1206]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @staticmethod
    def forward(ctx, *args, **kwargs):

        # preprocess inputs:
        assert len(args) >= 1
        if len(args) == 1:
            (input,) = args  # no dimension to average over in args
            dim = kwargs.get("dim", None)
        else:
            assert len(args) == 2
            assert "dim" not in kwargs
            input, dim = args  # dimension to average over in args
        keepdim = kwargs.get("keepdim", False)

        # compute mean:
        ctx.save_multiple_for_backward((input.size(), dim, keepdim))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



