@@ -47,16 +47,16 @@ class Broadcast(CWrapPlugin):
4747 def getPreArgStringTemplate (self , type = None ):
4848 if type == None :
4949 ret = """THTensor *${arg_op_other}_save = ${arg_op_other};
50- THTensorPtr ${arg_op_other}_guard = THTensor_(new)(LIBRARY_STATE_NOARGS);\n """
50+ THTensorPtr ${arg_op_other}_guard( THTensor_(new)(LIBRARY_STATE_NOARGS) );\n """
5151 else :
5252 tensor_type = "TH" + type + "Tensor"
5353 cuda_tensor_type = "THCuda" + type + "Tensor"
5454 ret = ("#if !IS_CUDA\n " +
5555 tensor_type + " *${arg_op_other}_save = ${arg_op_other};\n " +
56- tensor_type + "Ptr ${arg_op_other}_guard = " + tensor_type + "_new(LIBRARY_STATE_NOARGS);\n " +
56+ tensor_type + "Ptr ${arg_op_other}_guard( " + tensor_type + "_new(LIBRARY_STATE_NOARGS) );\n " +
5757 "#else\n " +
5858 cuda_tensor_type + " *${arg_op_other}_save = ${arg_op_other};\n " +
59- "THPPointer<" + cuda_tensor_type + "> ${arg_op_other}_guard = " + cuda_tensor_type + "_new(LIBRARY_STATE_NOARGS);\n " +
59+ "THPPointer<" + cuda_tensor_type + "> ${arg_op_other}_guard ( " + cuda_tensor_type + "_new(LIBRARY_STATE_NOARGS) );\n " +
6060 "#endif\n " )
6161 return Template (ret )
6262
@@ -85,13 +85,13 @@ def getPreArgStringTemplate(self, type=None):
8585 long ${arg_op_a}_dim${idx}_size = THTensor_(size)(LIBRARY_STATE ${arg_op_dim}, ${arg_op_dim_value});\n """ )
8686
8787 OUT_PLACE_PRE_EXPAND1_DIM_TEMPLATE = Template (
88- """THLongStoragePtr ${arg_op_a}_storage = THLongStorage_newWithSize1(${arg_op_a}_dim0_size);\n """ )
88+ """THLongStoragePtr ${arg_op_a}_storage( THLongStorage_newWithSize1(${arg_op_a}_dim0_size) );\n """ )
8989
9090 OUT_PLACE_PRE_EXPAND2_DIM_TEMPLATE = Template (
91- """THLongStoragePtr ${arg_op_a}_storage = THLongStorage_newWithSize2(${arg_op_a}_dim0_size, ${arg_op_a}_dim1_size);\n """ )
91+ """THLongStoragePtr ${arg_op_a}_storage( THLongStorage_newWithSize2(${arg_op_a}_dim0_size, ${arg_op_a}_dim1_size) );\n """ )
9292
9393 OUT_PLACE_PRE_EXPAND3_DIM_TEMPLATE = Template (
94- """THLongStoragePtr ${arg_op_a}_storage = THLongStorage_newWithSize3(${arg_op_a}_dim0_size, ${arg_op_a}_dim1_size, ${arg_op_a}_dim2_size);\n """ )
94+ """THLongStoragePtr ${arg_op_a}_storage( THLongStorage_newWithSize3(${arg_op_a}_dim0_size, ${arg_op_a}_dim1_size, ${arg_op_a}_dim2_size) );\n """ )
9595
9696 OUT_PLACE_PRE_EXPAND_POST_DIM_TEMPLATE = Template (
9797 """if (!THTensor_(expand)(LIBRARY_STATE ${arg_op_a}_guard.get(), ${arg_op_a}, ${arg_op_a}_storage, ${raise_errors})) {
0 commit comments