internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: e-valuation/EvaP

Issue:
Replace reward point redemption dropdown with number input field
If a user selects an option, a new line is added and the selection spans two rows. This looks wrong.

A user can insert custom options. If the user inputs something invalid like "abcdef" or an empty string, only parts of "Please select"-placeholder is visible. This looks wrong as well.
Replace reward point redemption dropdown with number input field
If a user selects an option, a new line is added and the selection spans two rows. This looks wrong.

A user can insert custom options. If the user inputs something invalid like "abcdef" or an empty string, only parts of "Please select"-placeholder is visible. This looks wrong as well.


Discussion:
And in addition the dropdown field is not right-aligned anymore. All this probably comes from the switch to Tom Select in #1758.

The dropdown should be replaced by a number input field with the [max and min values](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#max) set.
And in addition the dropdown field is not right-aligned anymore. All this probably comes from the switch to Tom Select in #1758.

The dropdown should be replaced by a number input field with the [max and min values](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#max) set.

Resolving patch:
diff --git a/evap/rewards/views.py b/evap/rewards/views.py
--- a/evap/rewards/views.py
+++ b/evap/rewards/views.py
@@ -63,7 +63,6 @@ def index(request):
         reward_point_actions=reward_point_actions,
         total_points_available=total_points_available,
         events=events,
-        point_selection=range(0, total_points_available + 1),
     )
     return render(request, "rewards_index.html", template_data)
 


Test patch:
Repository: e-valuation/EvaP

Issue:
Response status code of failed redemption is 200
As @niklasmohrin remarked in [#1790](https://github.com/e-valuation/EvaP/pull/1790/files#r962983692), in `evap.rewards.views.redeem_reward_points`, the status code of failed redemptions (e.g. due to `NotEnoughPoints` or `RedemptionEventExpired`) is set as 200 OK, even though no redemption points were saved. 

Instead, the status code should be something like 400 Bad Request to underline that something went wrong.
@niklasmohrin added, that `assertContains`, used in some tests in `evap.rewards.tests.test_views.TestIndexView`, needs to adopted, as it asserts that the status code is 200 by default.


Discussion:

Resolving patch:
diff --git a/evap/rewards/views.py b/evap/rewards/views.py
--- a/evap/rewards/views.py
+++ b/evap/rewards/views.py
@@ -28,6 +28,8 @@
 
 @reward_user_required
 def index(request):
+    # pylint: disable=too-many-locals
+    status = 200
     if request.method == "POST":
         redemptions = {}
         try:
@@ -43,6 +45,7 @@ def index(request):
             messages.success(request, _("You successfully redeemed your points."))
         except (NoPointsSelected, NotEnoughPoints, RedemptionEventExpired) as error:
             messages.warning(request, error)
+            status = 400
 
     total_points_available = reward_points_of_user(request.user)
     reward_point_grantings = RewardPointGranting.objects.filter(user_profile=request.user)
@@ -64,7 +67,7 @@ def index(request):
         total_points_available=total_points_available,
         events=events,
     )
-    return render(request, "rewards_index.html", template_data)
+    return render(request, "rewards_index.html", template_data, status=status)
 
 
 @manager_required


Test patch:
diff --git a/evap/rewards/tests/test_views.py b/evap/rewards/tests/test_views.py
--- a/evap/rewards/tests/test_views.py
+++ b/evap/rewards/tests/test_views.py
@@ -65,8 +65,8 @@ def test_redeem_too_many_points(self):
         form = response.forms["reward-redemption-form"]
         form.set(f"points-{self.event1.pk}", 3)
         form.set(f"points-{self.event2.pk}", 3)
-        response = form.submit()
-        self.assertContains(response, "have enough reward points.")
+        response = form.submit(status=400)
+        self.assertContains(response, "have enough reward points.", status_code=400)
         self.assertEqual(5, reward_points_of_user(self.student))
 
     def test_redeem_points_for_expired_event(self):
@@ -75,8 +75,8 @@ def test_redeem_points_for_expired_event(self):
         form = response.forms["reward-redemption-form"]
         form.set(f"points-{self.event2.pk}", 1)
         RewardPointRedemptionEvent.objects.update(redeem_end_date=date.today() - timedelta(days=1))
-        response = form.submit()
-        self.assertContains(response, "event expired already.")
+        response = form.submit(status=400)
+        self.assertContains(response, "event expired already.", status_code=400)
         self.assertEqual(5, reward_points_of_user(self.student))
 
     def test_invalid_post_parameters(self):
Repository: e-valuation/EvaP

Issue:
User Import File Selection: Mime-Filter not working
With Firefox 104.0.2, I don't get a file type filter in the file selection dialog that opens when clicking on "Select file" on the staff user import page.

Similarly to the semester import, it would be nice if users would get a correctly filtered file selection dialog.


Discussion:
Hint: We need to correctly set [the "accept" attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept). This is already correctly configured for the "semester import" ;)

