Skip to content

Commit

Permalink
#0: Check Bias shape before padding
Browse files Browse the repository at this point in the history
  • Loading branch information
sankarmanoj-tt committed Dec 25, 2024
1 parent 4773542 commit 159a0e0
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ std::pair<ttnn::Tensor, std::optional<ttnn::Tensor>> prepare_conv_weights_biases
bias_tensor_ = bias_tensor.value();
bool is_bias_tensor_is_on_device = ttnn::is_tensor_on_device_or_multidevice(bias_tensor_);
if(!is_bias_tensor_is_on_device) {
TT_FATAL(bias_tensor_.shape()[3]==out_channels, "Bias must have the same length as output channels");
bias_tensor_ = conv_bias_layout_convert(bias_tensor_, weights_bias_dtype, weight_block_h_ntiles, weight_block_w_ntiles, output_parallel_config, device, out_channels_padded, is_non_tile_mul_width);
bias_tensor_ = ttnn::operations::core::to_device(bias_tensor_, device, std::nullopt);
}
Expand Down Expand Up @@ -471,6 +472,8 @@ ttnn::Tensor prepare_conv_bias(

bool is_non_tile_mul_width = check_non_tile_mul_width(device, conv_config, in_channels);
ttnn::Tensor bias_tensor_ = bias_tensor;
TT_FATAL(bias_tensor_.shape()[3]==out_channels, "Bias must have the same length as output channels");

bias_tensor_ = conv_bias_layout_convert(
bias_tensor_,
conv_config.weights_dtype,
Expand Down

0 comments on commit 159a0e0

Please sign in to comment.