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.

L1.cs 335 B

12345678910111213141516171819
  1. using System;
  2. namespace Tensorflow.Keras
  3. {
  4. public class L1 : IRegularizer
  5. {
  6. float l1;
  7. public L1(float l1 = 0.01f)
  8. {
  9. this.l1 = l1;
  10. }
  11. public Tensor Apply(RegularizerArgs args)
  12. {
  13. return l1 * math_ops.reduce_sum(math_ops.abs(args.X));
  14. }
  15. }
  16. }