@@ -210,8 +210,8 @@ def __init__(self, reason):
210
210
'THDenseIndexTensor*' : 'Tensor &' ,
211
211
'THStorage*' : 'Storage &' ,
212
212
'THGenerator*' : 'Generator *' ,
213
- 'THSize* ' : 'IntList' ,
214
- 'THStride* ' : 'IntList' ,
213
+ 'IntListSize ' : 'IntList' ,
214
+ 'IntListStride ' : 'IntList' ,
215
215
'accreal' : 'Scalar' ,
216
216
'real' : 'Scalar' ,
217
217
'long' : 'int64_t' ,
@@ -227,8 +227,8 @@ def __init__(self, reason):
227
227
'THDenseIndexTensor*' : 'IndexTensor' ,
228
228
'THStorage*' : 'Storage' ,
229
229
'THGenerator*' : 'Generator*' ,
230
- 'THSize* ' : 'IntList' ,
231
- 'THStride* ' : 'IntList' ,
230
+ 'IntListSize ' : 'IntList' ,
231
+ 'IntListStride ' : 'IntList' ,
232
232
'accreal' : 'accreal' ,
233
233
'real' : 'real' ,
234
234
'long' : 'int64_t' ,
@@ -297,9 +297,8 @@ def __init__(self, reason):
297
297
CodeTemplate (
298
298
'check_generator<${Backend}Generator>(${arg_name}, &globalContext().defaultGenerator(backend()))' ),
299
299
# This is a cast done via direct-construction
300
- 'THSize*' : CodeTemplate ('THLongStorageView ${result_name}(${arg_name}, THLongStorageViewKind::SIZE);' ),
301
- # This is a cast done via direct-construction
302
- 'THStride*' : CodeTemplate ('THLongStorageView ${result_name}(${arg_name}, THLongStorageViewKind::STRIDE);' ),
300
+ 'IntListSize' : CodeTemplate ('at::IntList ${result_name} = get_intlist_size_th(${arg_name});' ),
301
+ 'IntListStride' : CodeTemplate ('at::IntList ${result_name} = get_intlist_stride_th(${arg_name});' ),
303
302
'real' : CodeTemplate ('${arg_name}.to${ScalarName}()' ),
304
303
'accreal' : CodeTemplate ('${arg_name}.to${AccScalarName}()' ),
305
304
'TensorList' : CodeTemplate (
@@ -309,7 +308,7 @@ def __init__(self, reason):
309
308
'IntList' : CodeTemplate ('check_intlist<${size}>(${arg_name}, "${arg_name}", ${arg_pos}${,default_init})' )
310
309
}
311
310
312
- DIRECT_CONSTRUCTION_CHECKED_CAST = {'THSize* ' , 'THStride* ' }
311
+ DIRECT_CONSTRUCTION_CHECKED_CAST = {'IntListSize ' , 'IntListStride ' }
313
312
314
313
CHECKED_USE = {
315
314
'THTensor*' : '{}_->tensor' ,
@@ -349,8 +348,6 @@ def __init__(self, reason):
349
348
# Replacements for constants when calling into TH
350
349
CONSTANT_REPLACEMENTS = [
351
350
('AS_REAL' , '${AS_REAL}' ),
352
- ('__storage_size.get\\ (\\ )' ,
353
- 'THLongStorageView(static_cast<int64_t>(source.pImpl()->size()), THLongStorageViewKind::LENGTH)' ),
354
351
('__last_dim' , 'self.ndimension()-1' ),
355
352
]
356
353
@@ -1327,7 +1324,7 @@ def emit_body(env, option):
1327
1324
output_count = 0
1328
1325
1329
1326
# scalar_check is the heuristic conditions when a result may be a scalar_check
1330
- # if there is a THSize* argument, then its dimensions are used to determine scalar.
1327
+ # if there is a IntListSize argument, then its dimensions are used to determine scalar.
1331
1328
# otherwise, it is true if all the input tensors are scalars,
1332
1329
scalar_check_is_from_size = False
1333
1330
scalar_check_is_from_option = False
@@ -1343,7 +1340,7 @@ def emit_body(env, option):
1343
1340
for arg in option ['arguments' ]:
1344
1341
if is_real_argument_to_wrapper (arg ):
1345
1342
count += 1
1346
- if arg ['type' ] == 'THSize* ' and not scalar_check_is_from_option :
1343
+ if arg ['type' ] == 'IntListSize ' and not scalar_check_is_from_option :
1347
1344
scalar_check_is_from_size = True
1348
1345
scalar_check = '{}.size() == 0' .format (arg ['name' ])
1349
1346
if arg ['type' ] == 'TensorList' :
0 commit comments