Skip to content

Commit

Permalink
Possibly add layer_guid for element_binary
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyac1999 committed Oct 13, 2023
1 parent 71922e4 commit 3691d6f
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/ops/element_binary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ Op *ElementBinary::create_operator_from_layer(
long long value;
layer->get_int_property("inplace_a", value);
bool inplace_a = (bool)value;
return new ElementBinary(
model, layer->op_type, inputs[0], inputs[1], inplace_a, layer->name);
return new ElementBinary(model,
layer->layer_guid,
layer->op_type,
inputs[0],
inputs[1],
inplace_a,
layer->name);
}

Tensor FFModel::add(const Tensor in1,
Expand Down Expand Up @@ -183,6 +188,7 @@ bool operator==(ElementBinaryParams const &lhs,
}

ElementBinary::ElementBinary(FFModel &model,
LayerID const &_layer_guid,
OperatorType _op_type,
const ParallelTensor in1,
const ParallelTensor in2,
Expand All @@ -198,6 +204,7 @@ ElementBinary::ElementBinary(FFModel &model,
in1,
in2),
inplace_a(_inplace_a) {
layer_guid = _layer_guid;
numOutputs = 1;
numWeights = 0;
assert(in1->data_type == in2->data_type);
Expand Down Expand Up @@ -232,8 +239,13 @@ ElementBinary::ElementBinary(
std::pair<ParallelTensor, ParallelTensor> const &inputs,
char const *name,
bool inplace_a)
: ElementBinary(
model, params.type, inputs.first, inputs.second, inplace_a, name) {}
: ElementBinary(model,
params.layer_guid,
params.type,
inputs.first,
inputs.second,
inplace_a,
name) {}

void ElementBinary::map_output_tensors(FFModel &ff) {
if (has_inplace_output()) {
Expand Down Expand Up @@ -810,6 +822,7 @@ bool ElementBinary::measure_operator_cost(Simulator *sim,
ElementBinaryParams ElementBinary::get_params() const {
ElementBinaryParams params;
params.type = this->op_type;
params.layer_guid = this->layer_guid;
return params;
}

Expand Down

0 comments on commit 3691d6f

Please sign in to comment.