Skip to content

Commit 0d106c9

Browse files
committed
fix issue with memory going out of scope
1 parent 9a05ad6 commit 0d106c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

onnxruntime/contrib_ops/webgpu/quantization/gather_block_quantized.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ Status GatherBlockQuantized::ComputeInternal(ComputeContext& context) const {
137137
bool is_signed = x_dtype == ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8 || x_dtype == ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4;
138138
bool is_int8 = x_dtype == ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8 || x_dtype == ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8;
139139

140+
std::optional<Tensor> data_representation_4bit;
141+
std::optional<Tensor> zero_points_representation_4bit;
140142
if (bits_ == 4 && is_int8) {
141-
std::optional<Tensor> data_representation_4bit;
142-
std::optional<Tensor> zero_points_representation_4bit;
143143
TensorShape data_representation_4bit_shape{x->Shape()};
144144
MLDataType new_dtype = (x_dtype == ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8) ? DataTypeImpl::GetType<UInt4x2>() : DataTypeImpl::GetType<Int4x2>();
145145
auto memory_info = OrtMemoryInfo{

0 commit comments

Comments
 (0)