Skip to content

Commit 745085f

Browse files
authored
Revert "Rename Layout -> TensorImpl" (#1040)
Revert "Rename Layout -> TensorImpl (#1028)" This reverts commit cc8bf85.
1 parent cc8bf85 commit 745085f

File tree

20 files changed

+223
-223
lines changed

20 files changed

+223
-223
lines changed

.github/workflows/regression_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
gpu-arch-version: "12.1"
3636
- name: CUDA 2.4
3737
runs-on: linux.g5.12xlarge.nvidia.gpu
38-
torch-spec: 'torch==2.4.1'
38+
torch-spec: 'torch==2.4.0'
3939
gpu-arch-type: "cuda"
4040
gpu-arch-version: "12.1"
4141
- name: CUDA Nightly (Oct 1)

benchmarks/benchmark_fp6.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pandas as pd
33
import torch.nn.functional as F
44
from torchao.dtypes import to_affine_quantized_fpx
5-
from torchao.dtypes.floatx import FloatxTensorCoreAQTTensorImpl, FloatxTensorCoreLayoutType
5+
from torchao.dtypes.floatx import FloatxTensorCoreAQTLayout, FloatxTensorCoreLayoutType
66
from torchao.utils import benchmark_torch_function_in_microseconds
77
from tqdm import tqdm
88

test/dtypes/test_affine_quantized_float.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,18 @@ def test_serialization(self, mode: str):
210210

211211
# Compare weights
212212
if mode == "weight-only":
213-
original_weight = original_layer.weight.tensor_impl.float8_data.to(
213+
original_weight = original_layer.weight.layout_tensor.float8_data.to(
214+
torch.float32
215+
)
216+
new_weight = new_layer.weight.layout_tensor.float8_data.to(
214217
torch.float32
215218
)
216-
new_weight = new_layer.weight.tensor_impl.float8_data.to(torch.float32)
217219
else:
218-
original_weight = original_layer.weight.original_weight_tensor.tensor_impl.float8_data.to(
220+
original_weight = original_layer.weight.original_weight_tensor.layout_tensor.float8_data.to(
219221
torch.float32
220222
)
221-
new_weight = (
222-
new_layer.weight.original_weight_tensor.tensor_impl.float8_data.to(
223-
torch.float32
224-
)
223+
new_weight = new_layer.weight.original_weight_tensor.layout_tensor.float8_data.to(
224+
torch.float32
225225
)
226226

227227
assert torch.allclose(

test/dtypes/test_floatx.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
run_tests,
1010
)
1111
from torchao.dtypes.floatx import (
12-
FloatxTensorCoreAQTTensorImpl,
12+
FloatxTensorCoreAQTLayout,
1313
FloatxTensorCoreLayoutType,
1414
to_scaled_tc_floatx,
1515
from_scaled_tc_floatx,
@@ -28,7 +28,7 @@
2828
_Floatx_DTYPES = [(3, 2), (2, 2)]
2929

3030

31-
class TestFloatxTensorCoreAQTTensorImpl(TestCase):
31+
class TestFloatxTensorCoreAQTLayout(TestCase):
3232
@parametrize("device", _DEVICES)
3333
def test_pack_tc_fp6_correctness(self, device):
3434
x = torch.randint(256, size=(256, 64), dtype=torch.uint8, device=device)
@@ -82,10 +82,10 @@ def test_to_copy_device(self, ebits, mbits):
8282
scale = choose_qparams_affine_floatx(x, ebits, mbits)
8383
x = quantize_affine_floatx(x, scale, ebits, mbits)
8484
layout_type = FloatxTensorCoreLayoutType(ebits, mbits)
85-
floatx_tensor_impl = FloatxTensorCoreAQTTensorImpl.from_plain(x, scale, None, layout_type).cuda()
86-
assert floatx_tensor_impl.device.type == "cuda"
87-
floatx_tensor_impl = floatx_tensor_impl.cpu()
88-
assert floatx_tensor_impl.device.type == "cpu"
85+
floatx_layout_tensor = FloatxTensorCoreAQTLayout.from_plain(x, scale, None, layout_type).cuda()
86+
assert floatx_layout_tensor.device.type == "cuda"
87+
floatx_layout_tensor = floatx_layout_tensor.cpu()
88+
assert floatx_layout_tensor.device.type == "cpu"
8989

9090
@pytest.mark.skipif(not torch.cuda.is_available(), reason="CUDA not available")
9191
@pytest.mark.skipif(not TORCH_VERSION_AT_LEAST_2_5, reason="quantization only works with torch.compile for 2.5+")
@@ -106,7 +106,7 @@ def test_fpx_weight_only(self, ebits, mbits, bias):
106106
torch.testing.assert_close(actual, expected)
107107

108108

109-
instantiate_parametrized_tests(TestFloatxTensorCoreAQTTensorImpl)
109+
instantiate_parametrized_tests(TestFloatxTensorCoreAQTLayout)
110110

111111

112112
if __name__ == "__main__":

test/hqq/test_hqq_affine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from torchao.dtypes.affine_quantized_tensor import (
44
to_affine_quantized_intx,
55
ZeroPointDomain,
6-
PlainAQTTensorImpl,
6+
PlainAQTLayout,
77
PlainLayoutType,
8-
TensorCoreTiledAQTTensorImpl,
8+
TensorCoreTiledAQTLayout,
99
TensorCoreTiledLayoutType,
1010
MappingType,
1111
)

test/integration/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ def forward(self, x):
10511051
self.assertTrue(torch.equal(ref_q, test))
10521052

10531053
@parameterized.expand(COMMON_DEVICE_DTYPE)
1054-
@unittest.skipIf(is_fbcode(), "'PlainAQTTensorImpl' object has no attribute 'int_data'")
1054+
@unittest.skipIf(is_fbcode(), "'PlainAQTLayout' object has no attribute 'int_data'")
10551055
@torch.no_grad()
10561056
def test_save_load_dqtensors(self, device, dtype):
10571057
if device == "cpu":

torchao/dtypes/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
SemiSparseLayoutType,
1515
TensorCoreTiledLayoutType,
1616
Float8LayoutType,
17-
Float8AQTTensorImpl,
17+
Float8AQTLayout,
1818
MarlinSparseLayoutType,
1919
)
2020

@@ -33,6 +33,6 @@
3333
"SemiSparseLayoutType",
3434
"TensorCoreTiledLayoutType",
3535
"Float8LayoutType",
36-
"Float8AQTTensorImpl",
36+
"Float8AQTLayout",
3737
"MarlinSparseLayoutType",
3838
]

0 commit comments

Comments
 (0)