internal AttributeProto FindAttribute(string name, AttributeProto.Types.AttributeType type = AttributeProto.Types.AttributeType.Undefined) { AttributeProto attr = null; if (TryFindAttribute(name, type, out attr)) { return(attr); } throw new OnnxLayerImportException($"Couldn't find attribute {name} of type {type}"); }
internal bool TryFindAttribute(string name, AttributeProto.Types.AttributeType type, out AttributeProto attr) { const AttributeProto.Types.AttributeType undefined = AttributeProto.Types.AttributeType.Undefined; var attributes = m_ONNXNode.Attribute; for (var i = 0; i < attributes.Count; ++i) { attr = attributes[i]; if (attr.Name == name && (attr.Type == type || attr.Type == undefined || type == undefined)) { return(true); } } attr = null; return(false); }