|
|
|
@ -29,6 +29,35 @@ void Div::SetActivationType(int activation_type) {
|
|
|
|
|
this->primitive_->value.AsDiv()->activationType = (schema::ActivationType)activation_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Div::UnPackAttr(const Primitive &prim, const std::vector<AnfNodePtr> &inputs) {
|
|
|
|
|
if (this->primitive_ == nullptr) {
|
|
|
|
|
this->primitive_ = new (std::nothrow) schema::PrimitiveT;
|
|
|
|
|
if (this->primitive_ == nullptr) {
|
|
|
|
|
MS_LOG(ERROR) << "new primitiveT failed";
|
|
|
|
|
return RET_ERROR;
|
|
|
|
|
}
|
|
|
|
|
this->primitive_->value.type = schema::PrimitiveType_Div;
|
|
|
|
|
}
|
|
|
|
|
if (this->primitive_->value.type != schema::PrimitiveType_Div) {
|
|
|
|
|
MS_LOG(ERROR) << "Primitive type is error :" << this->primitive_->value.type;
|
|
|
|
|
return RET_ERROR;
|
|
|
|
|
}
|
|
|
|
|
if (this->primitive_->value.value == nullptr) {
|
|
|
|
|
auto attr = new (std::nothrow) schema::DivT();
|
|
|
|
|
if (attr == nullptr) {
|
|
|
|
|
MS_LOG(ERROR) << "new primitiveT value failed";
|
|
|
|
|
return RET_ERROR;
|
|
|
|
|
}
|
|
|
|
|
this->primitive_->value.value = attr;
|
|
|
|
|
if (this->primitive_->value.value == nullptr) {
|
|
|
|
|
MS_LOG(ERROR) << "primitive value is nullptr";
|
|
|
|
|
return RET_ERROR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return RET_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
int Div::UnPackToFlatBuilder(const schema::Primitive *primitive, flatbuffers::FlatBufferBuilder *fbb) {
|
|
|
|
|
MS_ASSERT(nullptr != primitive);
|
|
|
|
|