Resolving patch:
diff --git a/evap/staff/forms.py b/evap/staff/forms.py
--- a/evap/staff/forms.py
+++ b/evap/staff/forms.py
@@ -111,7 +111,11 @@ class ImportForm(forms.Form):
 class UserImportForm(forms.Form):
     use_required_attribute = False
 
-    excel_file = forms.FileField(label=_("Excel file"), required=False)
+    excel_file = forms.FileField(
+        label=_("Excel file"),
+        required=False,
+        widget=forms.FileInput(attrs={"accept": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),
+    )
 
 
 class EvaluationParticipantCopyForm(forms.Form):


Test patch:
Repository: e-valuation/EvaP

Issue:
Display number of available reward points
On the staff page for reward point redemption events (`rewards/reward_point_redemption_events`), the total number of currently available (granted but not yet redeemed) number of reward points should be shown.
The information should be placed in the upper right corner (in the same line as the "Create new event" button, vertically centered) with the following text: `Available reward points: <number>`.


Discussion:

Resolving patch:
diff --git a/evap/rewards/views.py b/evap/rewards/views.py
--- a/evap/rewards/views.py
+++ b/evap/rewards/views.py
@@ -2,6 +2,7 @@
 
 from django.contrib import messages
 from django.core.exceptions import BadRequest, SuspiciousOperation
+from django.db.models import Sum
 from django.http import HttpResponse
 from django.shortcuts import get_object_or_404, redirect, render
 from django.utils.translation import get_language
@@ -91,7 +92,14 @@ def index(request):
 def reward_point_redemption_events(request):
     upcoming_events = RewardPointRedemptionEvent.objects.filter(redeem_end_date__gte=datetime.now()).order_by("date")
     past_events = RewardPointRedemptionEvent.objects.filter(redeem_end_date__lt=datetime.now()).order_by("-date")
-    template_data = {"upcoming_events": upcoming_events, "past_events": past_events}
+    total_points_granted = RewardPointGranting.objects.aggregate(Sum("value"))["value__sum"] or 0
+    total_points_redeemed = RewardPointRedemption.objects.aggregate(Sum("value"))["value__sum"] or 0
+    total_points_available = total_points_granted - total_points_redeemed
+    template_data = {
+        "upcoming_events": upcoming_events,
+        "past_events": past_events,
+        "total_points_available": total_points_available,
+    }
     return render(request, "rewards_reward_point_redemption_events.html", template_data)
 
 


Test patch:
Repository: e-valuation/EvaP

Issue:
Change voting error message based on type of missing answer
Submitting a poll form with missing answers will result in an error message: `Please make sure to vote for all rating questions. You can also click on "I can't give feedback" to skip the questions about a single person.`

The second part only makes sense if at least one of the missing answers is to a contributor question. If all of the missing answers are for general questions, this sentence shouldn't be displayed.


Discussion:

Resolving patch:
diff --git a/evap/student/views.py b/evap/student/views.py
--- a/evap/student/views.py
+++ b/evap/student/views.py
@@ -161,11 +161,15 @@ def render_vote_page(request, evaluation, preview, for_rendering_in_modal=False)
         evaluation_form_group_top += evaluation_form_group_bottom
         evaluation_form_group_bottom = []
 
+    contributor_errors_exist = any(form.errors for form_group in form_groups.values() for form in form_group)
+    errors_exist = contributor_errors_exist or any(
+        any(form.errors for form in form_group)
+        for form_group in [evaluation_form_group_top, evaluation_form_group_bottom]
+    )
+
     template_data = {
-        "errors_exist": any(
-            any(form.errors for form in form_group)
-            for form_group in [*(form_groups.values()), evaluation_form_group_top, evaluation_form_group_bottom]
-        ),
+        "contributor_errors_exist": contributor_errors_exist,
+        "errors_exist": errors_exist,
         "evaluation_form_group_top": evaluation_form_group_top,
         "evaluation_form_group_bottom": evaluation_form_group_bottom,
         "contributor_form_groups": contributor_form_groups,


Test patch:
diff --git a/evap/student/tests/test_views.py b/evap/student/tests/test_views.py
--- a/evap/student/tests/test_views.py
+++ b/evap/student/tests/test_views.py
@@ -202,6 +202,7 @@ def test_incomplete_general_vote_form(self):
         self.fill_form(form, fill_general_complete=False)
         response = form.submit(status=200)
         self.assertIn("vote for all rating questions", response)
+        self.assertNotIn("skip the questions about a single person", response)
 
         form = page.forms["student-vote-form"]
 
@@ -239,6 +240,7 @@ def test_incomplete_contributors_vote_form(self):
         self.fill_form(form, fill_contributors_complete=False)
         response = form.submit(status=200)
         self.assertIn("vote for all rating questions", response)
+        self.assertIn("skip the questions about a single person", response)
 
         form = page.forms["student-vote-form"]
Repository: pytorch/pytorch

Issue:
Port LBFGS from Lua optim
fixes #483 


Discussion:

Resolving patch:
diff --git a/torch/nn/functions/thnn/auto.py b/torch/nn/functions/thnn/auto.py
--- a/torch/nn/functions/thnn/auto.py
+++ b/torch/nn/functions/thnn/auto.py
@@ -185,6 +185,7 @@ def _generate_function_classes(scope_dict):
     function_by_name = {fn.name: fn for fn in function_list}
     classes_to_generate = {fn.name.partition('_')[0] for fn in function_list}
     exceptions = {
+        'Linear',
         'SpatialConvolutionMM',
         'SparseLinear',
         'TemporalConvolution',


Test patch:
Repository: pytorch/pytorch

Issue:
print truncated tensors
In torch, printing a tensor will print the whole tensor, even if that one is huge.
This is sometimes annoying, especially when using a notebook, as it crashes it.

Numpy has a very nice way to display big tensors by truncating them. Would it be possible so have something similar for pytorch?



Discussion:
Yeah, we haven't implemented it yet, but that's definitely on our roadmap

Implemented in #202.

I should say that I have some artefacts that appear with #202 while printing a tensor. Here is an example output:

``` python
a = torch.rand(5)
print(a)
```

gives

```
'\n 0.6233\n 0.7240\n 0.1248\n 0.3522\n 0.9047\n[torch.FloatTensor of size 5]\n'
```

Curiously, if I simply do

``` python
print(torch.rand(5))
```

It works fine and print nicely, with the truncation for large tensors.

I'm using Python 2.7.6 (probably the one that came with my system and not from anaconda). Maybe it's just a bad setup in my machine?

hmmm, it works fine on python 2.7.12. wonder what changed between .6 and .12

```
-0.7472
 3.2232
-0.9434
-0.5391
 1.9560
 1.3194
 1.8168
-2.2081
-0.9746
 1.4805
[torch.FloatTensor of size 10]
```

ok i got a repro. I opened my ipython and did this:

```
In [6]: a=torch.randn(10)

In [7]: a
Out[7]: '\n-1.9817\n 0.2041\n-0.2836\n-0.3300\n 1.2530\n 0.3965\n-1.1826\n-1.6713\n-0.6749\n-1.8690\n[torch.FloatTensor of size 10]\n'

In [8]: print(a)

-1.9817
 0.2041
-0.2836
-0.3300
 1.2530
 0.3965
-1.1826
-1.6713
-0.6749
-1.8690
[torch.FloatTensor of size 10]
```

@soumith my example was flawed, sorry.
Using `print` works for me, but when only entering `a` it prints the `\n`s, as in your example.


Resolving patch:
diff --git a/torch/tensor.py b/torch/tensor.py
--- a/torch/tensor.py
+++ b/torch/tensor.py
@@ -91,7 +91,7 @@ def __reduce__(self):
         return type(self), (self.tolist(),)
 
     def __repr__(self):
-        return repr(str(self))
+        return str(self)
 
     def __str__(self):
         # All strings are unicode in Python 3, while we have to encode unicode


Test patch:
Repository: pytorch/pytorch

Issue:
.half() missing and copies from HalfTensor to anything else missing
wrapper code is missing.

```
import torch

import torch.cuda

a = torch.cuda.FloatTensor(100).half()
---------------------------------------------------------------------------
AttributeError: 'FloatTensor' object has no attribute 'half'
```

```
a = torch.cuda.HalfTensor(100)
a.float()
---------------------------------------------------------------------------
RuntimeError: Copy function from HalfTensor to FloatTensor isn't implemented!

print(a)
---------------------------------------------------------------------------
RuntimeError: Copy function from HalfTensor to DoubleTensor isn't implemented!
```



Discussion:

Resolving patch:
diff --git a/torch/storage.py b/torch/storage.py
--- a/torch/storage.py
+++ b/torch/storage.py
@@ -51,6 +51,9 @@ def double(self, async=False):
     def float(self, async=False):
         return self.type(type(self).__module__ + '.FloatStorage', async)
 
+    def half(self, async=False):
+        return self.type(type(self).__module__ + '.HalfStorage', async)
+
     def long(self, async=False):
         return self.type(type(self).__module__ + '.LongStorage', async)
 
diff --git a/torch/tensor.py b/torch/tensor.py
--- a/torch/tensor.py
+++ b/torch/tensor.py
@@ -42,6 +42,9 @@ def double(self, async=False):
     def float(self, async=False):
         return self.type(type(self).__module__ + '.FloatTensor')
 
+    def half(self, async=False):
+        return self.type(type(self).__module__ + '.HalfTensor')
+
     def long(self, async=False):
         return self.type(type(self).__module__ + '.LongTensor')
 


Test patch:
Repository: pytorch/pytorch

Issue:
batch_first broken in AutogradRNN
The last line here fails on CPU or when CUDNN is otherwise unavailable:

```python
l, b, t, x, h = 2, 3, 5, 10, 20

rnn = nn.LSTM(x, h, l, batch_first=True)
inpt = Variable(torch.randn(b, t, x))
h0 = Variable(torch.randn(l, b, h))
c0 = Variable(torch.randn(l, b, h))
output, hn = rnn(inpt, (h0, c0))
```

This is because `AutogradRNN.forward` accidentally assumes `Tensor`'s in-place `transpose` semantics rather than the functional semantics of `Variable` (`cudnn.rnn.forward` gets it right):

```python
def forward(input, weight, hidden):
    if batch_first:
        input.transpose(0, 1)
    nexth, output = func(input, hidden, weight)
    if batch_first:
        output.transpose(0, 1)
```

I can push a PR that fixes this, or one of the devs can put it in the next bugfix PR:
```python
def forward(input, weight, hidden):
    if batch_first:
        input = input.transpose(0, 1)
    nexth, output = func(input, hidden, weight)
    if batch_first:
        output = output.transpose(0, 1)
```


Discussion:

Resolving patch:
diff --git a/torch/nn/functions/rnn.py b/torch/nn/functions/rnn.py
--- a/torch/nn/functions/rnn.py
+++ b/torch/nn/functions/rnn.py
@@ -154,12 +154,12 @@ def AutogradRNN(mode, input_size, hidden_size, num_layers=1, batch_first=False,
 
     def forward(input, weight, hidden):
         if batch_first:
-            input.transpose(0, 1)
+            input = input.transpose(0, 1)
 
         nexth, output = func(input, hidden, weight)
 
         if batch_first:
-            output.transpose(0, 1)
+            output = output.transpose(0, 1)
 
         return output, nexth
 


Test patch:
Repository: pytorch/pytorch

Issue:
invalidArguments doesn't take keyword args into account
If someone passes keyword arguments to any of our C functions, they won't appear in the error message (as if they weren't specified). There's the same issue with the `out` argument (see #364) - if you specify correct args, but e.g. pass `out=(torch.LongTensor(), torch.FloatTensor())` to `max`, the message will appear as if all arguments were correct (while `out` has invalid order). It can be pretty confusing.


Discussion:

Resolving patch:
diff --git a/tools/cwrap/plugins/CuDNNPlugin.py b/tools/cwrap/plugins/CuDNNPlugin.py
--- a/tools/cwrap/plugins/CuDNNPlugin.py
+++ b/tools/cwrap/plugins/CuDNNPlugin.py
@@ -52,7 +52,7 @@ class CuDNNPlugin(CWrapPlugin):
     $options
     }
 
-    THPUtils_invalidArguments(args, "$readable_name", $num_options, $expected_args);
+    THPUtils_invalidArguments(args, kwargs, "$readable_name", $num_options, $expected_args);
     return NULL;
     END_HANDLE_TH_ERRORS
 }
diff --git a/tools/cwrap/plugins/StandaloneExtension.py b/tools/cwrap/plugins/StandaloneExtension.py
--- a/tools/cwrap/plugins/StandaloneExtension.py
+++ b/tools/cwrap/plugins/StandaloneExtension.py
@@ -70,7 +70,7 @@ class StandaloneExtension(CWrapPlugin):
   int __argcount = args ? PyTuple_Size(args) : 0;
     $options
   } else {
-    THPUtils_invalidArguments(args, "$name", 1, $expected_args);
+    THPUtils_invalidArguments(args, NULL, "$name", 1, $expected_args);
     return NULL;
   }
   END_HANDLE_TH_ERRORS
