SciSharp / TensorFlow.NET

.NET Standard bindings for Google's TensorFlow for developing, training and deploying Machine Learning models in C# and F#.
https://scisharp.github.io/tensorflow-net-docs
Apache License 2.0
3.17k stars 506 forks source link

[Feature Request]: Add mask management to BatchNormalization layer #1198

Open Utanapishtim31 opened 8 months ago

Utanapishtim31 commented 8 months ago

Background and Feature Description

BatchNormalization output is sensitive to masking. Masking should be handled in the same way as RNN layers.

The mask tensor should be detected as an input of the BatchNormalization layer by the dependency detection mechanism to avoid the current exceptions raised when a Mask is declared for RNN layers. The same fix should be done for the RNN layers.

API Definition and Usage

public class BatchNormalizationOptionalArgs : IOptionalArgs
{
    public string Identifier => "BatchNormalization";
    public Tensor Mask { get; set; }
}

Alternatives

No response

Risks

Minimal