Ejemplo n.º 1
0
 def symbolic_fn(g, input, output_size, align_corners=None):
     sym_help._interpolate_warning(interpolate_mode)
     align_corners = sym_help._maybe_get_scalar(align_corners)
     if align_corners:
         return _unimplemented(name, "align_corners == True")
     scales = sym_help._interpolate_size_to_scales(g, input, output_size,
                                                   dim)
     return g.op("Resize", input, scales, mode_s=interpolate_mode)
Ejemplo n.º 2
0
 def symbolic_fn(g, input, output_size, *args):
     scales, align_corners = symbolic_helper._get_interpolate_attributes(
         g, interpolate_mode, args)
     symbolic_helper._interpolate_warning(interpolate_mode)
     align_corners = symbolic_helper._maybe_get_scalar(align_corners)
     if align_corners:
         return symbolic_helper._unimplemented(name,
                                               "align_corners == True")
     if scales is None:
         scales = symbolic_helper._interpolate_size_to_scales(
             g, input, output_size, dim)
     return g.op("Resize", input, scales, mode_s=interpolate_mode)
Ejemplo n.º 3
0
 def symbolic_fn(g, input, output_size, align_corners=None):
     sym_help._interpolate_warning(interpolate_mode)
     align_corners = sym_help._maybe_get_scalar(align_corners)
     if align_corners:
         return _unimplemented(name, "align_corners == True")
     output_size = sym_help._maybe_get_const(output_size, 'is')
     if sym_help._is_value(output_size):
         return _unimplemented(name, "torch._C.Value (output_size) indexing")
     else:
         scales = [1. if i < 2 else
                   float(output_size[-(dim - i)]) / float(input.type().sizes()[-(dim - i)])
                   for i in range(0, dim)]
     return g.op("Upsample", input, mode_s=interpolate_mode, scales_f=scales)
Ejemplo n.º 4
0
 def symbolic_fn(g, input, output_size, *args):
     scales, align_corners = symbolic_helper._get_interpolate_attributes(
         g, interpolate_mode, args
     )
     symbolic_helper._interpolate_warning(interpolate_mode)
     align_corners = symbolic_helper._maybe_get_scalar(align_corners)
     if align_corners:
         return symbolic_helper._unimplemented(name, "align_corners == True", input)
     output_size = symbolic_helper._maybe_get_const(output_size, "is")
     if symbolic_helper._is_value(output_size):
         return symbolic_helper._unimplemented(
             name, "torch._C.Value (output_size) indexing"
         )
     if scales is None:
         scales = [
             1.0
             if i < 2
             else float(output_size[-(dim - i)])
             / float(input.type().sizes()[-(dim - i)])
             for i in range(0, dim)
         ]
     return g.op("Upsample", input, mode_s=interpolate_mode, scales_f=scales)