Repository: pytorch
Issue: DynamicQuantizedLinear shows incorrect qscheme after applying eager mode dynamic quantization
Labels: oncall: quantization,triaged

### 🐛 Describe the bug

I've been playing around with quantization for a little bit and I wanted to verify the qscheme (`torch.per_tensor_symmetric`) I defined for my weight and activation observers aligned with the modules I was quantizing. I just quantized my linear layer (`nn.Linear` class), and I noticed that it printed the wrong  qscheme (it was `torch.per_tensor_affine`) when I viewed it after quantization. For sanity sake, I looked at the weight and it appeared the correct qscheme was applied (the `scale` was an appropriate value and the` zero_point` was 0), but for some reason it still said the qscheme`was `per_tensor_affine`. 

To double check further, I changed the qscheme for the observers to` torch.per_tensor_affine` and when I viewed the weights again it appeared the correct qscheme was applied (scale was an appropriate value and the `zero_point` was an arbitrarily non-zero number). Overall, it appears to me the application of the qscheme works in practice, but the information displayed when you print the model (or a module in the model) appears to be wrong which can be misleading. 

These calls are what shows the information when printing the `DynamicQuantizedLinear` module

```python
# quant_venv/lib/python3.10/site-packages/torch/ao/nn/quantized/dynamic/modules/linear.py
    def _weight_bias(self):
        return self._packed_params._weight_bias()

    def weight(self):
        return self._weight_bias()[0]

#...
    def extra_repr(self):
        extra_repr_str = 'in_features={}, out_features={}, dtype={}'.format(
            self.in_features, self.out_features, self._packed_params.dtype
        )
        if self._packed_params.dtype == torch.qint8:
            extra_repr_str += ', qscheme={}'.format(self.weight().qscheme())
        return extra_repr_str

# quant_venv/lib/python3.10/site-packages/torch/ao/nn/quantized/modules/linear.py
    @torch.jit.export
    def _weight_bias(self):
        if self.dtype == torch.qint8:
            return torch.ops.quantized.linear_unpack(self._packed_params)
```

Below is example to replicate this issue:

```python
import torch
import torch.nn as nn
import torch.ao.quantization as quantize

class DummyModel(nn.Module):

    def __init__(self) -> None:
        super().__init__()
        self.linear = nn.Linear(100, 1)
        self.relu = nn.ReLU()

    def forward(self, x):
        return self.relu(self.linear(x))

dummy_model = DummyModel()

weight_observer = quantize.MinMaxObserver.with_args(dtype=torch.qint8, qscheme=torch.per_channel_symmetric, 
                                                              quant_min=-127, quant_max=127)
activation_observer = quantize.PlaceholderObserver.with_args(dtype=torch.quint8, is_dynamic=True, 
                                                             quant_min=0, quant_max=255)
dynamic_qconfig = quantize.QConfig(weight=weight_observer, activation=activation_observer)

module_mappings = {nn.Linear: dynamic_qconfig}
dynamic_dummy = quantize.quantize_dynamic(dummy_model, qconfig_spec=module_mappings, 
                                           dtype=torch.qint8, inplace=False)
                                           
dynamic_quantized_linear = dynamic_dummy.linear
print(dynamic_quantized_linear)
print(dynamic_quantized_linear.weight())
```

Output:
```bash
DynamicQuantizedLinear(in_features=100, out_features=1, dtype=torch.qint8, qscheme=torch.per_tensor_affine)
tensor([[ 0.0741,  0.0101, -0.0226, -0.0936, -0.0640, -0.0491, -0.0078, -0.0250,
          0.0242,  0.0936, -0.0764, -0.0780, -0.0086, -0.0086,  0.0156,  0.0850,
         -0.0702, -0.0218,  0.0491, -0.0835, -0.0055, -0.0078,  0.0226, -0.0312,
         -0.0959, -0.0398,  0.0429,  0.0078,  0.0562,  0.0406,  0.0140,  0.0913,
          0.0265,  0.0148,  0.0187,  0.0936, -0.0101,  0.0842, -0.0016,  0.0094,
          0.0312,  0.0928,  0.0741,  0.0780, -0.0827, -0.0460, -0.0195,  0.0710,
          0.0148, -0.0179, -0.0538,  0.0515, -0.0312,  0.0218,  0.0359, -0.0452,
         -0.0881, -0.0437, -0.0452, -0.0733,  0.0991, -0.0359,  0.0686, -0.0749,
         -0.0507,  0.0936, -0.0304,  0.0741,  0.0140,  0.0140, -0.0039, -0.0507,
          0.0725,  0.0975,  0.0117, -0.0140,  0.0140, -0.0265,  0.0842,  0.0172,
         -0.0398, -0.0608, -0.0936, -0.0086, -0.0265, -0.0913, -0.0164, -0.0281,
          0.0234,  0.0920,  0.0187, -0.0211,  0.0562, -0.0281, -0.0398, -0.0702,
          0.0218,  0.0421, -0.0148, -0.0359]], size=(1, 100),
       dtype=torch.qint8, quantization_scheme=torch.per_tensor_affine,
       scale=0.0007800564053468406, zero_point=0)
```

### Versions

```bash
Collecting environment information...
PyTorch version: 2.0.1+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.27.5
Libc version: glibc-2.35

Python version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4080
Nvidia driver version: 528.24
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Address sizes:                   48 bits physical, 48 bits virtual
Byte Order:                      Little Endian
CPU(s):                          16
On-line CPU(s) list:             0-15
Vendor ID:                       AuthenticAMD
Model name:                      AMD Ryzen 7 7700X 8-Core Processor
CPU family:                      25
Model:                           97
Thread(s) per core:              2
Core(s) per socket:              8
Socket(s):                       1
Stepping:                        2
BogoMIPS:                        8982.97
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core ssbd ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_bf16 clzero xsaveerptr arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload avx512vbmi umip avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid fsrm
Virtualization:                  AMD-V
Hypervisor vendor:               Microsoft
Virtualization type:             full
L1d cache:                       256 KiB (8 instances)
L1i cache:                       256 KiB (8 instances)
L2 cache:                        8 MiB (8 instances)
L3 cache:                        32 MiB (1 instance)
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.0
[pip3] torch==2.0.1
[pip3] triton==2.0.0
[conda] Could not collect
```

cc @jerryzh168 @jianyuh @raghuramank100 @jamesr66a @vkuzo @jgong5 @Xia-Weiwen @leslie-fang-intel