Skip to content

Move null checking to compiler-side using nullable annotations#1530

Open
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
alinpahontu2912:improve_nullchecking
Open

Move null checking to compiler-side using nullable annotations#1530
alinpahontu2912 wants to merge 1 commit intodotnet:mainfrom
alinpahontu2912:improve_nullchecking

Conversation

@alinpahontu2912
Copy link
Member

  • Remove redundant runtime null checks from non-nullable Parameter weight setters in Linear, Bilinear, Convolution, PReLU, GroupNorm, LayerNorm, and NormBase (already enforced by #nullable enable)
  • Add [DisallowNull] to Parameter? properties in RNNCell, LSTMCell, GRUCell, Embedding, and EmbeddingBag where getter can return null but setter must not accept null
  • Enable #nullable enable in Transforms.cs and remove runtime null check from ComposeTransform constructor
  • Remove runtime null check from Module.get_buffer() (string parameter is non-nullable under #nullable enable)
  • Add DisallowNullAttribute polyfill in netstandard.cs for netstandard2.0 compatibility

- Remove redundant runtime null checks from non-nullable Parameter weight
  setters in Linear, Bilinear, Convolution, PReLU, GroupNorm, LayerNorm,
  and NormBase (already enforced by #nullable enable)
- Add [DisallowNull] to Parameter? properties in RNNCell, LSTMCell,
  GRUCell, Embedding, and EmbeddingBag where getter can return null but
  setter must not accept null
- Enable #nullable enable in Transforms.cs and remove runtime null check
  from ComposeTransform constructor
- Remove runtime null check from Module.get_buffer() (string parameter
  is non-nullable under #nullable enable)
- Add DisallowNullAttribute polyfill in netstandard.cs for
  netstandard2.0 compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant