@@ -489,6 +489,7 @@ class DepthwiseConv1D(Conv1D):
489489 Attribute ('out_width' ),
490490 Attribute ('n_chan' ),
491491 Attribute ('depth_multiplier' , default = 1 ),
492+ Attribute ('n_filt' ), # = n_chan * depth_multiplier
492493 Attribute ('filt_width' ),
493494 Attribute ('stride_width' ),
494495 Attribute ('pad_left' ),
@@ -501,10 +502,10 @@ class DepthwiseConv1D(Conv1D):
501502
502503 def initialize (self ):
503504 if self .get_attr ('data_format' ) == 'channels_last' :
504- shape = [self .attributes ['out_width' ], self .attributes ['n_chan' ] * self . attributes [ 'depth_multiplier ' ]]
505+ shape = [self .attributes ['out_width' ], self .attributes ['n_filt ' ]]
505506 dims = [f'OUT_HEIGHT_{ self .index } ' , f'N_CHAN_{ self .index } ' ]
506507 else :
507- shape = [self .attributes ['n_chan' ] * self . attributes [ 'depth_multiplier ' ], self .attributes ['out_width' ]]
508+ shape = [self .attributes ['n_filt ' ], self .attributes ['out_width' ]]
508509 dims = [f'N_CHAN_{ self .index } ' , f'OUT_WIDTH_{ self .index } ' ]
509510 self .add_output_variable (shape , dims )
510511
@@ -513,7 +514,6 @@ def initialize(self):
513514 )
514515
515516 self .add_bias (quantizer = self .get_attr ('bias_quantizer' ))
516- self .set_attr ('n_filt' , self .get_attr ('n_chan' ) * self .get_attr ('depth_multiplier' ))
517517
518518
519519class Conv2D (Layer ):
@@ -658,6 +658,7 @@ class DepthwiseConv2D(Conv2D):
658658 Attribute ('out_width' ),
659659 Attribute ('n_chan' ),
660660 Attribute ('depth_multiplier' , default = 1 ),
661+ Attribute ('n_filt' ), # = n_chan * depth_multiplier
661662 Attribute ('filt_height' ),
662663 Attribute ('filt_width' ),
663664 Attribute ('stride_height' ),
@@ -677,12 +678,12 @@ def initialize(self):
677678 shape = [
678679 self .attributes ['out_height' ],
679680 self .attributes ['out_width' ],
680- self .attributes ['n_chan' ] * self . attributes [ 'depth_multiplier ' ],
681+ self .attributes ['n_filt ' ],
681682 ]
682683 dims = [f'OUT_HEIGHT_{ self .index } ' , f'OUT_WIDTH_{ self .index } ' , f'N_CHAN_{ self .index } ' ]
683684 else :
684685 shape = [
685- self .attributes ['n_chan' ] * self . attributes [ 'depth_multiplier ' ],
686+ self .attributes ['n_filt ' ],
686687 self .attributes ['out_height' ],
687688 self .attributes ['out_width' ],
688689 ]
@@ -694,7 +695,6 @@ def initialize(self):
694695 )
695696
696697 self .add_bias (quantizer = self .get_attr ('bias_quantizer' ))
697- self .set_attr ('n_filt' , self .get_attr ('n_chan' ) * self .get_attr ('depth_multiplier' ))
698698
699699
700700class Pooling1D (Layer ):
0 commit comments