@@ -939,6 +939,47 @@ def initialize(self):
939
939
self .add_output_variable (shape , dims , precision = inp .type .precision )
940
940
941
941
942
+ class Cropping1D (Layer ):
943
+ _expected_attributes = [
944
+ Attribute ('in_width' ),
945
+ Attribute ('out_width' ),
946
+ Attribute ('n_chan' ),
947
+ Attribute ('crop_left' ),
948
+ Attribute ('crop_right' ),
949
+ ]
950
+
951
+ def initialize (self ):
952
+ inp = self .get_input_variable ()
953
+ # no data_format attribute for Cropping1D
954
+ shape = [self .attributes ['out_width' ], self .attributes ['n_chan' ]]
955
+ dims = [f'OUT_WIDTH_{ self .index } ' , f'N_CHAN_{ self .index } ' ]
956
+ self .add_output_variable (shape , dims , precision = inp .type .precision )
957
+
958
+
959
+ class Cropping2D (Layer ):
960
+ _expected_attributes = [
961
+ Attribute ('in_height' ),
962
+ Attribute ('in_width' ),
963
+ Attribute ('out_height' ),
964
+ Attribute ('out_width' ),
965
+ Attribute ('n_chan' ),
966
+ Attribute ('crop_top' ),
967
+ Attribute ('crop_bottom' ),
968
+ Attribute ('crop_left' ),
969
+ Attribute ('crop_right' ),
970
+ ]
971
+
972
+ def initialize (self ):
973
+ inp = self .get_input_variable ()
974
+ if self .get_attr ('data_format' ) == 'channels_last' :
975
+ shape = [self .attributes ['out_height' ], self .attributes ['out_width' ], self .attributes ['n_chan' ]]
976
+ dims = [f'OUT_HEIGHT_{ self .index } ' , f'OUT_WIDTH_{ self .index } ' , f'N_CHAN_{ self .index } ' ]
977
+ else :
978
+ shape = [self .attributes ['n_chan' ], self .attributes ['out_height' ], self .attributes ['out_width' ]]
979
+ dims = [f'N_CHAN_{ self .index } ' , f'OUT_HEIGHT_{ self .index } ' , f'OUT_WIDTH_{ self .index } ' ]
980
+ self .add_output_variable (shape , dims , precision = inp .type .precision )
981
+
982
+
942
983
class Activation (Layer ):
943
984
_expected_attributes = [
944
985
Attribute ('n_in' ),
0 commit comments