Skip to content

Commit

Permalink
Issue 4120 (#4297)
Browse files Browse the repository at this point in the history
* fix issue 4120, add reasonable exception when user try to use OnnxSequenceType attribute without specify sequence type

* rename function for better readibility

* take comments and modify accordingly

* take eric's comments, comment out default constructor instead of throw exception

* refine comments

* remove unnecessary code change

* Make default constructor of OnnxSequenceType attribute obsolete

* hide default constructor of OnnxSequenceType attribute from intellisense and make obsolete not cause compiler error just to be safe
  • Loading branch information
frank-dong-ms-zz authored Oct 4, 2019
1 parent ffc9e9b commit 60fea03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Microsoft.ML.OnnxTransformer/OnnxSequenceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.ML.Data;

namespace Microsoft.ML.Transforms.Onnx
Expand Down Expand Up @@ -58,8 +59,9 @@ public sealed class OnnxSequenceTypeAttribute : DataViewTypeAttribute

// Make default constructor obsolete.
// Use default constructor will left the _elemType field empty and cause exception in methods using _elemType.
// User will receive compile error when try to use [OnnxSequenceType] attribute directly without specify sequence type
[Obsolete("Please specify sequence type when use OnnxSequenceType Attribute", true)]
// User will receive compile warning when try to use [OnnxSequenceType] attribute directly without specify sequence type
[Obsolete("Please specify sequence type when use OnnxSequenceType Attribute", false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public OnnxSequenceTypeAttribute()
{
}
Expand Down

0 comments on commit 60fea03

Please sign in to comment.