| 1036 | str(self.output_padding)) |
| 1037 | |
| 1038 | def build(self, input_shape): |
| 1039 | input_shape = tensor_shape.TensorShape(input_shape) |
| 1040 | if len(input_shape) != 5: |
| 1041 | raise ValueError('Inputs should have rank 5, received input shape:', |
| 1042 | str(input_shape)) |
| 1043 | if self.data_format == 'channels_first': |
| 1044 | channel_axis = 1 |
| 1045 | else: |
| 1046 | channel_axis = -1 |
| 1047 | if input_shape.dims[channel_axis].value is None: |
| 1048 | raise ValueError('The channel dimension of the inputs ' |
| 1049 | 'should be defined, found None: ' + str(input_shape)) |
| 1050 | input_dim = int(input_shape[channel_axis]) |
| 1051 | kernel_shape = self.kernel_size + (self.filters, input_dim) |
| 1052 | self.input_spec = InputSpec(ndim=5, axes={channel_axis: input_dim}) |
| 1053 | |
| 1054 | self.kernel = self.add_weight( |
| 1055 | 'kernel', |
| 1056 | shape=kernel_shape, |
| 1057 | initializer=self.kernel_initializer, |
| 1058 | regularizer=self.kernel_regularizer, |
| 1059 | constraint=self.kernel_constraint, |
| 1060 | trainable=True, |
| 1061 | dtype=self.dtype) |
| 1062 | if self.use_bias: |
| 1063 | self.bias = self.add_weight( |
| 1064 | 'bias', |
| 1065 | shape=(self.filters,), |
| 1066 | initializer=self.bias_initializer, |
| 1067 | regularizer=self.bias_regularizer, |
| 1068 | constraint=self.bias_constraint, |
| 1069 | trainable=True, |
| 1070 | dtype=self.dtype) |
| 1071 | else: |
| 1072 | self.bias = None |
| 1073 | self.built = True |
| 1074 | |
| 1075 | def call(self, inputs): |
| 1076 | inputs_shape = array_ops.shape(inputs) |