sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: Expose a SavedTensorsHooks nn.Module for users to register saved tensors hooks
Labels: feature,module: autograd,module: nn,triaged

## 🚀 Feature
In addition to the current context manager `torch.autograd.graph.saved_tensors_hooks`, expose a class `SavedTensorsHooks`  which inherits from `nn.Module` that users can use to wrap their models in to register hooks.

## Motivation

The saved tensors hooks are thread local, which makes them compatible with DataParellel, but only if called in a specific fashion. 

The following code works as intended (hooks are called)

```python

class Model(nn.Module):
    def forward(self, x):
        with torch.autograd.graph.saved_tensors_hooks(pack_hook, unpack_hook):
          # ... compute output
          output = x
        return output

model = Model()
net = nn.DataParallel(model)
output = net(input)
```

But the following code does not, when number of devices >= 2 (hooks are not called):

```python
model = Model()
net = nn.DataParallel(model)
with torch.autograd.graph.saved_tensors_hooks(pack_hook, unpack_hook):
    output = net(input)
```
The reason it does not work is that saved tensors hooks are thread-local, and are not propagated through `nn.DataParallel`.

Having a `SavedTensorsHooks` class would allow users to simply write:

```python
model = Model()
net = nn.DataParallel(SavedTensorsHook(model, pack_hook, unpack_hook))
output = net(input)
```

This has three advantages:

1. Often times, users will be importing their model from a different file than the file containing their training loop, sometimes even from an external library. It would be more convenient for them to wrap the final model with the `SavedTensorsHook` class than to edit the forward method of that model.
2. The API would be consistent with the `nn.DataParallel` API.
3. It will be clearer to explain in docs that `nn.DataParallel(SavedTensorsHook(model, pack_hook, unpack_hook))` works but `SavedTensorsHook(nn.DataParallel(model), pack_hook, unpack_hook)` does not.

## Pitch

Expose the following class.

```python
class SavedTensorsHooks(nn.Module):
    def __init__(self, module, pack_hook, unpack_hook):
        super().__init__()
        self.module = module
        self.pack = pack_hook
        self.unpack = unpack_hook
    
    def forward(self, *args, **kwargs):
        with torch.autograd.graph.saved_tensors_hooks(self.pack, self.unpack):
            return self.module(*args, **kwargs)
```

## Alternatives

Add the pattern to docs and let the user implement it themselves.

## Additional context

N/A


cc @ezyang @albanD @zou3519 @gqchen @pearu @nikitaved @soulitzer @Lezcano @Varal7 @mruberry @jbschlosser @walterddr @kshitij12345 @saketh-are
Repository: go
Issue: net: real MAC address cannot be obtained after a NIC is bound on linux
Labels: NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.16.2 linux/amd64
</pre>

### Does this issue reproduce with the latest release?



### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
amd64 and arm64
</pre></details>

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->



### What did you expect to see?
net.Interfaceaddrs () gets the real MAC address

### What did you see instead?
net.Interfaceaddrs () gets the fake MAC address after the network adapter is bound


### What did you do?

![image](https://user-images.githubusercontent.com/13345233/130167643-d59fa985-4c71-4f48-8cc6-379c4c86f17e.png)

Code sample:
```
package main

import (
	"encoding/hex"
	"fmt"
	"net"
	"strings"
	"syscall"
	"unsafe"
)

func main() {
	getPermanentMacAddr()
}

// If we use bond or team technology
// to use two or more adapters as a virtual one
// use net.Interface.HardwareAddr will get the same mac address
// The following code thinking was borrowed from ethtool's source code ethtool.c
// this code will get the permanent mac address
func getPermanentMacAddr() error {
	var err error
	fd, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_DGRAM, 0)
	if err != nil {
		fd, err = syscall.Socket(syscall.AF_NETLINK, syscall.SOCK_RAW, syscall.NETLINK_GENERIC)
		if err != nil {
			return err
		}
	}

	defer func() {
		_ = syscall.Close(fd)
	}()
	var adapters []net.Interface
	adapters, _ = net.Interfaces()

	for _, adapter := range adapters {
		var data struct {
			cmd  uint32
			size uint32
			data [128]byte
		}

		data.cmd = 0x20
		data.size = 128
		// data.data = make([]byte, 128)

		var ifr struct {
			IfrName [16]byte
			IfrData unsafe.Pointer
		}
		copy(ifr.IfrName[:], adapter.Name)
		ifr.IfrData = unsafe.Pointer(&data)

		_, _, sysErr := syscall.RawSyscall(syscall.SYS_IOCTL,
			uintptr(fd), uintptr(0x8946), uintptr(unsafe.Pointer(&ifr)))

		if sysErr != 0 {
			fmt.Println("调用ioctl获取网口", adapter.Name, "物理MAC地址错误")
			// return errors.New("call ioctl get permanent mac address error")
			continue
		}
		// If mac address is all zero, this is a virtual adapter
		// we ignore it
		bAllZERO := true
		var i uint32 = 0
		for i = 0; i < data.size; i++ {
			if data.data[i] != 0x00 {
				bAllZERO = false
				break
			}
		}

		if bAllZERO {
			continue
		}

		if len(hex.EncodeToString(data.data[0:data.size])) > 12 {
			continue
		}

		mac := strings.ToUpper(hex.EncodeToString(data.data[0:data.size]))
		for i := 10; i > 0; i = i - 2 {
			mac = fmt.Sprintf("%s:%s", mac[:i], mac[i:])
		}

		fmt.Println(mac)
	}

	return nil
}
```
Repository: pytorch
Issue: Raw saved tensors can survive the deletion of the underlying SavedVariable object
Labels: module: autograd,triaged

## 🐛 Bug

The stack starting at #60551 exposes a `SavedTensor` Python object that users can assess through `output.grad_fn._raw_saved_tensors` for custom functions or with `output.grad_fn._raw_saved_[something]`.
The purpose is to allow them to register a pair of pack/unpack on that specific saved tensor.

However, the discussion in #60551 exposes a problem with the current implementation.

A bug can occur if a user decides to save reference to that raw saved tensor, then call backward (which deletes the underlying SavedVariable), then call a method of that raw saved tensor, namely `SavedTensor.register_hooks()`.

## Additional context

Most of the time, an error will be raised correctly.
Calling `backward()` will call `SomeFunction::release_variables()`, which in turn will call `SavedVariable::reset_data()`. 
In particular, this clears `SavedVariable->data_`. When the user calls `SavedTensor.register_hooks()`, the following code is executed, which raises an error as expected:

https://github.com/pytorch/pytorch/blob/0a66d5b3253fd2d2304f3897526db3c8fb139376/torch/csrc/autograd/saved_variable.cpp#L232-L239
 
Unfortunately, the `SavedVariable::reset_data()` is not always called. For instance, for custom functions, the `PyNode::release_variables` reads:

https://github.com/pytorch/pytorch/blob/0a66d5b3253fd2d2304f3897526db3c8fb139376/torch/csrc/autograd/python_function.cpp#L153-L158

This calls,  `f->saved_variables.clear()`, which can delete the `SavedVariable`, without calling `SavedVariable::reset_data()`.
This can be problematic in the situation above.

I don't remember if I've been able to actually produce this bug, but I'm opening this issue so I don't forget about this.

Also open question: do users ever need to use `SavedTensor.register_hooks()` on individual tensors?

cc @ezyang @albanD @zou3519 @gqchen @pearu @nikitaved @soulitzer @Lezcano @Varal7
Repository: node
Issue: Cluster round_robin did not balance every request from master to workers by numbers
Labels: cluster

### Version

14.2.0

### Platform

linux

### Subsystem

_No response_

### What steps will reproduce the bug?

I made a lot of request to test cluster，and every response time was nearly the same
，but I found that，sometimes requests were send to a worker in a period time.

It's not balance by request numbers. 

### How often does it reproduce? Is there a required condition?

_No response_

### What is the expected behavior?

_No response_

### What do you see instead?

_No response_

### Additional information

_No response_
Repository: vscode
Issue: Git - Highlighting of files in .gitignore and .git/info/exclude should be consistent
Labels: feature-request,git,*duplicate

If you exclude files/folders user `.gitignore` vscode highlights that they're excluded (I think it's vscode and not an extension?). 

If you exclude files using `.git/info/exclude` they're not highlighted in the same manner.

It would be nice if it were consistent. I use `.git/info/exclude` for `per user` files, particularly when I'm contributing to shared projects, in particular for `vscode` specific folders such as .vscode or .history (from an extension) may not appear in the repo's `.gitignore`.
Repository: go
Issue: net/rpc: missing a test scenario for using done channel for two calls
Labels: Testing,NeedsFix

After skimming Go `net/rpc` source code (last commit: e9e0d1ef704c4bba3927522be86937164a61100c), I found that no test scenario exists for using `done` channel for two RPC calls. I suggest adding a test scenario for this case.

The following code shows the scenario details:

```
client.Go(serviceMethod, &args1, &reply1, done)
client.Go(serviceMethod, &args2, &reply2, done)

c1 := <- done
log.Println("get:", c1.Reply.(*GetReply).Value)

c2 := <- done
log.Println("get:", c2.Reply.(*GetReply).Value)
```
Repository: flutter
Issue: Let us choose the DropdownButton FlexFit (ie: Flexible as well as Expanded)
Labels: c: new feature,framework,f: material design,c: proposal,P2,team-design,triaged-design

## Proposal

Allow `DropdownButton` to behave in two new ways:

1 - Automatically expand to a maximum width of 100%
2 - Let the width be based on the selected value *not* the maximum width of the `items`

I have an example _in HTML and CSS_ that demonstrates the flex behaviour. I've yet to figure it out with Flutter:

https://codepen.io/oodavid/pen/OJmKwzX?editors=1100

A short video explaining it:

https://www.loom.com/share/3876987004fc4a41a2a9d170b70876c1
Repository: vue
Issue: New slot syntax doesn't work the same way as old syntax (in some cases)
Labels: bug

### Version
2.6.14

### Reproduction link
[https://github.com/hivokas/vue-2-slots-issue](https://github.com/hivokas/vue-2-slots-issue)







### Steps to reproduce
1. Clone the repo
2. Run `npm run serve`
3. Change the value in the text input

### What is expected?
Preview updates with both old and new slot syntax (here: https://github.com/hivokas/vue-2-slots-issue/blob/cd7f3a6db790472b88421a1497ae14d4135d23ef/src/components/PublishToSocialStep.vue#L4).

### What is actually happening?
Preview updates with old slot syntax, but doesn't update with new slot syntax.

Video demonstration of the problem:

https://user-images.githubusercontent.com/22997803/130232152-bd5e445d-600e-4816-b140-685d1fd6c3a8.mp4



---
I've updated the old deprecated slot syntax to the new one.

<!-- generated by vue-issues. DO NOT REMOVE -->
Repository: PowerToys
Issue: [FancyZones] Can't create a 1600px wide zone on a 1440p monitor.
Labels: Issue-Bug,FancyZones-Editor,Product-FancyZones,Priority-3

### Microsoft PowerToys version

v0.43.0

### Running as admin

- [ ] Yes

### Area(s) with issue?

FancyZones Editor

### Steps to reproduce

I have a 2560x1440 monitor. I tried to create a 2-column layout with 1 being 1600px wide.

But it won't let me. Every time I release the mouse button it either forces it to 1601 or 1599 px.

I haven't found any other number this is true for. Just 1600. No space around zones and default highlight distance, if that matters.

I also have a second, 1080p monitor, if that also matters.

### ✔️ Expected Behavior

1600 px wide zone.

### ❌ Actual Behavior

1601 or 1599 px.

### Other Software

_No response_
Repository: opencv
Issue: inconsistant behavior of ocl::Kernel reuse and its parameters
Labels: category: core,category: ocl,RFC

Another issue surfaced in my update of OpenCV's OpenCL code is inconsistency in the code, behavior, and instructions to users of the SDK for ocl::Kernel, its parameters, and its reuse.

* The OpenCV core team has told users of the sdk "do not reuse Kernels". https://github.com/opencv/opencv/issues/19140#issuecomment-746995684 and https://github.com/opencv/opencv/issues/19134#issuecomment-748039265
* The OpenCV code detaches (doesn't deallocate) UMat memory parameters after Kernel::run(), but leaves the pointers and config on the Kernel's parameters. These are bad pointers and the code/opencl runtime will behavior poorly. If the UMat's underlying data hasn't been deallocated elsewhere before or during the Kernel running, the run might succeed. This is a race condition and unpredictable.
* The OpenCV code leaves all non-UMat parameters on the Kernel. For example, if a Kernel has only constant float params, a second run might work.
* Sometimes, OpenCV code destroys the Kernel::Impl after a run, but not all the time. The codepath makes choices based on async running choice, profiling, etc.

This inconsistency in OpenCV causes unpredictable Kernel behavior on reuse. Users of the sdk can not clearly understand if/when/or not to reuse Kernels.

I recommend consistent behavior. Either

* Kernels can not be reused. Aways invalidate the Kernel after a run so it can not be used. This is small workitem and my preference.
* Kernels can be reused. Fix the bugs about reusage. This is medium workitem.

#### System information (version)

- OpenCV => 3.x and 4.x
- Operating System / Platform => all
- Compiler => all

#### Issue submission checklist

 - [X] I report the issue, it's not a question
 - [X] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found solution
 - [X] I updated to latest OpenCV version and the issue is still there
Repository: pytorch
Issue: Create a new OptionalArrayRef template class to replace Optional<ArrayRef>
Labels: module: internals,triaged

see https://github.com/pytorch/pytorch/issues/44409#issuecomment-900465132 for motivating discussion.

## Problem
Consider the following snippet of code

```c++
void print(ArrayRef<int64_t> arr) {
  std::cout << arr[0] << std::endl;
}

print(2) // prints 2
```

The above snippet works because the following __converting__ constructor takes a single element by const reference which allows C++ to extend the lifetime of the temporary int literal `2` throughout the expression `print(2)`.
https://github.com/pytorch/pytorch/blob/913c1f83f49f9e1e2a494186cc0069d780cee852/c10/util/ArrayRef.h#L72

However, consider what happens when we wrap `ArrayRef` in an `optional` as follows

```c++
void print(optional<ArrayRef<int64_t>> arr) {
  std::cout << (*arr)[0] << std::endl;
}

print(2) // prints garbage value
```

In the above snippet, the following __converting__ constructor of `optional` will be specialized for `U=int&&` and will perform a `static_cast<int64_t>` and forward the argument to `ArrayRef`. In this case, the lifetime of the int literal `2` will end with the `optional` constructor and thus `ArrayRef` will store a dangling pointer.
https://github.com/pytorch/pytorch/blob/913c1f83f49f9e1e2a494186cc0069d780cee852/c10/util/Optional.h#L658-L665

This cppinsights shows this problem with minimal code https://cppinsights.io/s/60f15322

## Considerations

C++17 `std::optional` has the same problem when templated on an `ArrayRef`. Since we want `c10::optional` to be compatible with it, that means we cannot change the implementation of `optional`.

Changing the one element constructor of `ArrayRef` to either make it explicit or to explicitly delete the rvalue overload would be very BC breaking and it would make the C++ API less similar with the python API (if in python we can pass an int literal where an IntArrayRef is expected, then we should also be able to do it in C++).

## Solution

Introduce a new `OptionalArrayRef` template class to replace `optional<ArrayRef>` and be the new type to represent `T[]?`  in native_functions.yaml. This solution has the added benefit that we won't lose the optimization for `optional<ArrayRef>` below when we move to using `std::optional` in C++17.
https://github.com/pytorch/pytorch/blob/913c1f83f49f9e1e2a494186cc0069d780cee852/c10/util/Optional.h#L429

cc @ezyang @bhosmer @smessmer @ljk53 @bdhirsh @swolchok
Repository: go
Issue: net/http: http/2 throughput is very slow compared to http/1.1
Labels: NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?
1.7
<pre>
$ go version
go version go1.17 linux/amd64
</pre>

### Does this issue reproduce with the latest release?
yes 

### What operating system and processor architecture are you using (`go env`)?
Linux, Windows, etc 
<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/dev/http2issue/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build38525640=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?
test http/2 vs http1.1 transfert speed with client and server from standard lib

see a complete POC here: https://github.com/nspeed-app/http2issue 

The issue is general, loopback (localhost) or over the wire.



### What did you expect to see?
same speed order than http1.1

### What did you see instead?
http/2 is at least x5 slower or worst
Repository: go
Issue: x/pkgsite: support more name formats in symbol search
Labels: NeedsInvestigation,pkgsite,pkgsite/search

<!--
Please answer these questions before submitting your issue. Thanks!
-->
 
### What is the URL of the page with the issue?
 
1. https://beta.pkg.go.dev/search?m=symbol&q=Task.CopyInBytes
1. https://beta.pkg.go.dev/search?m=symbol&q=CopyInBytes
1. https://beta.pkg.go.dev/search?m=symbol&q=gvisor.dev%2Fgvisor%2Fpkg%2Fsentry%2Fkernel.%28*Task%29.CopyInBytes
1. https://beta.pkg.go.dev/search?m=symbol&q=%28*Task%29.CopyInBytes
 
### What is your user agent?
 
<!-- 
You can find your user agent here:
https://www.whatismybrowser.com/detect/what-is-my-user-agent
-->
 
 Mozilla/5.0 (X11; CrOS x86_64 13982.69.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.130 Safari/537.36
 
### Screenshot
 
<!--
Please paste a screenshot of the page.
-->

![qwdhdhsGmjYqENh](https://user-images.githubusercontent.com/1293187/130250245-8b0a7b7f-c5a1-4b0c-82d6-868d94615112.png)
 
 
### What did you do?
 
<!--
If possible, provide a recipe for reproducing the error.
-->
 
 Search for functions named "CopyInBytes".
 
### What did you expect to see?
 
 Functions and methods named "CopyInBytes".
 
### What did you see instead?

Nothing. There is no function named CopyInBytes, only methods. Searching for [Task.CopyInBytes](https://beta.pkg.go.dev/search?m=symbol&q=Task.CopyInBytes) works, but it would be nice to support more flexibility in the way of searching.

There are two dimensions to this:

1. Support the precise symbol name.

This method has a pointer receiver, so the actual name is [(*Task).CopyInBytes](https://beta.pkg.go.dev/search?m=symbol&q=%28*Task%29.CopyInBytes), but that doesn't return any results. It should also be possible to use the fully qualified symbol name using the package path: [gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).CopyInBytes](https://beta.pkg.go.dev/search?m=symbol&q=gvisor.dev%2Fgvisor%2Fpkg%2Fsentry%2Fkernel.%28*Task%29.CopyInBytes)

I think both of these are particularly important for searching for symbols copied directly from a Go stacktrace, which will have this format.

2. Support searches without the type name.

I may not remember the type name, so it would be nice to be able to search for just the method name: [CopyInBytes](https://beta.pkg.go.dev/search?m=symbol&q=CopyInBytes). I would expect that to include all[1] of [these](https://cs.opensource.google/search?q=function:copyinbytes&sq=&ss=gvisor%2Fgvisor) results (other types with this method, including an interface definition).

[1] Except the ones on unexported types I suppose.
Repository: go
Issue: x/pkgsite: Support symbol search within module
Labels: Documentation,NeedsInvestigation,pkgsite,UX,pkgsite/search

<!--
Please answer these questions before submitting your issue. Thanks!
-->
 
### What is the URL of the page with the issue?
 
 https://beta.pkg.go.dev/gvisor.dev/gvisor

https://beta.pkg.go.dev/search?m=symbol&q=CompareAndSwapUint32
 
### What is your user agent?
 
<!-- 
You can find your user agent here:
https://www.whatismybrowser.com/detect/what-is-my-user-agent
-->
 
 Mozilla/5.0 (X11; CrOS x86_64 13982.69.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.130 Safari/537.36
 
### Screenshot
 
<!--
Please paste a screenshot of the page.
-->
 
 N/A
 
### What did you do?
 
<!--
If possible, provide a recipe for reproducing the error.
-->
 
 I would like to a way to do symbol search within a single module, exposed in the UI.

 As a concrete example, I know that the gvisor.dev/gvisor module has a function named [CompareAndSwapUint32](https://beta.pkg.go.dev/gvisor.dev/gvisor/pkg/atomicbitops#CompareAndSwapUint32), but I may not remember where it is. This is a common name, so a [global search](https://beta.pkg.go.dev/search?m=symbol&q=CompareAndSwapUint32) is not useful.

 (Bonus points if I could make a saved search to search multiple modules. Something like "baz (module:example.com/foo OR module:example.com/bar)").
 
### What did you expect to see?
 
 Some way to limit the search to the current module would be very helpful. Perhaps the search dropdown could have "Symbols" and "Symbols (this module only)".

Current package search is often desired too. This already exists via Ctrl+F, but if module search is added then package search should perhaps be surfaced in the same place in the UI as well.
 
### What did you see instead?

Nothing.
Repository: go
Issue: x/build: add windows-amd64-2019 builder
Labels: Builders,NeedsDecision,new-builder

GCE supports [Windows Server 2019](https://cloud.google.com/compute/docs/images/os-details#windows_server). This would increase our test coverage.

@golang/release
Repository: go
Issue: x/build: plan to remove windows-[386|amd64]-2008 builders
Labels: Builders,NeedsInvestigation

Windows 2008 has reached end of life status. We should remove this builder and investigate if there are any other steps that should be taken in the process.

@golang/release 
@bufflig