diff --git a/tools/cwrap/plugins/THPPlugin.py b/tools/cwrap/plugins/THPPlugin.py
--- a/tools/cwrap/plugins/THPPlugin.py
+++ b/tools/cwrap/plugins/THPPlugin.py
@@ -85,7 +85,7 @@ class THPPlugin(CWrapPlugin):
     $options
     }
 
-    THPUtils_invalidArguments(args, "$readable_name", $num_options, $expected_args);
+    THPUtils_invalidArguments(args, kwargs, "$readable_name", $num_options, $expected_args);
     return NULL;
     END_HANDLE_TH_ERRORS
 }
@@ -174,6 +174,18 @@ def format_args(args, var_args=False):
                            for arg in args
                            if not arg.get('ignore_check', False)
                            and not arg.get('output')]
+            output_args = list(filter(lambda a: a.get('output'), args))
+            if output_args:
+                if len(output_args) > 1:
+                    out_type = 'tuple['
+                    out_type += ', '.join(
+                            self.TYPE_NAMES[arg['type']] for arg in output_args)
+                    out_type += ']'
+                    option_desc += ['#' + out_type + ' out']
+                else:
+                    arg = output_args[0]
+                    option_desc += ['#' + self.TYPE_NAMES[arg['type']] + ' out']
+
             if option_desc:
                 return '({})'.format(', '.join(option_desc))
             else:


