Skip to content

Commit

Permalink
evluate bias only if needed to avoid segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
samnordmann committed Jan 21, 2025
1 parent 1fff21a commit b7ba43c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion csrc/host_ir/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,10 @@ void HostIrEvaluator::handle(LinearOp* linear) {

auto in_at = expr_evaluator_.evaluate(in).as<at::Tensor>();
auto weight_at = expr_evaluator_.evaluate(weight).as<at::Tensor>();
auto bias_at = expr_evaluator_.evaluate(bias).as<at::Tensor>();
auto out_at = expr_evaluator_.evaluate(out).as<at::Tensor>();

if (linear->has_bias()) {
auto bias_at = expr_evaluator_.evaluate(bias).as<at::Tensor>();
at::linear_out(out_at, in_at, weight_at.squeeze(), bias_at.squeeze());
} else {
at::linear_out(out_at, in_at, weight_at.squeeze());
Expand Down

0 comments on commit b7ba43c

Please sign in to comment.