def Setup(self, bottom): super(NNResizeLayer, self).Setup(bottom) input = bottom[0] if isinstance(bottom, list) else bottom if isinstance(bottom, list) and len(bottom) > 1: dshape = ops.Shape(bottom[1]) self._param['dsize'] = (dshape[2], dshape[3]) return ops.NNResize(input, **self._param)
def Setup(self, bottom): super(NNResizeLayer, self).Setup(bottom) input = bottom[0] if isinstance(bottom, list) else bottom if self._param['dsize'] is None: if len(bottom) != 2: raise ValueError('The second bottom should be provided to determine the shape.') self._param['shape_like'] = bottom[1] return ops.NNResize(input, **self._param)
def LayerSetup(self, bottom): if self.arguments['dsize'] is None: if not isinstance(bottom, (tuple, list)) or len(bottom) != 2: raise ValueError( 'The second bottom should be provided to determine the shape.' ) self.arguments['shape_like'] = bottom[1] bottom = bottom[0] return _ops.NNResize(bottom, **self.arguments)
def Setup(self, bottom): super(NNResizeLayer, self).Setup(bottom) input = bottom[0] if isinstance(bottom, list) else bottom return ops.NNResize(input, **self._param)