Test patch:
Repository: pytorch/pytorch

Issue:
Sparse and CosineLoss only support Float on CUDA
These two lines introduce bugs and as @fmassa pointed out, have to be changed to `.is_cuda`
https://github.com/pytorch/pytorch/blob/79f5bf84e54d57a4c81912aeedb0b8a27f97c27e/torch/nn/_functions/loss.py#L13
https://github.com/pytorch/pytorch/blob/28220134371bf9944412e6d232ca20b827a849b4/torch/nn/_functions/thnn/sparse.py#L80


Discussion:
If nobody is working on fixing it, I'll send a PR later today
go for it (and thanks :) )
Do you think we should we enable `half`/`double` tests for all `nn` modules in CUDA?
Enabling tests fro `half` might be tricky because they don't have a CPU counterpart...
Yeah we should do that. We should just compare `half` with `float`
The differences [might be reasonably high though](https://github.com/soumith/cudnn.torch/blob/master/test/test.lua#L12-L16). Maybe we can for the moment assume that if it works for float and double, it should work for half as well, and we add tests for `half` later on?
yes. half later on sounds good.

Resolving patch:
diff --git a/torch/nn/_functions/loss.py b/torch/nn/_functions/loss.py
--- a/torch/nn/_functions/loss.py
+++ b/torch/nn/_functions/loss.py
@@ -9,12 +9,6 @@ def __init__(self, margin=0, size_average=True):
         self.margin = margin
         self.size_average = size_average
 
-    def _new_idx(self, input):
-        if torch.typename(input) == 'torch.cuda.FloatTensor':
-            return torch.cuda.ByteTensor()
-        else:
-            return torch.ByteTensor()
-
     def forward(self, input1, input2, y):
         self.w1 = input1.new()
         self.w22 = input1.new()
@@ -22,7 +16,7 @@ def forward(self, input1, input2, y):
         self.w32 = input1.new()
         self._outputs = input1.new()
 
-        _idx = self._new_idx(input1)
+        _idx = input1.new().byte()
 
         buffer = torch.mul(input1, input2)
         torch.sum(buffer, 1, out=self.w1)
@@ -61,7 +55,7 @@ def backward(self, grad_output):
         v1, v2, y = self.saved_tensors
 
         buffer = v1.new()
-        _idx = self._new_idx(v1)
+        _idx = v1.new().byte()
 
         gw1 = grad_output.new()
         gw2 = grad_output.new()
diff --git a/torch/nn/_functions/thnn/sparse.py b/torch/nn/_functions/thnn/sparse.py
--- a/torch/nn/_functions/thnn/sparse.py
+++ b/torch/nn/_functions/thnn/sparse.py
@@ -77,7 +77,7 @@ def backward(self, grad_output):
                 indices = indices.view(-1)
 
             with torch.cuda.device_of(grad_output):
-                if torch.typename(grad_output) == 'torch.cuda.FloatTensor':
+                if grad_output.is_cuda:
                     _sorted = torch.cuda.LongTensor()
                     _indices = torch.cuda.LongTensor()
                     _count = torch.cuda.LongTensor()


Test patch:
Repository: pytorch/pytorch

Issue:
Update broadcast docs
Right now they say that `broadcast` accepts a tuple of destination devices, but it's actually `(src, dst1, dst2, ...)`.


Discussion:

Resolving patch:
diff --git a/torch/cuda/comm.py b/torch/cuda/comm.py
--- a/torch/cuda/comm.py
+++ b/torch/cuda/comm.py
@@ -10,7 +10,9 @@ def broadcast(tensor, devices):
 
     Arguments:
         tensor (Tensor): tensor to broadcast.
-        devices (Iterable): an iterable of devices to which to broadcast.
+        devices (Iterable): an iterable of devices among which to broadcast.
+          Note that it should be like (src, dst1, dst2, ...), the first element
+          of which is the source device to broadcast from.
 
     Returns:
         A tuple containing copies of the ``tensor``, placed on devices
@@ -36,7 +38,9 @@ def broadcast_coalesced(tensors, devices, buffer_size=10485760):
 
     Arguments:
         tensors (sequence): tensors to broadcast.
-        devices (Iterable): an iterable of devices to which to broadcast.
+        devices (Iterable): an iterable of devices among which to broadcast.
+          Note that it should be like (src, dst1, dst2, ...), the first element
+          of which is the source device to broadcast from.
         buffer_size (int): maximum size of the buffer used for coalescing
 
     Returns:


Test patch: