sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: torch.kron of a transposed input error
Labels: module: error checking,triaged,function request

## 🐛 Bug
`kron` of a transposed input crash

## To Reproduce

```python
torch.kron(torch.randn(4, 4), torch.randn(4, 4).T)
```
```
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
```

## Environment
```
PyTorch version: 1.8.0+cpu
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux 10 (buster) (x86_64)
GCC version: (Debian 8.3.0-6) 8.3.0
Clang version: Could not collect
CMake version: version 3.13.4

Python version: 3.8 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: 9.2.148
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.1
[pip3] numpydoc==1.1.0
[pip3] torch==1.8.0+cpu
[pip3] torch-cluster==1.5.9
[pip3] torch-geometric==1.6.3
[pip3] torch-scatter==2.0.6
[pip3] torch-sparse==0.6.9
[pip3] torch-spline-conv==1.2.1
[conda] blas                      1.0                         mkl  
[conda] mkl                       2020.2                      256  
[conda] mkl-service               2.3.0            py38he904b0f_0  
[conda] mkl_fft                   1.2.0            py38h23d657b_0  
[conda] mkl_random                1.1.1            py38h0573a6f_0  
[conda] numpy                     1.20.1                   pypi_0    pypi
[conda] numpydoc                  1.1.0              pyhd3eb1b0_1  
[conda] torch                     1.8.0+cpu                pypi_0    pypi
[conda] torch-cluster             1.5.9                    pypi_0    pypi
[conda] torch-geometric           1.6.3                    pypi_0    pypi
[conda] torch-scatter             2.0.6                    pypi_0    pypi
[conda] torch-sparse              0.6.9                    pypi_0    pypi
[conda] torch-spline-conv         1.2.1                    pypi_0    pypi
```
Repository: godot
Issue: Window stretch causes text filtering issues
Labels: bug,topic:rendering,topic:gui,topic:2d

**Godot version:**
Godot_v3.2.4-rc5


**OS/device including version:**
Windows 10 64 bit.
GLES2 and GLES3.

**Issue description:**
_First, the expected behavior:_
If the stretch mode in the project settings (`display/window/stretch/mode`) is set to `2d`, text in the UI (for example Labels) gets scaled if the window is scaled.
The font is also scaled appropriately, such that 1 pixel in the font is 1 pixel on the screen.

_Now, the issue:_
Sporadically, a label's size will be one pixel off, such that one line of pixels is duplicated or dropped (because NEAREST filtering is used).
This should not happen, the label should always have the perfect size.

(This issue is _not_ about the positions of the Labels jittering while the window is scaled. I assume that cannot be solved, unless sub-pixel accurate font rendering is implemented.)

Note that neither `rendering/2d/snapping/use_gpu_pixel_snap` nor `gui/common/snap_controls_to_pixels` gets rid of the issue.
(GPU Pixel Snap seems to make it occur slightly less, but it is still there.)



**Steps to reproduce:**
Add several Labels using a DynamicFont.
Set `display/window/stretch/mode` to `2d`, and `display/window/stretch/aspect` to `expand`.

**Minimal reproduction project:**
[text_scaling.zip](https://github.com/godotengine/godot/files/6155190/text_scaling.zip)

The images below demonstrate the issue.
The outline is only enabled in order to make it easier to see. The issue occurs even with outlines disabled. (Again, with and without GPU Pixel Snap.)
I'm not sure if the window sizes are platform / device dependent.
In the first image, you can see the that the outline of the marked Label is one pixel thicker on the top. That goes away, when the window is scaled.
![text_scaling_size_jitter](https://user-images.githubusercontent.com/80684659/111442060-414d3880-8708-11eb-8afc-eee840983742.png)

The second image should be obvious. A row of pixels seems to be missing in the marked Label.
![text_scaling_size_jitter2](https://user-images.githubusercontent.com/80684659/111443497-bbca8800-8709-11eb-9d88-c6070c736dcd.png)
Repository: flutter
Issue: [in_app_purchase] support paymentQueue:shouldAddStorePayment:forProduct:
Labels: c: new feature,p: in_app_purchase,package,c: proposal,team-ecosystem,P3,triaged-ecosystem

iOS has method  `paymentQueue:shouldAddStorePayment:forProduct:` in `getAppStoreInitiatedProducts`
Is there any way to get the product or info from this function?

We saw https://pub.dev/packages/flutter_inapp_purchase/changelog support it from `0.8`
But we want to use official package if possible.
Repository: go
Issue: cmd/compile: bounds check not eliminated
Labels: NeedsFix,compiler/runtime

I am writing code to count how long a common prefix two slices have, and I can't seem to make it bounds-check-free.

At current master, this function does not eliminate the bounds check for y[j], although it does for x[i]:

```
func f1(x, y []int, i, j int) int {
	i0 := i
	if i >= 0 && i < len(x) && j >= 0 && j < len(y) {
		for i < len(x) && j < len(y) && x[i] == y[j] {
			i++
			j++
		}
	}
	return i - i0
}
```

If I remove the` i < len(x) &&` and the `i++`, then the y[j] bounds check is eliminated:

```
func f2(x, y []int, i, j int) int {
	i0 := i
	if i >= 0 && i < len(x) && j >= 0 && j < len(y) {
		for j < len(y) && x[i] == y[j] {
			j++
		}
	}
	return i - i0
}
```

If I leave out the `i++` but bring back the (unnecessary) `i < len(x)`, the y[j] bounds check returns:

```
func f3(x, y []int, i, j int) int {
	i0 := i
	if i >= 0 && i < len(x) && j >= 0 && j < len(y) {
		for i < len(x) && j < len(y) && x[i] == y[j] {
			j++
		}
	}
	return i - i0
}
```

This is a simpler case that also has a bounds check and may share the same root cause:

```
func g1(x, y []int, i, j int) int {
	i0 := i
	if i >= 0 {
		for ; ; i++ {
			if i >= len(x) {
				break
			}
			if x[i] != 0 {
				break
			}
		}
	}
	return i - i0
}
```

This equivalent program has no check:

```
func g2(x, y []int, i, j int) int {
	i0 := i
	if i >= 0 {
		for ; i < len(x) && x[i] != 0; i++ {
		}
	}
	return i - i0
}
```

This suggests the problem has to do with either the inverted condition or the use of a short-circuit to exit the loop, neither of which should fundamentally change what is being proved.

The same happens counting backward: h0 and h1 have checks (h0 has just one), but h2 is check-free:

```
func h0(x, y []int, i, j int) int {
	i0 := i
	if i <= len(x) && j <= len(y) {
		for i > 0 && j > 0 && x[i-1] == y[j-1] {
			i--
			j--
		}
	}
	return i0 - i
}

func h1(x, y []int, i, j int) int {
	i0 := i
	if i <= len(x) {
		for ; ; i-- {
			if i <= 0 {
				break
			}
			if x[i-1] != 0 {
				break
			}
		}
	}
	return i - i0
}

func h2(x, y []int, i, j int) int {
	i0 := i
	if i <= len(x) {
		for ; i > 0 && x[i-1] != 0; i-- {
		}
	}
	return i - i0
}
```


/cc @aclements @randall77 @rasky @brtzsnr (prove authors as best I can tell from git blame)
Repository: pytorch
Issue: Add additive angular margin loss
Labels: feature,module: loss,triaged

## 🚀 Feature
Adding support for Additive Angular margin loss to PyTorch as described by *Deng et.al* in *ArcFace: Additive Angular Margin Loss for Deep Face Recognition*

## Motivation

Additive angular margin loss can create highly discriminative embedding appropriate for re-identification and cross-domain instance matching

## Pitch

Add support for additive angular margin loss support to PyTorch. Will have to add a new type of fc-layer that returns output after adding angular margin and can then be fed into a softmax loss.

## Alternatives

Use other libraries that already provide an implementation

## Additional context

Since I am already going to implement this for my own use, given the green light, I'd be happy to make a PR.
Repository: terminal
Issue: Ctrl+Insert does not copy the selected text from Command Palette
Labels: Help Wanted,Issue-Bug,Product-Terminal,Needs-Tag-Fix,Priority-3,good first issue,Area-CmdPal

# Environment

```none
Windows build number: 10.0.19042.867
Windows Terminal version (if applicable): 1.6.10571.0
```

# Steps to reproduce

1. Delete any saved Windows Terminal settings.
2. Start Windows Terminal.
3. Use the mouse to select some text in the pane.
4. Press Ctrl+Shift+P to open the command palette.
5. Type `abc`.
6. Press Ctrl+A to select the text `abc`.
7. Press Ctrl+Insert.

# Expected behavior

The text `abc` should be copied to the clipboard, and the command palette should remain open.

# Actual behavior

The command palette closes, and the text that you selected in the pane is copied to the clipboard.

# Notes

If you copy by pressing Ctrl+C instead of Ctrl+Insert, then it works as expected.
Repository: pytorch
Issue: Support Array Interface (__array_interface__ attribute)
Labels: triaged,enhancement,module: numpy

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->

Implement `torch.Tensor.__array_interface__` attribute as defined by [Array Interface](https://numpy.org/doc/stable/reference/arrays.interface.html)

## Motivation

<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->

The array interface allows no-copy sharing of data buffers in between different array-like objects.

PyTorch currently implements `torch.Tensor.__cuda_array_interface__` attribute defined by [CUDA Array Interface](https://numba.pydata.org/numba-doc/dev/cuda/cuda_array_interface.html) for conveniently sharing data stored in CUDA devices while sharing data in CPU memory is currently possible via NumPy ndarray object:
```
>>> import torch
>>> t = torch.tensor([1, 2, 3, 4, 5])
>>> import numpy
>>> numpy.asarray(t).__array_interface__
{'data': (94135211131264, False), 'strides': None, 'descr': [('', '<i8')], 'typestr': '<i8', 'shape': (5,), 'version': 3}
```
Dependence on NumPy for sharing data buffers between PyTorch and other array-like objects is unnecessary.

## Pitch

<!-- A clear and concise description of what you want to happen. -->

Add a new attribute `__array_interface__` to a `torch.Tensor` object that
- is a dictionary containing data buffer data as defined by the Array Interface.
- is enabled only when the Tensor object uses CPU storage. This behavior is in line with the `__cuda_array_interface__` attribute availability (that is enabled only when the Tensor object uses CUDA storage).
- is backward compatible to existing `torch.Tensor.__array__()` method because `numpy.asarray` prefers to use `__array_interface__` protocol over the `__array__` protocol.

## Alternatives

<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->

- The alternative is to wrap PyTorch Tensor object with NumPy ndarray as described above.
- Array Interface defines `__array_struct__` as an alternative way to share data buffers. `__array_struct__` can be considered obsolete via [PEP 3118- Buffer Protocol](https://www.python.org/dev/peps/pep-3118/).

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->

This feature request is a follow-up to #51156  and https://pearu.github.io/array_interface_pytorch.html discussions.


cc @mruberry @rgommers @heitorschueroff
Repository: PowerToys
Issue: Make test projects names consistent
Labels: Idea-Enhancement,Area-Tests,Area-Quality

As mentioned in https://github.com/microsoft/PowerToys/pull/10244, test project and dlls naming is not consistent.
https://github.com/microsoft/PowerToys/blob/7c8ed9e2bbb11855d298b4c3eb94b95b5b9aacfa/.pipelines/ci/templates/build-powertoys-steps.yml#L97-L151
Repository: TypeScript
Issue: Narrowing for key type by `in` operator
Labels: Suggestion,Awaiting More Feedback

# Suggestion

A `k in v` check should narrow type of `k: K` to `K & keyof typeof v`.

## 🔍 Search Terms

`in operator narrowing`

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

This code should compile due to narrowing on `x`:

```ts
const o = {foo: 1, bar: 2} as const;
const x: string = 'foo';
if (x in o) {
    const y: "foo" | "bar" = x; // OK
}
```

Currently it could be made with custom type guard

```ts
const in_ = <K extends string, O>(key: K, object: O): key is K & keyof O => key in object;
if (in_(x, o)) {
    const y: "foo" | "bar" = x; // OK
}
```

## 📃 Motivating Example

When validating a JSON with some kind of AST (or otherwise containing a tagged union) the only type we can have for a tag is a `string`.

```ts
const validateDisjointUnion = <O extends object>(
    nodeTypeValidators: { [K in keyof O]: (value: O[K]) => boolean },
    value: Json,
) => {
    if (typeof value !== 'object' || !('type' in value)) throw 42;
    const {type} = value;
    if (typeof type !== 'string' || !(type in nodeTypeValidators)) throw 42;
    // expression of type 'string' can't be used to index type '{ [K in keyof O]: (value: O[K]) => boolean; }'.
    return nodeTypeValidators[type](value);
}
```

## 💻 Use Cases

`in_` solves the issue, but it involves a type guard. Type guards are "dangerous" in a sense that they can be used improperly (for example, `!(key in object)` would compile as well, but would lead to runtime error).

There is a [related feature request](https://github.com/microsoft/TypeScript/issues/21732) to narrow type for second parameter of `in` operator. As far as I'm aware, there is no syntax to specify type of `in_` that would guard on both parameters at the same time.

```ts
const guardBoth = <A, B>(a: A, b: B): (a is string) & (b is string) => { ... };
```

*Edit.* Not even

```ts
// A type predicate cannot reference a rest parameter.(1229)
const in_ = <K extends string, O, T>(...args: [K, O]): args is [K & keyof O, O & { [L in K]: unknown }] => args[0] in args[1];
```
Repository: PowerToys
Issue: Change output build directory to x64 for all test projects
Labels: Area-Tests,Area-Quality,Cost-Small,Planning-Consideration,Issue-Task

List of projects:
- `src\common\interop\interop-tests`
- `src\modules\launcher\Plugins\Microsoft.Plugin.Folder.UnitTests`
- `src\modules\launcher\Plugins\Microsoft.Plugin.Program.UnitTests`
- `src\modules\launcher\Plugins\Microsoft.Plugin.Uri.UnitTests`
- `src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest`
- `src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry.UnitTest`
- `src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.System.UnitTests`
- `src\modules\previewpane\PreviewPaneUnitTests`
- `src\modules\previewpane\UnitTests-PreviewHandlerCommon`
- `src\modules\previewpane\UnitTests-SvgPreviewHandler`
- `src\modules\previewpane\UnitTests-SvgThumbnailProvider`
Repository: pytorch
Issue: as_tensor returns CPU copy of a CUDA buffer object implementing CUDA Array Interface
Labels: module: cuda,triaged,module: numba

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

`torch.as_tensor` returns a CPU copy of an object that implements [CUDA Array Interface (`__cuda_array_interface__` attribute)](https://numba.pydata.org/numba-doc/dev/cuda/cuda_array_interface.html)

## To Reproduce

Steps to reproduce the behavior:

```
>>> import torch
>>> t = torch.tensor([1, 2, 3, 4, 5], device='cuda')
>>> class A:
...     __cuda_array_interface__ = t.__cuda_array_interface__
... 
>>> t2 = torch.as_tensor(A())
>>> t2
tensor([1, 2, 3, 4, 5])
>>> t2.device
device(type='cpu')
>>> t.device == t2.device
False
>>> t[0] = 123
>>> bool(t[0] == t2[0])
False
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

The result of `torch.as_tensor(<object with __cuda_array_interface__ attribute>)` should be a no-copy view of object's data buffer using CUDA storage:
```
>>> t.device == t2.device
True
>>> t[0] = 123
>>> bool(t[0] == t2[0])
True
```

## Environment

<details>

```
PyTorch version: 1.9.0a0+git63e0e88
Is debug build: False
CUDA used to build PyTorch: 11.0
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.4 LTS (x86_64)
GCC version: (crosstool-NG 1.24.0.133_b0863d8_dirty) 9.3.0
Clang version: 11.0.1 (https://github.com/conda-forge/clangdev-feedstock 9fbb64b62ff49e9d206a06e62453b27557b3ed73)
CMake version: version 3.19.3

Python version: 3.9 (64-bit runtime)
Is CUDA available: True
CUDA runtime version: 11.0.221
GPU models and configuration: 
GPU 0: GeForce RTX 2060 SUPER
GPU 1: GeForce RTX 2060 SUPER

Nvidia driver version: 460.27.04
cuDNN version: Probably one of the following:
/usr/local/cuda-10.1.243/targets/x86_64-linux/lib/libcudnn.so.7
/usr/local/cuda-10.2.89/targets/x86_64-linux/lib/libcudnn.so.7
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.19.5
[pip3] torch==1.9.0a0+git63e0e88
[conda] magma-cuda110             2.5.2                         1    pytorch
[conda] mkl                       2020.4             h726a3e6_304    conda-forge
[conda] mkl-include               2020.4             h726a3e6_304    conda-forge
[conda] numpy                     1.19.5           py39hdbf815f_1    conda-forge
[conda] torch                     1.9.0a0+git63e0e88           dev_0    <develop>
```

</details>

## Additional context

<!-- Add any other context about the problem here. -->

This bug report is a follow-up to #51156 and https://pearu.github.io/array_interface_pytorch.html discussions.

cc @ngimel
Repository: storybook
Issue: Storybook controls dont react to v-model changes
Labels: feature request,vue,addon: controls

**Describe the bug**
 - Changing state in the controls updates the component as expected
 - Changing state in the component does not update the control state as expected
 
 In vue you should not mutate props, and they propose you should implent a handler like so for v-model;
 ```
   setup(props, { emit }) {
    const model = computed({
      get() {
        return props.value
      },
      set(value) {
        emit('input', value)
      },
    })
    return {
      model,
    }
  },
  ```
  I've done this but storybook doesn't react to the input event

**To Reproduce**
Create a component that uses v-model and have storybook provide the value
#10019 also shows this 

**Expected behavior**
Controls to react to the input

**Screenshots**
If applicable, add screenshots to help explain your problem.
![image](https://user-images.githubusercontent.com/2346599/75688949-a4f0f900-5ca0-11ea-8a8d-21af7cc788f7.gif)

**Code snippets**
If applicable, add code samples to help explain your problem.

**System**
```
λ npx sb@next info

Environment Info:

  System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 10.16.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files\nodejs\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 89.0.4389.90
    Edge: Spartan (44.18362.449.0)
  npmPackages:
    @storybook/addon-essentials: ^6.1.14 => 6.1.14
    @storybook/vue: ^6.1.14 => 6.1.14
```

**Additional context**
Add any other context about the problem here.
Repository: TypeScript
Issue: Static variable may be undefined when constructing an object of the same class
Labels: Suggestion,Awaiting More Feedback

# Bug Report

I'm not sure whether this may be a issue that can be fixed or just keep it as is "by design". I haven't found any other issues similar to this one here, at least with the search terms I tried (sorry if someone else already reported this 🙂).

### 🔎 Search Terms

static, undefined, uninitialized, constructor

### 🕗 Version & Regression Information

- This is the behavior in every version I tried, and I reviewed the FAQ for entries about static variables, variable order initialization, etc., but none of them seem to match this.

At the moment of writing this, TypeScript version is 4.2.3.

### ⏯ Playground Link

[Playground Link](https://www.typescriptlang.org/play?#code/MYGwhgzhAECC0G8BQ1XQA4FcBGICWw0EALmMQdAE4CmYAJgPYB2IAntHkyWE8NQFxxoAXmhNqAdzgAKAJQBuFGiy4K3coRr1mbaMGbcmxQU0wBbbNUojoARkVpoS1CvyF9XYpUzBiDSnKIzo56Bgwg1AB0IAwA5tKwkR6GxAA0cEkGpEbQAFTQAKwKwY7J4VEx8YnJ2cSRfgDKXpzxssWOAL5IXUA)

### 💻 Code

```
class A {
    public static readonly instance: A = new A();
    public static readonly constant: number = 1;
    
    public constructor() {
        console.log(A.constant, A.constant * 5);
        console.log(A.constant.toString());
    }
}
```

### 🙁 Actual behavior

When calling the constructor to initialize the static variable `instance`, `A.constant` is not yet initialized (it's undefined), so the constructor logs `undefined, NaN`.

In addition, `A.constant.toString()` gives a javascript execution error, which even in strict mode the compiler doesn't catch.

### 🙂 Expected behavior

The compiler could tell that `constant` has type `number | undefined` at that moment (manually changing the type of `constant`to `number | undefined` correctly yields a compiler error) or even rearrange the generated javascript to initialize first `constant` and then `instance` (which I think it may be more difficult in more complex scenarios).

Thank you very much!
Repository: excalidraw
Issue: Expose measurements to API
Labels: package:excalidraw

I want to link nested text under the excalidraw object in Roam Research with text in the drawing. I am facing difficulties with sizing. Where can I find helper functions to calculate width and height based on parameters like fontFamily, fontSize?

Aakansha — Today at 12:02 PM
We don't expose any API right now for this. could you create an issue for this ? @dwelle we might want to expose https://github.com/excalidraw/excalidraw/blob/master/src/element/newElement.ts#L137 ?

dwelle — Today at 12:53 PM
yea
though I don't recall if that API is enough or whether some of the measurements in newElement is needed when updating the text element
Repository: godot
Issue: [Godot Physics] Cylinder-Cylinder collision issues with move_and_slide()
Labels: bug,topic:physics

**Godot version:**
3.3.rc.custom_build.dae319355

**OS/device including version:**
N/A

**Issue description:**

Cylinder-cylinder collisions behave erratically with move_and_slide()

**Steps to reproduce:**

* Use `move_and_slide()` with a cylinder collision shape to walk over a cylinder collision shape.

https://user-images.githubusercontent.com/79001820/111470268-66c35c00-8773-11eb-82ae-d349f2d14d07.mp4

**Minimal reproduction project:**

MRP: https://github.com/godotengine/godot/files/6175149/cylinder-collision-bug.zip (press z to toggle collision shape)
Also for further testing: https://github.com/e344fde6bf/godot-physics-sandbox