@@ -45,7 +45,7 @@ Status ConvTranspose2DProgram::GenerateShaderCode(ShaderHelper& shader) const {
45
45
}
46
46
} else {
47
47
if (is_channels_last_) {
48
- ss << " let dy_offset = " << dy.IndicesToOffset (" dy_indices_t(batch, idyR, idyC, inputChannel)" ) << " / " << a_components_ << " ;\n "
48
+ ss << " let dy_offset = " << dy.IndicesToOffset (" dy_indices_t(batch, idyR, idyC, inputChannel)" ) << " ;\n "
49
49
<< " let xValue = " << dy.GetByOffset (" dy_offset" ) << " ;\n " ;
50
50
} else {
51
51
ss << " let xValue = " << dy.GetByIndices (" dy_indices_t(batch, inputChannel, idyR, idyC)" ) << " ;\n " ;
@@ -57,7 +57,7 @@ Status ConvTranspose2DProgram::GenerateShaderCode(ShaderHelper& shader) const {
57
57
} else {
58
58
for (uint32_t i = 0 ; i < a_components_; ++i) {
59
59
ss << " let w_indices = w_indices_t(u32(wRPerm), u32(wCPerm), inputChannel + " << i << " , wOutChannel);\n "
60
- << " let w_offset = " << w.IndicesToOffset (" w_indices" ) << " / " << b_components_ << " ;\n "
60
+ << " let w_offset = " << w.IndicesToOffset (" w_indices" ) << " ;\n "
61
61
<< " let wValue = " << w.GetByOffset (" w_offset" ) << " ;\n "
62
62
<< " dotProd = dotProd + xValue[" << i << " ] * wValue;\n " ;
63
63
}
@@ -132,8 +132,8 @@ Status ConvTranspose2DProgram::GenerateShaderCode(ShaderHelper& shader) const {
132
132
if (pack_input_as4_) {
133
133
shader.MainFunctionBody () << " let dy_indices = dy_indices_t(batch, idyR, idyC, inputChannels);\n "
134
134
<< " let w_indices = w_indices_t(u32(wRPerm), u32(wCPerm, inputChannel, wOutChannel);\n "
135
- << " var x_offset = " << dy.IndicesToOffset (" dy_indices" ) << " / " << a_components_ << " ;\n "
136
- << " var w_offset = " << w.IndicesToOffset (" w_indices" ) << " / " << b_components_ << " ;\n " ;
135
+ << " var x_offset = " << dy.IndicesToOffset (" dy_indices" ) << " ;\n "
136
+ << " var w_offset = " << w.IndicesToOffset (" w_indices" ) << " ;\n " ;
137
137
}
138
138
139
139
shader.MainFunctionBody () << " for (var d2: u32 = 0; d2 < uniforms.input_channels_per_group_int; d2 = d2 + " << (pack_input_as4_ ? 4 : a_components_) << " ) {\n "
@@ -145,7 +145,7 @@ Status ConvTranspose2DProgram::GenerateShaderCode(ShaderHelper& shader) const {
145
145
<< " }\n "
146
146
<< " wR = wR + uniforms.strides.x - 1;\n "
147
147
<< " }\n "
148
- << " let value = dotProd" << (has_bias_ ? " + bias[d1 / " + std::to_string (components_) + " ]" : " " ) << " ;\n "
148
+ << " let value = dotProd" << (has_bias_ ? " + bias[d1]" : " " ) << " ;\n "
149
149
<< output.SetByOffset (" global_idx" , " value" ) << " \n " ;
150
150
return Status::OK ();
151
151
}
@@ -169,7 +169,7 @@ ConvTranspose2DProgram CreateConvTranspose2DProgram(const std::vector<const Tens
169
169
input_shape_vector[input_shape_vector.size () - 1 ] /= a_components;
170
170
TensorShape reduced_input_shape (input_shape_vector);
171
171
InlinedVector<int64_t > weight_shape_vector = weight_shape.AsShapeVector ();
172
- weight_shape_vector[weight_shape_vector.size () - 1 ] /= components ;
172
+ weight_shape_vector[weight_shape_vector.size () - 1 ] /= b_components ;
173
173
TensorShape reduced_weight_shape (weight_shape_vector);
174
174
InlinedVector<int64_t > output_shape_vector = output_shape.AsShapeVector ();
175
175
output_shape_vector[output_shape_vector.size () - 1 ] /= components;
0 commit comments