You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

L2.cs 323 B

1234567891011121314151617
  1. namespace Tensorflow.Keras
  2. {
  3. public class L2 : IRegularizer
  4. {
  5. float l2;
  6. public L2(float l2 = 0.01f)
  7. {
  8. this.l2 = l2;
  9. }
  10. public Tensor Apply(RegularizerArgs args)
  11. {
  12. return l2 * math_ops.reduce_sum(math_ops.square(args.X));
  13. }
  14. }
  15. }