@@ -359,8 +359,21 @@ static PyObject * THPVariable_randint(PyObject* self_, PyObject* args, PyObject*
359
359
static PyObject * THPVariable_as_tensor (PyObject* self, PyObject* args, PyObject* kwargs)
360
360
{
361
361
HANDLE_TH_ERRORS
362
+ static PythonArgParser parser ({
363
+ " as_tensor(PyObject* data, *, ScalarType dtype=None, Device? device=None)" ,
364
+ });
365
+
366
+ ParsedArgs<3 > parsed_args;
367
+ auto r = parser.parse (args, kwargs, parsed_args);
368
+ if (r.has_torch_function ()) {
369
+ return handle_torch_function (
370
+ r, nullptr , args, kwargs, THPVariableFunctionsModule, " torch" );
371
+ }
362
372
jit::tracer::warn (" torch.as_tensor" , jit::tracer::WARN_CONSTRUCTOR);
363
- return THPVariable_Wrap (torch::utils::as_tensor (torch::tensors::get_default_dispatch_key (), torch::tensors::get_default_scalar_type (), args, kwargs));
373
+ return THPVariable_Wrap (torch::utils::as_tensor (
374
+ torch::tensors::get_default_dispatch_key (),
375
+ torch::tensors::get_default_scalar_type (),
376
+ r));
364
377
END_HANDLE_TH_ERRORS
365
378
}
366
379
@@ -397,32 +410,87 @@ static PyObject * THPVariable_nonzero(PyObject* self, PyObject* args, PyObject*
397
410
static PyObject * THPVariable_sparse_csr_tensor (PyObject* self, PyObject* args, PyObject* kwargs)
398
411
{
399
412
HANDLE_TH_ERRORS
413
+ static PythonArgParser parser ({
414
+ " sparse_csr_tensor(PyObject* crow_indices, PyObject* col_indices, PyObject* values, IntArrayRef size, *, ScalarType dtype=None, Layout? layout=None, Device? device=None, bool pin_memory=False, bool requires_grad=False)" ,
415
+ " sparse_csr_tensor(PyObject* crow_indices, PyObject* col_indices, PyObject* values, *, ScalarType dtype=None, Layout? layout=None, Device? device=None, bool pin_memory=False, bool requires_grad=False)" ,
416
+ });
417
+
418
+ ParsedArgs<9 > parsed_args;
419
+ auto r = parser.parse (args, kwargs, parsed_args);
420
+ if (r.has_torch_function ()) {
421
+ return handle_torch_function (
422
+ r, nullptr , args, kwargs, THPVariableFunctionsModule, " torch" );
423
+ }
400
424
jit::tracer::warn (" torch.sparse_csr_tensor" , jit::tracer::WARN_CONSTRUCTOR);
401
- return THPVariable_Wrap (torch::utils::sparse_csr_tensor_ctor (torch::tensors::get_default_dispatch_key (), torch::tensors::get_default_scalar_type (), args, kwargs));
425
+ return THPVariable_Wrap (torch::utils::sparse_csr_tensor_ctor (
426
+ torch::tensors::get_default_dispatch_key (),
427
+ torch::tensors::get_default_scalar_type (),
428
+ r));
402
429
END_HANDLE_TH_ERRORS
403
430
}
404
431
405
432
static PyObject * THPVariable__sparse_csr_tensor_unsafe (PyObject* self, PyObject* args, PyObject* kwargs)
406
433
{
407
434
HANDLE_TH_ERRORS
435
+ static PythonArgParser parser ({
436
+ " _sparse_csr_tensor_unsafe(PyObject* crow_indices, PyObject* col_indices, PyObject* values, IntArrayRef size, *, ScalarType dtype=None, Device? device=None, bool requires_grad=False)" ,
437
+ });
438
+
439
+ ParsedArgs<7 > parsed_args;
440
+ auto r = parser.parse (args, kwargs, parsed_args);
441
+ if (r.has_torch_function ()) {
442
+ return handle_torch_function (
443
+ r, nullptr , args, kwargs, THPVariableFunctionsModule, " torch" );
444
+ }
408
445
jit::tracer::warn (" torch._sparse_csr_tensor_unsafe" , jit::tracer::WARN_CONSTRUCTOR);
409
- return THPVariable_Wrap (torch::utils::_sparse_csr_tensor_unsafe_ctor (torch::tensors::get_default_dispatch_key (), torch::tensors::get_default_scalar_type (), args, kwargs));
446
+ return THPVariable_Wrap (torch::utils::_sparse_csr_tensor_unsafe_ctor (
447
+ torch::tensors::get_default_dispatch_key (),
448
+ torch::tensors::get_default_scalar_type (),
449
+ r));
410
450
END_HANDLE_TH_ERRORS
411
451
}
412
452
413
453
static PyObject * THPVariable_sparse_coo_tensor (PyObject* self, PyObject* args, PyObject* kwargs)
414
454
{
415
455
HANDLE_TH_ERRORS
456
+ static PythonArgParser parser ({
457
+ " sparse_coo_tensor(PyObject* indices, PyObject* values, *, ScalarType dtype=None, Device? device=None, bool requires_grad=False)" ,
458
+ " sparse_coo_tensor(PyObject* indices, PyObject* values, IntArrayRef size, *, ScalarType dtype=None, Device? device=None, bool requires_grad=False)" ,
459
+ " sparse_coo_tensor(IntArrayRef size, *, ScalarType dtype=None, Device? device=None, bool requires_grad=False)" ,
460
+ });
461
+
462
+ ParsedArgs<6 > parsed_args;
463
+ auto r = parser.parse (args, kwargs, parsed_args);
464
+ if (r.has_torch_function ()) {
465
+ return handle_torch_function (
466
+ r, nullptr , args, kwargs, THPVariableFunctionsModule, " torch" );
467
+ }
416
468
jit::tracer::warn (" torch.sparse_coo_tensor" , jit::tracer::WARN_CONSTRUCTOR);
417
- return THPVariable_Wrap (torch::utils::sparse_coo_tensor_ctor (torch::tensors::get_default_dispatch_key (), torch::tensors::get_default_scalar_type (), args, kwargs));
469
+ return THPVariable_Wrap (torch::utils::sparse_coo_tensor_ctor (
470
+ torch::tensors::get_default_dispatch_key (),
471
+ torch::tensors::get_default_scalar_type (),
472
+ r));
418
473
END_HANDLE_TH_ERRORS
419
474
}
420
475
421
476
static PyObject * THPVariable__sparse_coo_tensor_unsafe (PyObject* self, PyObject* args, PyObject* kwargs)
422
477
{
423
478
HANDLE_TH_ERRORS
479
+ static PythonArgParser parser ({
480
+ " _sparse_coo_tensor_unsafe(PyObject* indices, PyObject* values, IntArrayRef size, *, ScalarType dtype=None, Device? device=None, bool requires_grad=False)" ,
481
+ });
482
+
483
+ ParsedArgs<6 > parsed_args;
484
+ auto r = parser.parse (args, kwargs, parsed_args);
485
+ if (r.has_torch_function ()) {
486
+ return handle_torch_function (
487
+ r, nullptr , args, kwargs, THPVariableFunctionsModule, " torch" );
488
+ }
424
489
jit::tracer::warn (" torch._sparse_coo_tensor_unsafe" , jit::tracer::WARN_CONSTRUCTOR);
425
- return THPVariable_Wrap (torch::utils::_sparse_coo_tensor_unsafe_ctor (torch::tensors::get_default_dispatch_key (), torch::tensors::get_default_scalar_type (), args, kwargs));
490
+ return THPVariable_Wrap (torch::utils::_sparse_coo_tensor_unsafe_ctor (
491
+ torch::tensors::get_default_dispatch_key (),
492
+ torch::tensors::get_default_scalar_type (),
493
+ r));
426
494
END_HANDLE_TH_ERRORS
427
495
}
428
496
@@ -431,8 +499,22 @@ static PyObject * THPVariable__sparse_coo_tensor_unsafe(PyObject* self, PyObject
431
499
static PyObject * THPVariable_tensor (PyObject* self, PyObject* args, PyObject* kwargs)
432
500
{
433
501
HANDLE_TH_ERRORS
502
+ static PythonArgParser parser ({
503
+ " tensor(PyObject* data, *, ScalarType dtype=None, Device? device=None, bool pin_memory=False, bool requires_grad=False, DimnameList? names=None)" ,
504
+ });
505
+
506
+ constexpr int ctor_num_args = 6 ;
507
+ ParsedArgs<ctor_num_args> parsed_args;
508
+ auto r = parser.parse (args, kwargs, parsed_args);
509
+ if (r.has_torch_function ()) {
510
+ return handle_torch_function (
511
+ r, nullptr , args, kwargs, THPVariableFunctionsModule, " torch" );
512
+ }
434
513
jit::tracer::warn (" torch.tensor" , jit::tracer::WARN_CONSTRUCTOR);
435
- return THPVariable_Wrap (torch::utils::tensor_ctor (torch::tensors::get_default_dispatch_key (), torch::tensors::get_default_scalar_type (), args, kwargs));
514
+ return THPVariable_Wrap (torch::utils::tensor_ctor (
515
+ torch::tensors::get_default_dispatch_key (),
516
+ torch::tensors::get_default_scalar_type (),
517
+ r));
436
518
END_HANDLE_TH_ERRORS
437
519
}
438
520
0 commit comments