Question: <ins> [[ name: THPTensor_(elementSize) python_name: element_size cpu_half: True auto_gpu: False only_register: True ]] [[ name: THPTensor_(storage) python_name: storage cpu_half: True auto_gpu: False only_register: True ]] [[ name: storageOffset python_name: storage_offset cpu_half: True auto_gpu: False return: long arguments: - THTensor* self ]] [[ name: nDimension python_name: ndimension cpu_half: True auto_gpu: False return: long arguments: - THTensor* self ]] [[ name: THPTensor_(nDimension) python_name: dim cpu_half: True auto_gpu: False only_register: True method_flags: METH_KEYWORDS ]] [[ python_name: index name: THPTensor_(getValue)<true> only_register: True override_method_flags: METH_O ]] [[ python_name: _set_index name: THPTensor_(setIndex) only_register: True ]] [[ python_name: _check_advanced_indexing name: THPTensor_(checkAdvancedIndexing) cpu_half: False only_register: True override_method_flags: METH_O ]] [[ python_name: _advanced_index_add name: THPTensor_(advancedIndexAdd) cpu_half: False only_register: True ]] [[ python_name: _advanced_index_select name: THPTensor_(advancedIndexSelect) cpu_half: False only_register: True ]] [[ name: resize_ return: self cname: resize cpu_half: True before_call: THPUtils_assert(arg_self->storage->flag & TH_STORAGE_RESIZABLE, "calling resize_ on a tensor that has non-resizable storage. Clone it first " "or create a new tensor instead."); arguments: - THTensor* self - arg: THSize* size long_args: True - CONSTANT NULL ]] [[ name: zeros variants: - function auto_gpu: False return: argument 0 arguments: - arg: THTensor* result output: True - arg: THSize* size long_args: True ]] [[ name: zeros_like cname: zerosLike variants: - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* input ]] [[ name: ones variants: - function auto_gpu: False return: argument 0 arguments: - arg: THTensor* result output: True - arg: THSize* size long_args: True ]] [[ name: ones_like cname: onesLike variants: - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* input ]] [[ name: numel return: long cname: nElement cpu_half: True auto_gpu: False variants: - method - function arguments: - THTensor* self ]] [[ name: THPTensor_(numel) python_name: nelement cpu_half: True auto_gpu: False only_register: True method_flags: METH_KEYWORDS ]] [[ name: set_ cname: set cpu_half: True auto_gpu: False return: argument 0 options: - cname: set arguments: - THTensor* self - THTensor* source - cname: setStorage arguments: - THTensor* self - CONSTANT NULL, 0, NULL, NULL - cname: setStorage before_call: THLongStoragePtr __storage_size(THLongStorage_newWithSize1(THStorage_(size)(LIBRARY_STATE arg_storage))); arguments: - THTensor* self - THStorage* storage - CONSTANT 0 - CONSTANT __storage_size.get() - CONSTANT NULL - cname: setStorage arguments: - THTensor* self - THStorage* sourceStorage - long storage_offset - THSize* size - arg: THStride* stride default: NULL ]] [[ name: THPTensor_(select) python_name: select cpu_half: True auto_gpu: False only_register: True ]] [[ name: THPTensor_(size) python_name: size cpu_half: True auto_gpu: False method_flags: METH_KEYWORDS only_register: True ]] [[ name: THPTensor_(stride) python_name: stride cpu_half: True auto_gpu: False method_flags: METH_KEYWORDS only_register: True ]] [[ name: fill_ cname: fill return: self arguments: - THTensor* self - real value ]] [[ name: isSameSizeAs python_name: is_same_size cpu_half: True auto_gpu: False return: bool arguments: - THTensor* self - THTensor* other ]] [[ name: isContiguous python_name: is_contiguous cpu_half: True auto_gpu: False return: bool arguments: - THTensor* self ]] [[ name: isSetTo python_name: is_set_to cpu_half: True auto_gpu: False return: bool arguments: - THTensor* self - THTensor* tensor ]] [[ name: maskedFill_ cname: maskedFill python_name: masked_fill_ return: self arguments: - arg: THTensor* self broadcast: mask inplace fallback types:Byte - THBoolTensor* mask - real value ]] [[ name: maskedCopy_ cname: maskedCopy python_name: masked_scatter_ return: self arguments: - arg: THTensor* self broadcast: mask inplace fallback types:Byte - THBoolTensor* mask - THTensor* source ]] [[ name: maskedSelect python_name: masked_select variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: mask fallback types:Byte - THBoolTensor* mask ]] [[ name: transpose variants: - method - function cname: newTranspose cpu_half: True auto_gpu: False return: THTensor* arguments: - THTensor* self - arg: long dim0 wrap_dim: self - arg: long dim1 wrap_dim: self ]] [[ name: transpose_ cname: transpose cpu_half: True auto_gpu: False return: self arguments: - THTensor* self - THTensor* self - arg: long dim0 wrap_dim: self - arg: long dim1 wrap_dim: self ]] [[ name: t variants: - method - function auto_gpu: False cname: newTranspose return: THTensor* before_call: | long ndim = arg_self->nDimension; THPUtils_assert(ndim == 2, "t() expects a 2D tensor, but self is %ldD", ndim); arguments: - THTensor* self - CONSTANT 0 - CONSTANT 1 ]] [[ name: t_ cname: transpose auto_gpu: False return: self before_call: | long ndim = arg_self->nDimension; THPUtils_assert(ndim == 2, "t_() expects a 2D tensor, but self is %ldD", ndim); arguments: - THTensor* self - THTensor* self - CONSTANT 0 - CONSTANT 1 ]] [[ name: squeeze cpu_half: True variants: - method - function return: argument 0 options: - arguments: - arg: THTensor* result output: True - THTensor* self - cname: squeeze1d arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self ]] [[ name: squeeze_ cpu_half: True return: self options: - cname: squeeze arguments: - THTensor* self - THTensor* self - cname: squeeze1d arguments: - THTensor* self - THTensor* self - arg: long dim wrap_dim: self ]] [[ name: unsqueeze variants: - method - function cpu_half: True auto_gpu: False return: argument 0 cname: unsqueeze1d arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self+1 ]] [[ name: unsqueeze_ cpu_half: True auto_gpu: False return: self cname: unsqueeze1d arguments: - THTensor* self - THTensor* self - arg: long dim wrap_dim: self+1 ]] [[ name: nonzero variants: - method - function return: argument 0 arguments: - arg: THIndexTensor* result output: True - THTensor* self ]] [[ name: contiguous cname: newContiguous return: THTensor* arguments: - THTensor* self ]] [[ name: clone cname: newClone return: THTensor* aten_sparse: True arguments: - THTensor* self ]] [[ name: view cname: newView auto_gpu: False return: THTensor* arguments: - THTensor* self - arg: THSize* size long_args: True ]] [[ name: expand cname: newExpand return: THTensor* arguments: - THTensor* self - arg: THSize* size long_args: True ]] [[ name: resizeAs_ python_name: resize_as_ cname: resizeAs return: self arguments: - THTensor* self - THTensor* the_template ]] [[ name: indexSelect python_name: index_select variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index ]] [[ name: indexCopy_ python_name: index_copy_ cname: indexCopy return: argument 0 arguments: - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index - THTensor* source ]] [[ name: indexAdd_ python_name: index_add_ cname: indexAdd return: argument 0 arguments: - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index - THTensor* source ]] [[ name: indexFill_ python_name: index_fill_ cname: indexFill return: argument 0 arguments: - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index - real value ]] [[ name: narrow cpu_half: True auto_gpu: False return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dimension wrap_dim: self - long start - long length ]] [[ name: unfold cpu_half: True auto_gpu: False return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dimension wrap_dim: self - long size - long step ]] [[ name: range variants: - function backends: - CPU - CUDA return: argument 0 before_arg_assign: | PyErr_WarnEx(PyExc_UserWarning, "torch.range is deprecated in favor of torch.arange " "and will be removed in 0.3. Note that arange generates values in [start; end), " "not [start; end].", 1); arguments: - arg: THTensor* result output: True - accreal start - accreal end - arg: accreal step default: 1 ]] [[ name: arange variants: - function backends: - CPU - CUDA return: argument 0 options: - arguments: - arg: THTensor* result output: True - accreal start - accreal end - accreal step - arguments: - arg: THTensor* result output: True - accreal start - accreal end - CONSTANT 1 ]] [[ name: scatter_ return: argument 0 options: - cname: scatter arguments: - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index - THTensor* src - cname: scatterFill arguments: - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index - real value ]] [[ name: scatter_add_ return: argument 0 options: - cname: scatterAdd arguments: - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index - THTensor* src ]] [[ name: gather variants: - method - function return: argument 0 before_call: | THLongStoragePtr _size(THIndexTensor_(newSizeOf)(LIBRARY_STATE arg_index)); THTensor_(resize)(LIBRARY_STATE arg_result, _size, NULL); arguments: - arg: THTensor* result output: True resize: index - THTensor* self - arg: long dim wrap_dim: self - THIndexTensor* index ]] [[ name: THPTensor_stateless_(cat) python_name: cat method_flags: METH_KEYWORDS only_register: True variants: - function ]] [[ name: data_ptr defined_if: "!IS_DISTRIBUTED" with_gil: True auto_gpu: False return: void* cpu_half: True cname: data arguments: - THTensor* self ]] [[ name: equal variants: - method - function return: bool arguments: - THTensor* self - THTensor* other ]] [[ python_name: copy_ name: THPTensor_(copy_) cpu_half: True method_flags: METH_KEYWORDS only_register: True ]] [[ name: __and__ variants: - method - function return: argument 0 options: - cname: bitand arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cbitand arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: __iand__ variants: - method - function return: argument 0 options: - cname: bitand arguments: - THTensor* self - THTensor* self - real value - cname: cbitand arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: __or__ variants: - method - function return: argument 0 options: - cname: bitor arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cbitor arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: __ior__ variants: - method - function return: argument 0 options: - cname: bitor arguments: - THTensor* self - THTensor* self - real value - cname: cbitor arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: __xor__ variants: - method - function return: argument 0 options: - cname: bitxor arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cbitxor arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: __ixor__ variants: - method - function return: argument 0 options: - cname: bitxor arguments: - THTensor* self - THTensor* self - real value - cname: cbitxor arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: __lshift__ variants: - method - function return: argument 0 options: - cname: lshift arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: clshift arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: __ilshift__ variants: - method - function return: argument 0 options: - cname: lshift arguments: - THTensor* self - THTensor* self - real value - cname: clshift arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: __rshift__ variants: - method - function return: argument 0 options: - cname: rshift arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: crshift arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: __irshift__ variants: - method - function return: argument 0 options: - cname: rshift arguments: - THTensor* self - THTensor* self - real value - cname: crshift arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: THPTensor_(apply) python_name: apply_ defined_if: "!IS_DISTRIBUTED" backends: - CPU cpu_half: True only_register: True override_method_flags: METH_O ]] [[ name: THPTensor_(map) python_name: map_ defined_if: "!IS_DISTRIBUTED" backends: - CPU cpu_half: True only_register: True ]] [[ name: THPTensor_(map2) python_name: map2_ defined_if: "!IS_DISTRIBUTED" backends: - CPU cpu_half: True only_register: True ]] [[ name: lt variants: - method return: argument 0 options: - cname: ltValue arguments: - arg: THBoolTensor* result output: True - THTensor* self - real value - cname: ltTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: lt_ return: self options: - cname: ltValueT arguments: - THTensor* self - THTensor* self - real value - cname: ltTensorT arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - arg: THTensor* other ]] [[ name: lt variants: - function return: argument 0 options: - cname: ltValue arguments: - arg: THBoolTensor* result output: True - THTensor* tensor - real value - cname: ltTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other - cname: ltValueT arguments: - arg: THTensor* result output: True - THTensor* tensor - real value - cname: ltTensorT arguments: - arg: THTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other ]] [[ name: gt variants: - method return: argument 0 options: - cname: gtValue arguments: - arg: THBoolTensor* result output: True - THTensor* self - real value - cname: gtTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: gt_ return: self options: - cname: gtValueT arguments: - THTensor* self - THTensor* self - real value - cname: gtTensorT arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: gt variants: - function return: argument 0 options: - cname: gtValue arguments: - arg: THBoolTensor* result output: True - THTensor* tensor - real value - cname: gtTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other - cname: gtValueT arguments: - arg: THTensor* result output: True - THTensor* tensor - real value - cname: gtTensorT arguments: - arg: THTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other ]] [[ name: le variants: - method return: argument 0 options: - cname: leValue arguments: - arg: THBoolTensor* result output: True - THTensor* self - real value - cname: leTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: le_ return: self options: - cname: leValueT arguments: - THTensor* self - THTensor* self - real value - cname: leTensorT arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: le variants: - function return: argument 0 options: - cname: leValue arguments: - arg: THBoolTensor* result output: True - THTensor* tensor - real value - cname: leTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other - cname: leValueT arguments: - arg: THTensor* result output: True - THTensor* tensor - real value - cname: leTensorT arguments: - arg: THTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other ]] [[ name: ge variants: - method return: argument 0 options: - cname: geValue arguments: - arg: THBoolTensor* result output: True - THTensor* self - real value - cname: geTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: ge_ return: self options: - cname: geValueT arguments: - THTensor* self - THTensor* self - real value - cname: geTensorT arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: ge variants: - function return: argument 0 options: - cname: geValue arguments: - arg: THBoolTensor* result output: True - THTensor* tensor - real value - cname: geTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other - cname: geValueT arguments: - arg: THTensor* result output: True - THTensor* tensor - real value - cname: geTensorT arguments: - arg: THTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other ]] [[ name: eq variants: - method return: argument 0 options: - cname: eqValue arguments: - arg: THBoolTensor* result output: True - THTensor* self - real value - cname: eqTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: eq_ return: self options: - cname: eqValueT arguments: - THTensor* self - THTensor* self - real value - cname: eqTensorT arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: eq variants: - function return: argument 0 options: - cname: eqValue arguments: - arg: THBoolTensor* result output: True - THTensor* tensor - real value - cname: eqTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other - cname: eqValueT arguments: - arg: THTensor* result output: True - THTensor* tensor - real value - cname: eqTensorT arguments: - arg: THTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other ]] [[ name: ne variants: - method return: argument 0 options: - cname: neValue arguments: - arg: THBoolTensor* result output: True - THTensor* self - real value - cname: neTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: ne_ return: self options: - cname: neValueT arguments: - THTensor* self - THTensor* self - real value - cname: neTensorT arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: ne variants: - function return: argument 0 options: - cname: neValue arguments: - arg: THBoolTensor* result output: True - THTensor* tensor - real value - cname: neTensor arguments: - arg: THBoolTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other - cname: neValueT arguments: - arg: THTensor* result output: True - THTensor* tensor - real value - cname: neTensorT arguments: - arg: THTensor* result output: True - arg: THTensor* tensor broadcast: other fallback - THTensor* other ]] [[ name: min variants: - method - function options: - cname: minall return: real arguments: - THTensor* self - cname: cmin return: argument 0 arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other - cname: min return: argument 0,1 arguments: - arg: THTensor* min output: True - arg: THIndexTensor* min_indices output: True - THTensor* self - arg: long dim wrap_dim: self - bool keepdim - cname: min return: argument 0,1 before_call: maybeThrowBackCompatKeepdimWarn("min"); arguments: - arg: THTensor* min output: True - arg: THIndexTensor* min_indices output: True - THTensor* self - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: max variants: - method - function options: - cname: maxall return: real arguments: - THTensor* self - cname: cmax return: argument 0 arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other - cname: max return: argument 0,1 arguments: - arg: THTensor* max output: True - arg: THIndexTensor* max_indices output: True - THTensor* self - arg: long dim wrap_dim: self - bool keepdim - cname: max return: argument 0,1 before_call: maybeThrowBackCompatKeepdimWarn("max"); arguments: - arg: THTensor* max output: True - arg: THIndexTensor* max_indices output: True - THTensor* self - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: kthvalue backends: - CPU variants: - method - function return: argument 0,1 options: - before_call: long __last_dim = THTensor_(nDimension)(LIBRARY_STATE ((THPTensor*)$arg2)->cdata)-1; arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - long k - CONSTANT __last_dim - bool keepdim - before_call: | long __last_dim = THTensor_(nDimension)(LIBRARY_STATE ((THPTensor*)$arg2)->cdata)-1; maybeThrowBackCompatKeepdimWarn("kthvalue"); arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - long k - CONSTANT __last_dim - CONSTANT false - arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - long k - arg: long dim wrap_dim: self - bool keepdim - before_call: maybeThrowBackCompatKeepdimWarn("kthvalue"); arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - long k - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: mode variants: - method - function return: argument 0,1 options: - before_call: long __last_dim = THTensor_(nDimension)(LIBRARY_STATE ((THPTensor*)$arg2)->cdata)-1; arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - CONSTANT __last_dim - bool keepdim - before_call: | long __last_dim = THTensor_(nDimension)(LIBRARY_STATE ((THPTensor*)$arg2)->cdata)-1; maybeThrowBackCompatKeepdimWarn("mode"); arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - CONSTANT __last_dim - CONSTANT false - arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - arg: long dim wrap_dim: self - bool keepdim - before_call: maybeThrowBackCompatKeepdimWarn("mode"); arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: median variants: - method - function return: argument 0,1 options: - cname: medianall return: real arguments: - THTensor* self - cname: median before_call: long __last_dim = THTensor_(nDimension)(LIBRARY_STATE ((THPTensor*)$arg2)->cdata)-1; arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - CONSTANT __last_dim - bool keepdim - before_call: maybeThrowBackCompatKeepdimWarn("median"); arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - arg: long dim wrap_dim: self - CONSTANT false - arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - arg: long dim wrap_dim: self - bool keepdim ]] [[ name: sort variants: - method - function return: argument 0,1 options: - before_call: long __last_dim = THTensor_(nDimension)(LIBRARY_STATE ((THPTensor*)$arg2)->cdata)-1; arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - CONSTANT __last_dim - arg: bool descending default: "false" kwarg_only: True - arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - arg: long dim wrap_dim: self - arg: bool descending default: "false" ]] [[ name: topk variants: - method - function return: argument 0,1 options: - before_call: long __last_dim = THTensor_(nDimension)(LIBRARY_STATE ((THPTensor*)$arg2)->cdata)-1; arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - long k - CONSTANT __last_dim - CONSTANT true - CONSTANT true - arguments: - arg: THTensor* values output: True - arg: THIndexTensor* indices output: True - THTensor* self - long k - arg: long dim wrap_dim: self - arg: bool largest default: "true" - arg: bool sorted default: "true" ]] [[ name: all types: - Byte backends: - CPU - CUDA cname: logicalall return: bool arguments: - THTensor* self ]] [[ name: any types: - Byte backends: - CPU - CUDA cname: logicalany return: bool arguments: - THTensor* self ]] [[ name: getDevice python_name: get_device backends: - CUDA return: long arguments: - THTensor* self ]] [[ name: THPTensor_(new) python_name: new method_flags: METH_KEYWORDS backends: - CUDA only_register: True ]] [[ name: THPTensor_(recordStream) python_name: record_stream override_method_flags: METH_O backends: - CUDA only_register: True ]] [[ name: abs return: argument 0 types: - floating_point - Long - Int - Short backends: - CPU - CUDA variants: - method - function arguments: - arg: THTensor* destination output: True - THTensor* self ]] [[ name: abs_ cname: abs return: self types: - floating_point - Long - Int - Short backends: - CPU - CUDA arguments: - THTensor* self - THTensor* self ]] [[ name: sigmoid_ types: - floating_point backends: - CPU - CUDA cname: sigmoid return: self arguments: - THTensor* self - THTensor* self ]] [[ name: sigmoid types: - floating_point backends: - CPU - CUDA cname: sigmoid variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: log_ types: - floating_point backends: - CPU - CUDA cname: log return: self arguments: - THTensor* self - THTensor* self ]] [[ name: log types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: log1p_ types: - floating_point backends: - CPU - CUDA cname: log1p return: self arguments: - THTensor* self - THTensor* self ]] [[ name: log1p types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: lgamma types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: lgamma_ types: - floating_point backends: - CPU - CUDA cname: lgamma return: self arguments: - THTensor* self - THTensor* self ]] [[ name: exp_ types: - floating_point backends: - CPU - CUDA cname: exp return: self arguments: - THTensor* self - THTensor* self ]] [[ name: exp types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: cos_ types: - floating_point backends: - CPU - CUDA cname: cos return: self arguments: - THTensor* self - THTensor* self ]] [[ name: cos types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: acos_ types: - floating_point backends: - CPU - CUDA cname: acos return: self arguments: - THTensor* self - THTensor* self ]] [[ name: acos types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: cosh_ types: - floating_point backends: - CPU - CUDA cname: cosh return: self arguments: - THTensor* self - THTensor* self ]] [[ name: cosh types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: sin_ types: - floating_point backends: - CPU - CUDA cname: sin return: self arguments: - THTensor* self - THTensor* self ]] [[ name: sin types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: asin_ types: - floating_point backends: - CPU - CUDA cname: asin return: self arguments: - THTensor* self - THTensor* self ]] [[ name: asin types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: sinh_ types: - floating_point backends: - CPU - CUDA cname: sinh return: self arguments: - THTensor* self - THTensor* self ]] [[ name: sinh types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: tan_ types: - floating_point backends: - CPU - CUDA cname: tan return: self arguments: - THTensor* self - THTensor* self ]] [[ name: tan types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: atan_ types: - floating_point backends: - CPU - CUDA cname: atan return: self arguments: - THTensor* self - THTensor* self ]] [[ name: atan types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: tanh_ types: - floating_point backends: - CPU - CUDA cname: tanh return: self arguments: - THTensor* self - THTensor* self ]] [[ name: tanh types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: sqrt_ types: - floating_point backends: - CPU - CUDA cname: sqrt return: self arguments: - THTensor* self - THTensor* self ]] [[ name: sqrt types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: rsqrt_ types: - floating_point backends: - CPU - CUDA cname: rsqrt return: self arguments: - THTensor* self - THTensor* self ]] [[ name: rsqrt types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: ceil_ types: - floating_point backends: - CPU - CUDA cname: ceil return: self arguments: - THTensor* self - THTensor* self ]] [[ name: ceil types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: floor_ types: - floating_point backends: - CPU - CUDA cname: floor return: self arguments: - THTensor* self - THTensor* self ]] [[ name: floor types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: round_ types: - floating_point backends: - CPU - CUDA cname: round return: self arguments: - THTensor* self - THTensor* self ]] [[ name: round types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: trunc_ types: - floating_point backends: - CPU - CUDA cname: trunc return: self arguments: - THTensor* self - THTensor* self ]] [[ name: trunc types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: frac_ types: - floating_point backends: - CPU - CUDA cname: frac return: self arguments: - THTensor* self - THTensor* self ]] [[ name: frac types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: mean types: - floating_point backends: - CPU - CUDA variants: - method - function options: - cname: meanall return: accreal arguments: - THTensor* self - cname: mean return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long dim wrap_dim: self - bool keepdim - cname: mean return: argument 0 before_call: maybeThrowBackCompatKeepdimWarn("mean"); arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: var types: - floating_point backends: - CPU - CUDA variants: - method - function options: - cname: varall return: accreal arguments: - THTensor* self - arg: bool unbiased if_true: 0 if_false: 1 default: 0 - cname: var return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long dim wrap_dim: self - arg: bool unbiased if_true: 0 if_false: 1 default: 0 - bool keepdim - cname: var return: argument 0 before_call: maybeThrowBackCompatKeepdimWarn("var"); arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long dim wrap_dim: self - arg: bool unbiased if_true: 0 if_false: 1 default: 0 - CONSTANT false ]] [[ name: std types: - floating_point backends: - CPU - CUDA variants: - method - function options: - cname: stdall return: accreal arguments: - THTensor* self - arg: bool unbiased if_true: 0 if_false: 1 default: 0 - cname: std return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long dim wrap_dim: self - arg: bool unbiased if_true: 0 if_false: 1 default: 0 - bool keepdim - cname: std return: argument 0 before_call: maybeThrowBackCompatKeepdimWarn("std"); arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long dim wrap_dim: self - arg: bool unbiased if_true: 0 if_false: 1 default: 0 - CONSTANT false ]] [[ name: norm types: - floating_point backends: - CPU - CUDA variants: - method - function options: - cname: normall return: accreal arguments: - THTensor* self - arg: real p default: AS_REAL(2) - cname: norm return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - real p - arg: long dim wrap_dim: self - bool keepdim - cname: norm return: argument 0 before_call: maybeThrowBackCompatKeepdimWarn("norm"); arguments: - arg: THTensor* destination output: True - THTensor* self - real p - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: renorm types: - floating_point backends: - CPU - CUDA variants: - method - function options: - cname: renorm return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - real p - arg: long dim wrap_dim: self - real maxnorm ]] [[ name: renorm_ types: - floating_point backends: - CPU - CUDA options: - cname: renorm return: self arguments: - THTensor* self - THTensor* self - real p - arg: long dim wrap_dim: self - real maxnorm ]] [[ name: dist types: - floating_point backends: - CPU - CUDA variants: - method - function options: - cname: dist return: accreal arguments: - arg: THTensor* self broadcast: other fallback - THTensor* other - arg: real p default: AS_REAL(2) ]] [[ name: reciprocal types: - floating_point backends: - CPU - CUDA variants: - method - function options: - cname: cinv return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self ]] [[ name: reciprocal_ types: - floating_point backends: - CPU - CUDA options: - cname: cinv return: self arguments: - THTensor* self - THTensor* self ]] [[ name: neg types: - floating_point - Long - Int - Short backends: - CPU - CUDA variants: - method - function options: - cname: neg return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self ]] [[ name: neg_ types: - floating_point - Long - Int - Short backends: - CPU - CUDA options: - cname: neg return: self arguments: - THTensor* self - THTensor* self ]] [[ name: atan2 types: - Float - Double backends: - CPU backend_type_pairs: [[CPU,Float],[CPU,Double],[CUDA,Float]] variants: - method - function cname: atan2 return: argument 0 arguments: - arg: THTensor* destination output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: atan2_ backend_type_pairs: [[CPU,Float],[CPU,Double],[CUDA,Float]] cname: atan2 return: argument 0 arguments: - THTensor* self - arg: THTensor* self broadcast: other fallback inplace - THTensor* other ]] [[ name: pow types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 options: - cname: pow arguments: - arg: THTensor* destination output: True - THTensor* self - real exponent - cname: cpow arguments: - arg: THTensor* destination output: True - arg: THTensor* self broadcast: exponent fallback - THTensor* exponent - cname: tpow arguments: - arg: THTensor* destination output: True - real base - THTensor* self ]] [[ name: pow_ types: - floating_point backends: - CPU - CUDA return: argument 0 cname: pow options: - cname: pow arguments: - THTensor* self - THTensor* self - real exponent - cname: cpow arguments: - THTensor* self - arg: THTensor* self broadcast: exponent inplace fallback - THTensor* exponent ]] [[ name: lerp types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 cname: lerp arguments: - arg: THTensor* destination output: True - arg: THTensor* self broadcast: end fallback - THTensor* end - real weight ]] [[ name: lerp_ types: - floating_point backends: - CPU - CUDA return: self cname: lerp arguments: - THTensor* self - arg: THTensor* self broadcast: end fallback inplace - THTensor* end - real weight ]] [[ name: linspace types: - Float - Double backends: - CPU variants: - function return: argument 0 arguments: - arg: THTensor* result output: True - real start - real end - arg: long steps default: 100 ]] [[ name: logspace types: - Float - Double backends: - CPU variants: - function return: argument 0 arguments: - arg: THTensor* result output: True - real start - real end - arg: long steps default: 100 ]] [[ name: histc types: - Float - Double backends: - CPU variants: - method - function return: argument 0 options: - arguments: - arg: THTensor* destination output: True - THTensor* self - CONSTANT 100 - CONSTANT 0 - CONSTANT 0 - arguments: - arg: THTensor* destination output: True - THTensor* self - long bins - CONSTANT 0 - CONSTANT 0 - arguments: - arg: THTensor* destination output: True - THTensor* self - long bins - real min - CONSTANT 0 - arguments: - arg: THTensor* destination output: True - THTensor* self - long bins - real min - real max ]] [[ name: zero_ cname: zero return: self arguments: - THTensor* self ]] [[ name: sum variants: - method - function options: - cname: sumall return: accreal arguments: - THTensor* self - cname: sum return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self - bool keepdim - cname: sum return: argument 0 before_call: maybeThrowBackCompatKeepdimWarn("sum"); arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: prod variants: - method - function options: - cname: prodall return: accreal arguments: - THTensor* self - cname: prod return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self - bool keepdim - cname: prod return: argument 0 before_call: maybeThrowBackCompatKeepdimWarn("prod"); arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self - CONSTANT false ]] [[ name: cumsum variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self ]] [[ name: cumprod variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - arg: long dim wrap_dim: self ]] [[ name: sign variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self ]] [[ name: sign_ cname: sign return: self arguments: - THTensor* self - THTensor* self ]] [[ name: trace variants: - method - function return: accreal arguments: - THTensor* self ]] [[ name: add variants: - method - function return: argument 0 options: - cname: add arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cadd aten_sparse: True arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - arg: real value default: AS_REAL(1) - THTensor* other - sparse: True cname: spcadd aten_dense_sparse: True arguments: - arg: THTensor* result output: True - THTensor* self - arg: real value default: AS_REAL(1) - THSTensor* other ]] [[ name: add_ return: argument 0 options: - cname: add arguments: - THTensor* self - THTensor* self - real value - cname: cadd aten_sparse: True arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - arg: real value default: AS_REAL(1) - THTensor* other - sparse: True cname: spcadd aten_dense_sparse: True arguments: - THTensor* self - THTensor* self - arg: real value default: AS_REAL(1) - THSTensor* other ]] [[ name: sub variants: - method - function return: argument 0 options: - cname: sub arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: csub arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - arg: real value default: AS_REAL(1) - THTensor* other ]] [[ name: sub_ return: argument 0 options: - cname: sub arguments: - THTensor* self - THTensor* self - real value - cname: csub arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - arg: real value default: AS_REAL(1) - THTensor* other ]] [[ name: mul variants: - method - function return: argument 0 options: - cname: mul arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cmul arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - arg: THTensor* other ]] [[ name: mul_ return: argument 0 options: - cname: mul arguments: - THTensor* self - THTensor* self - real value - cname: cmul arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: div variants: - method - function return: argument 0 options: - cname: div arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cdiv arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: div_ return: argument 0 options: - cname: div arguments: - THTensor* self - THTensor* self - real value - cname: cdiv arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: fmod return: argument 0 variants: - method - function options: - cname: fmod arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cfmod arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - THTensor* other ]] [[ name: fmod_ return: argument 0 options: - cname: fmod arguments: - THTensor* self - THTensor* self - real value - cname: cfmod arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: remainder return: argument 0 variants: - method - function options: - cname: remainder arguments: - arg: THTensor* result output: True - THTensor* self - real value - cname: cremainder arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: other fallback - arg: THTensor* other ]] [[ name: remainder_ return: argument 0 options: - cname: remainder arguments: - THTensor* self - THTensor* self - real value - cname: cremainder arguments: - THTensor* self - arg: THTensor* self broadcast: other inplace fallback - THTensor* other ]] [[ name: clamp variants: - method - function return: argument 0 options: - cname: clamp arguments: - arg: THTensor* destination output: True - THTensor* self - real min - real max - cname: cmaxValue arguments: - arg: THTensor* result output: True - THTensor* self - arg: real min kwarg_only: True - cname: cminValue arguments: - arg: THTensor* result output: True - THTensor* self - arg: real max kwarg_only: True ]] [[ name: clamp_ cname: clamp return: self options: - cname: clamp arguments: - THTensor* self - THTensor* self - real min - real max - cname: cmaxValue arguments: - THTensor* self - THTensor* self - arg: real min kwarg_only: True - cname: cminValue arguments: - THTensor* self - THTensor* self - arg: real max kwarg_only: True ]] [[ name: dot backend_type_pairs: [[CUDA,floating_point], [CPU,all]] variants: - method - function return: accreal arguments: - arg: THTensor* self assert_ndim: 1 - arg: THTensor* tensor assert_ndim: 1 ]] [[ name: tril variants: - method - function return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long diagonal default: 0 ]] [[ name: tril_ cname: tril return: self arguments: - THTensor* self - THTensor* self - arg: long diagonal default: 0 ]] [[ name: triu variants: - method - function return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - arg: long diagonal default: 0 ]] [[ name: triu_ cname: triu return: self arguments: - THTensor* self - THTensor* self - arg: long diagonal default: 0 ]] [[ name: cross variants: - method - function return: argument 0 arguments: - arg: THTensor* destination output: True - THTensor* self - THTensor* other - arg: long dim default: -1 ]] [[ name: eye backends: - CPU - CUDA variants: - function return: argument 0 options: - arguments: - arg: THTensor* result output: True - long n - argument 1 - arguments: - arg: THTensor* result output: True - long n - long m ]] [[ name: diag variants: - method - function return: argument 0 options: - arguments: - arg: THTensor* result output: True - THTensor* self - arg: long diagonal default: 0 ]] [[ name: addmm variants: - method - function return: argument 0 options: - arguments: - arg: THTensor* result output: True - arg: real beta default: AS_REAL(1) - arg: THTensor* self broadcast: mat1,mat2 dims:mat1.dim0,mat2.dim1 - arg: real alpha default: AS_REAL(1) - THTensor* mat1 - THTensor* mat2 - cname: spaddmm sparse: yes arguments: - arg: THTensor* result output: True - arg: real beta default: AS_REAL(1) - THTensor* self - arg: real alpha default: AS_REAL(1) - THSTensor* mat1 - THTensor* mat2 ]] [[ name: addmm_ return: self options: - cname: addmm arguments: - THTensor* self - arg: real beta default: AS_REAL(1) - THTensor* self - arg: real alpha default: AS_REAL(1) - THTensor* mat1 - THTensor* mat2 - cname: spaddmm sparse: yes arguments: - arg: THTensor* self - arg: real beta default: AS_REAL(1) - THTensor* self - arg: real alpha default: AS_REAL(1) - THSTensor* mat1 - THTensor* mat2 ]] [[ name: addmv variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: real beta default: AS_REAL(1) - arg: THTensor* self broadcast: mat,vec dims:mat.dim0 - arg: real alpha default: AS_REAL(1) - THTensor* mat - THTensor* vec ]] [[ name: addmv_ cname: addmv return: self arguments: - THTensor* self - arg: real beta default: AS_REAL(1) - THTensor* self - arg: real alpha default: AS_REAL(1) - THTensor* mat - THTensor* vec ]] [[ name: addr variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: real beta default: AS_REAL(1) - arg: THTensor* self broadcast: vec1,vec2 dims:vec1.dim0,vec2.dim0 - arg: real alpha default: AS_REAL(1) - THTensor* vec1 - THTensor* vec2 ]] [[ name: addr_ cname: addr return: self arguments: - THTensor* self - arg: real beta default: AS_REAL(1) - THTensor* self - arg: real alpha default: AS_REAL(1) - THTensor* vec1 - THTensor* vec2 ]] [[ name: ger cname: addr variants: - method - function return: argument 0 before_call: | long s1 = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg4)->cdata, 0); long s2 = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg5)->cdata, 0); THTensor_(resize2d)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata, s1, s2); arguments: - arg: THTensor* result output: True resize: [ [self,0], [vec2,0] ] - CONSTANT AS_REAL(0) - argument 0 - CONSTANT AS_REAL(1) - THTensor* self - THTensor* vec2 ]] [[ name: mv cname: addmv variants: - method - function return: argument 0 before_call: | long s = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg4)->cdata, 0); THTensor_(resize1d)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata, s); #if !IS_CUDA THTensor_(zero)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata); #endif arguments: - arg: THTensor* result output: True resize: [ [self, 0] ] cpu_zero: True - CONSTANT AS_REAL(0) - argument 0 - CONSTANT AS_REAL(1) - THTensor* self - THTensor* vec ]] [[ name: mm variants: - method - function return: argument 0 options: - cname: addmm before_call: | long s1 = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg4)->cdata, 0); long s2 = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg5)->cdata, 1); THTensor_(resize2d)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata, s1, s2); #if !IS_CUDA THTensor_(zero)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata); #endif arguments: - arg: THTensor* result output: True resize: [ [self, 0], [mat2,1] ] cpu_zero: True - CONSTANT AS_REAL(0) - argument 0 - CONSTANT AS_REAL(1) - THTensor* self - THTensor* mat2 - cname: spaddmm sparse: True arguments: - arg: THTensor* result output: True - CONSTANT AS_REAL(0) - argument 0 - CONSTANT AS_REAL(1) - THSTensor* self - THTensor* mat2 ]] [[ name: bmm cname: baddbmm variants: - method - function return: argument 0 before_call: | long s1 = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg4)->cdata, 0); long s2 = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg4)->cdata, 1); long s3 = THTensor_(size)(LIBRARY_STATE ((THPTensor*)$arg5)->cdata, 2); THTensor_(resize3d)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata, s1, s2, s3); #if !IS_CUDA THTensor_(zero)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata); #endif arguments: - arg: THTensor* result output: True resize: [ [self,0], [self,1], [mat2,2] ] cpu_zero: True - CONSTANT AS_REAL(0) - argument 0 - CONSTANT AS_REAL(1) - THTensor* self - THTensor* mat2 ]] [[ name: addbmm variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: real beta default: AS_REAL(1) - arg: THTensor* self broadcast: batch1,batch2 dims:batch1.dim1,batch2.dim2 - arg: real alpha default: AS_REAL(1) - THTensor* batch1 - THTensor* batch2 ]] [[ name: addbmm_ cname: addbmm return: self arguments: - THTensor* self - arg: real beta default: AS_REAL(1) - THTensor* self - arg: real alpha default: AS_REAL(1) - THTensor* batch1 - THTensor* batch2 ]] [[ name: baddbmm variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: real beta default: AS_REAL(1) - arg: THTensor* self broadcast: batch1,batch2 dims:batch1.dim0,batch1.dim1,batch2.dim2 - arg: real alpha default: AS_REAL(1) - THTensor* batch1 - THTensor* batch2 ]] [[ name: baddbmm_ cname: baddbmm return: argument 0 arguments: - THTensor* self - arg: real beta default: AS_REAL(1) - THTensor* self - arg: real alpha default: AS_REAL(1) - THTensor* batch1 - THTensor* batch2 ]] [[ name: addcmul variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: tensor1,tensor2 fallback - arg: real value default: AS_REAL(1) - THTensor* tensor1 - THTensor* tensor2 ]] [[ name: addcmul_ options: - cname: addcmul return: argument 0 arguments: - THTensor* self - arg: THTensor* self broadcast: tensor1,tensor2 inplace fallback - arg: real value default: AS_REAL(1) - THTensor* tensor1 - THTensor* tensor2 - cname: spaddcmul defined_if: "!IS_DISTRIBUTED" return: argument 0 arguments: - THTensor* self - THTensor* self - arg: real value default: AS_REAL(1) - THSTensor* tensor1 - THSTensor* tensor2 ]] [[ name: addcdiv variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: THTensor* self broadcast: tensor1,tensor2 fallback - arg: real value default: AS_REAL(1) - THTensor* tensor1 - THTensor* tensor2 ]] [[ name: addcdiv_ cname: addcdiv return: argument 0 arguments: - THTensor* self - arg: THTensor* self broadcast: tensor1,tensor2 inplace fallback - arg: real value default: AS_REAL(1) - THTensor* tensor1 - THTensor* tensor2 ]] [[ name: gesv types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0,1 arguments: - arg: THTensor* solution output: True - arg: THTensor* lu output: True - THTensor* self - THTensor* A ]] [[ name: gels types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0,1 arguments: - arg: THTensor* res1 output: True - arg: THTensor* res2 output: True - THTensor* self - THTensor* A ]] [[ name: trtrs types: - Float - Double backends: - CPU variants: - method - function return: argument 0,1 arguments: - arg: THTensor* res1 output: True - arg: THTensor* res2 output: True - THTensor* self - THTensor* A - arg: bool upper if_true: U if_false: L default: U - arg: bool transpose if_true: T if_false: N default: N - arg: bool unitriangular if_true: U if_false: N default: N ]] [[ name: symeig cname: syev types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0,1 arguments: - arg: THTensor* res1 output: True - arg: THTensor* res2 output: True - THTensor* self - arg: bool eigenvectors if_true: V if_false: N default: N - arg: bool upper if_true: U if_false: L default: U ]] [[ name: eig cname: geev types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0,1 arguments: - arg: THTensor* res1 output: True - arg: THTensor* res2 output: True - THTensor* self - arg: bool eigenvectors if_true: V if_false: N default: N ]] [[ name: svd cname: gesvd types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0,1,2 arguments: - arg: THTensor* res1 output: True - arg: THTensor* res2 output: True - arg: THTensor* res3 output: True - THTensor* self - arg: bool some if_true: S if_false: A default: S ]] [[ name: inverse cname: getri types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* output output: True - THTensor* self ]] [[ name: potrf types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* output output: True - THTensor* self - arg: bool upper if_true: U if_false: L default: U ]] [[ name: potrs types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - THTensor* input2 - arg: bool upper if_true: U if_false: L default: U ]] [[ name: potri types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* output output: True - THTensor* self - arg: bool upper if_true: U if_false: L default: U ]] [[ name: pstrf types: - Float - Double backends: - CPU variants: - method - function return: argument 0,1 after_call: THIntTensor_sub(((THPIntTensor*)$arg1)->cdata, ((THPIntTensor*)$arg1)->cdata, 1); arguments: - arg: THTensor* res1 output: True - arg: THIntegerTensor* res2 output: True - THTensor* self - arg: bool upper if_true: U if_false: L default: U - arg: real tol default: -1 ]] [[ name: qr types: - Float - Double backends: - CPU - CUDA variants: - method - function return: argument 0,1 arguments: - arg: THTensor* res1 output: True - arg: THTensor* res2 output: True - THTensor* self ]] [[ name: geqrf types: - Float - Double backends: - CPU variants: - method - function return: argument 0,1 arguments: - arg: THTensor* res1 output: True - arg: THTensor* res2 output: True - THTensor* self ]] [[ name: orgqr types: - Float - Double backends: - CPU variants: - method - function return: argument 0,1 arguments: - arg: THTensor* result output: True - THTensor* self - THTensor* input2 ]] [[ name: ormqr types: - Float - Double backends: - CPU variants: - method - function return: argument 0,1 arguments: - arg: THTensor* result output: True - THTensor* self - THTensor* input2 - THTensor* input3 - arg: bool left if_true: L if_false: R default: L - arg: bool transpose if_true: T if_false: N default: N ]] [[ name: btrifact cname: btrifact types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0,1 arguments: - arg: THTensor* result output: True - arg: THIntegerTensor* pivots output: True - arg: THIntegerTensor* info kwarg_only: True default: NULL - arg: bool pivot kwarg_only: True default: "true" - THTensor* self ]] [[ name: btrisolve cname: btrisolve types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THTensor* result output: True - THTensor* self - THTensor* LU_data - THIntegerTensor* LU_pivots ]] [[ name: randperm defined_if: "!IS_DISTRIBUTED" backends: - CPU variants: - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - long n ]] [[ name: random_ defined_if: "!IS_DISTRIBUTED" backends: - CPU return: self options: - cname: random arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - cname: cappedRandom arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - long to - cname: clampedRandom arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - long from - long to ]] [[ name: multinomial types: - floating_point backends: - CPU - CUDA variants: - method - function return: argument 0 arguments: - arg: THIndexTensor* result output: True - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - THTensor* self - long num_samples - arg: bool replacement default: "false" ]] [[ name: uniform_ types: - floating_point backends: - CPU - CUDA cname: uniform return: self arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: double from default: 0 - arg: double to default: 1 ]] [[ name: normal types: - floating_point backends: - CPU - CUDA return: argument 0 variants: - function options: - cname: normal_means arguments: - arg: THTensor* output output: True - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - THTensor* means - arg: double std default: 1 - cname: normal_stddevs arguments: - arg: THTensor* output output: True - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: double mean default: 0 - THTensor* std - cname: normal_means_stddevs arguments: - arg: THTensor* output output: True - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - THTensor* means - THTensor* std ]] [[ name: normal_ types: - floating_point backends: - CPU - CUDA cname: normal return: self arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: double mean default: 0 - arg: double std default: 1 ]] [[ name: cauchy_ types: - floating_point backends: - CPU - CUDA cname: cauchy return: self arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: double median default: 0 - arg: double sigma default: 1 ]] [[ name: logNormal_ cname: logNormal python_name: log_normal_ types: - floating_point backends: - CPU - CUDA return: self arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: double mean default: 1 - arg: double std default: 2 ]] [[ name: exponential_ types: - floating_point backends: - CPU - CUDA cname: exponential return: self arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: double lambd default: 1 ]] [[ name: rand types: - floating_point backends: - CPU - CUDA variants: - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: THSize* size long_args: True ]] [[ name: randn types: - floating_point backends: - CPU - CUDA variants: - function return: argument 0 arguments: - arg: THTensor* result output: True - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: THSize* size long_args: True ]] [[ name: geometric_ defined_if: "!IS_DISTRIBUTED" backends: - CPU - CUDA cname: geometric return: self arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - double p ]] [[ name: bernoulli types: - Float - Double backends: - CPU return: argument 0 variants: - method - function before_call: THTensor_(resizeAs)(LIBRARY_STATE ((THPTensor*)$arg0)->cdata, ((THPTensor*)$arg2)->cdata); cname: BERNOULLI_TENSOR arguments: - arg: THTensor* output output: True resize: self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - THTensor* self ]] [[ name: bernoulli_ defined_if: "!IS_DISTRIBUTED" backends: - CPU - CUDA return: self options: - cname: bernoulli arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - arg: double p default: 0.5 - cname: bernoulli_FloatTensor arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - BackendFloatTensor* float_p - cname: bernoulli_DoubleTensor arguments: - THTensor* self - arg: THGenerator* generator default: THPDefaultGenerator->cdata kwarg_only: True - BackendDoubleTensor* float_p ]] </ins>

There are previous issues addressing this, but I want to write this up with a plan in a new issue. We should make differentiable instead of having a wrapper class. The Variable class adds conceptual overhead without sufficient benefit. It makes it harder for new users to adopt PyTorch by adding a second API which is similar but not exactly the same as Tensor. There are few prerequisites: on s need to be at least as fast as operations on () need scalar support at the Python level () The constructor will be deprecated and become a no-op. The accessor will be deprecated and return a view that has requiresgrad=False. The constructors will take an optional keyword argument There will be a number of internal changes, but we shouldn't break most existing code: performance reasons, we will no longer build up the graph of operations by default when unless the operation uses stochastic variables. We'll use a context manager or global variable to enable graph creation. new differentiable Tensor will need support all the operations currently on Tensor, including in-place and operations. -place operations on leaf Variables which requiregrad are not currently supported. In the new API, the tensor's value will be updated and it will remain a leaf node. (This is important for optimizers, which update leaf Variables in-place). There are probably a few other subtle differences between Tensor and Variable APIs. I'll update this issue as we address them. See also: 23/738 # Greg will be fixing the tests, Tensor vs. Variable requiresgrad 2/1837 # Just testbroadcast from TestTorch OK OK # error at top level OK OK OK OK OK OK OK OK 10/120 # missing sspaddmm, dsmm/mm, addmm 1/257 TestTorch.testbroadcast 2OK
Properly handling in-place might not be as easy as it seems. Sometimes you actually need to move the Variable in the graph. Consider this case:
One of the cases of differences between variable and tensor is computation of var/std:
IMO Variable gives user a clear difference between graph node and data. .data attribute and Variable constructor provide convenient and explicit ways to take control of the graph (or graphs).
This is done. (Still some clean-up to do)
Is the conda PyTorch out of date? I'm getting the following error: .
Yes, we haven't released 0.4, which has the Variable Tensor merge, yet


Question: torch_version=version_str, is_debug_build=debug_mode_str, python_version='{}.{} ({}-bit runtime)'.format(sys.version_info[0], sys.version_info[1], sys.maxsize.bit_length() + 1), <ins> python_platform=get_python_platform(), </ins> is_cuda_available=cuda_available_str, cuda_compiled_version=cuda_version_str, cuda_runtime_version=get_running_cuda_version(run_lambda),

TensorPipe uses some advanced features of the Linux kernel. It does so on a "best effort" basis (i.e., use them if available, fall back on something else if not). This logic is unfortunately hard to test because it would require specific kernel versions on our CI machines. So it occasionally happens that we find out about issues when users report them. To help investigate these reports we've found it useful to know the kernel version and the glibc version used by the user (both when building and when running, if they're different). It would be great if these could be to the report produced by collect_env.
CC


Question: self.assertEqual(v[mask].shape, (3, 7, 3)) self.assertEqual(v[mask], torch.stack([v[0], v[2], v[3]])) <ins> v = Variable(torch.Tensor([1])) self.assertEqual(v[v == 0], Variable(torch.Tensor())) </ins> def test_multiple_byte_mask(self): v = Variable(torch.randn(5, 7, 3)) # note: these broadcast together and are transposed to the first dim

In PyTorch master 0.4 , variables cannot be indexed. This used to work in PyTorch 0.2 :
This is breaking some of Pyro's inference algorithms on PyTorch master:


Question: lib_paths = list(filter(bool, [ os.getenv('CUDNN_LIB_DIR'), os.path.join(CUDA_HOME, 'lib'), <del> os.path.join(CUDA_HOME, 'lib64') </del> <ins> os.path.join(CUDA_HOME, 'lib64'), '/usr/lib/x86_64-linux-gnu/', </ins> ])) include_paths = list(filter(bool, [ os.getenv('CUDNN_INCLUDE_DIR'), os.path.join(CUDA_HOME, 'include'), <ins> '/usr/include/' </ins> ])) for path in lib_paths: if path is None or not os.path.exists(path):

Kind of similar to Sometimes our Eigen build fails this way: It doesn't seem to reliably repro. cc
I got some sort of similar-ish error persistently on a test branch:
Not that persistently; a PR stacked on the failing one succeeded. So there is something nondeterministic going on here.
another instance: CI on
Looks like an NVCC bug. The workground is protecting eigen headers with Can we extract some basic code example and compile it against NVCC?
Another one in
Can you try with 10.2?
Mingbo, can you put general information on the issue you are seeing here in this issue?
latest word on this is from mingbo: "from what I can tell, it's a flaky one. might depend on which VS version. I hit the problem before and problem fixed (at least seem so) after upgrading VS 2019 latest version" and "the same error showed up once last week, and re-run the job finished without problem."
Hi. Did anyone have this issue persistently, ie that a rebuild did not "fix" it? We've had this issue in another (closed source) project. Exposing cuda to less includes (such as boost) seems to help but is not predictable.
It's never been persistent for us, but this is mostly from our Windows CI builds where we blow everything away and rebuild from scratch, which may help.
Yet another occurrence in the forum: It seems to be fixed by , which implies there may be a race condition in reading the include files or generating the intermediate source files.
I was able to reproduce the issue with a more verbose output with And then I inspected the variables carefully and found out that the VC env is activated twice. We should really avoid that.
You are SO COOL!!!
I tried to build from scratch several times with this PR and could not reproduce the issue anymore. Let's assume it's fixed.
Looks like it was not resolved.
Another occurrence: This time it seems to claim the error is around the usage of .
This sounds like a good old multiple-instances-of-nvcc-write-to-the-same-temp-file One can invoke to see all temporary filenames it creates. I guess on windows they are more likely to collide with each other than on linux. One solution to the problem would be to invoke nvcc sequentially.

Another is to tweak environment (there must be something similar to TMPDIR on Windows, mustn't it?)
Yes, they are called TMP and TEMP.
Is there any example of the latter method on Unix systems?
I've written a utility . Hopefully it can be used to resolve this problem if that's the case.
New occurrence after the previous fix:
seems related to
If this is the case, maybe we could apply to fix that.
unfortunately, this introduces another thrust problem (e.g. ): D:/programs64/cuda101/includethrust/detail/complex/catrig.h(607): error: no instance of function template "thrust::atanh" matches the argument list argument types are: (double) with problematic include chain -thrust/complex.h -thrust/detail/complex/catrig.h (has cplusplus conditions) -thrust/detail/complex/c99math.h where "using ::atanh" is omitted for MSVC. Patching c99math.h (or even thrustdetailconfigcppdialect.h without using /Zc:_cplusplus) seems to work for me, but I'm not sure what's the best way to fix this within pytorch tree and whether c++ dialect is the only problem here.
Thanks for the investigation. BTW, could you please share with us how did you patch c99math.h?
Disregard that, still got same unreproducible C2993 error with /Zc:_cplusplus. Earlier, I had "build" directory reproducibly failing (at ), and hardcoding c++17 in thrustdetailconfigcppdialect.h fixed that. But looks like it is just a symptom of some inconsistence in environment/flags (across nvcc stages maybe?) just "using ::atanh"
Yeah, maybe. I am considering to add a wrapper to retry the build a few times.
I can now stably reproduce a related error by passing in .
By commenting out some part of the code, I find the code that causes the previous error. I don't know why it is executed in the device code.
Well, I figured out the reason. It seems that and are implicitly marked as and . This behavior can be disabled by adding .
Nice work!
Seems to be a nvcc bug
Thanks for reminding. I have commented there.
This is indeed an nvcc bug.

There is no known workaround at the moment, but the next release of the CUDA toolkit will contain a fix. Ref thrust/thrust.
Met this problem:
Just retry a few times.
The CUDA TK 11.0 RC is now available: This issue has been fixed in that version of nvcc.
Thanks for the info. Actually, our release binaries rely on the cudatoolkit package in anaconda cloud. So we won't be able to publish the binaries with CUDA 11 now. I'm just curious whether that is maintained by Nvidia? Another question, any plan to backport the changes to exisiting CUDA versions (e.g. cuda 10.1, cuda 10.2)?
I don't have that information unfortunately -- it'd be best to contact the maintainer of that package and see when they plan to update. I'm not aware of any plans to backport this fix.
I have also obtained this error with CUDA 10.1/cuDNN 7.6.4 on Win Server 2019.
this is a cuda bug. Please see above discussion and upgrade to cuda 11.
I fixed the error by installing sscache for use with cuda 10.1 and cuda 10.2, as done here.
it's an intermittent error and the probability of occurrence varies depending on your system. So it's not really fixed, but you may have found a way to reduce the occurrence in your system, which may be sufficient in your case :)
Another instance, this time inside protobuf: Running with I found the syntax error is introduced by which is the cuda compiler front end. operates on the output from the compiler's pre-processor and that output barely even changed to trigger the build error, only line number metadata and some extra whitespace was changed in the pre-processed output. Here is the diff of the two inputs, one of which failed and the other didn't: And the corresponding change in the output: This failure reproduced reliably on the CI machine. Running nvcc manually multiple times, it always fails or passes given the same inputs. I think it's a deterministic failure, but is annoyingly sensitive to any changes in the input file whatsoever.
closing due to age
Wait, do we think this is fixed?

It's not clear to me it is...
I think this was related to CUDA 10.2 builds on windows which we don't actually support anymore so it is probably safe to keep closed.


Question: if self.is_cuda: raise TypeError("cannot pin '{0}' only CPU memory can be pinned" .format(self.type())) <del> storage = self.storage() </del> <ins> storage = self.contiguous().storage() </ins> if storage is None: storage = (self.storage_type())() return type(self)().set_(storage.pin_memory()).view_as(self)

Hello, I was experimenting with a custom which receives a batch of different sized integer sequences and pads them to form 2D tensors. I noticed a weird issue for which I created the following MWE: It's probably because of the different memory ordering on Python's side and CUDA's allocator. Tested on K40 and GTX1080 with driver 375.39, CUDA8.
Pin memory is missing a call inside. Should be an easy fix
fixed via


Question: build_libs_cmd = ['bash', 'torch/lib/build_libs.sh'] my_env = os.environ.copy() my_env["PYTORCH_PYTHON"] = sys.executable <ins> if WITH_SYSTEM_NCCL: my_env["NCCL_ROOT_DIR"] = NCCL_ROOT_DIR </ins> if WITH_CUDA: build_libs_cmd += ['--with-cuda'] if subprocess.call(build_libs_cmd + libs, env=my_env) != 0:

Currently, you can have a libnccl on your system, and pytorch setup favors that instead of compiling one itself from source. The code that takes care of this is: However, this breaks gloo build because gloo gets a path to NCCL via:
I got the error during the installation: Is it related to this problem?
that's a dupe of
no, that's a consequence of , now you have to do before compiling. I think you don't want to do recursive submodule update, because that will pull in gtest and another copy of nccl.
Alternatively we can pass new flags to gloo to prevent it from using its own NCCL
Thanks works for me.
You can prevent it from using its own nccl, but its cmake still has to be able to find some nccl.
I think should be sufficient. I'm testing.
fixes it when we dont have an external NCCL and pytorch compiles it's own NCCL?
I don't see how NCCLEXTERNAL fixes anything, looks like in gloo NCCLEXTERNAL is used just to set dependency if gloo is compiling its own nccl (which we don't want in any case).
The only thing I tested when I was that the vendored nccl was not being built (even if its submodule was checked out); I tested this by adding an to one of the headers. I'll test with the other configurations.
Actually, there are a few bugs here. First, even though GLOOFLAGS looks like it's setting NCCLROOTDIR: it actually isn't because the gloo invocation is which expands to but only is passed to cmake. Suppose you fix this. nccl is still not going to be picked up, because INSTALLDIR is PyTorch's local install dir, but if you disabled nccl builds, there will never actually be a nccl here. So cmake is just going to do it's standard search to find a nccl somewhere. Inversely, if you ever built nccl, and then turn it off, we will keep picking up that locally built version until you delete it. So we shouldn't do that. Suppose you fix this.

Then I think gloo will (continue to) correctly pick up system nccl and be built with it, and the final thing to fix is that build of PyTorch csrc doesn't know how to search for nccl headers somewhere. This is probably related to . I wonder, maybe we shouldn't do any autodetection at all, and force the user to pass us the include and library paths of nccl if they want to build with system.
FYI, I committed a change to gloo to stop bundling NCCL itself. It will now happily pick up whatever NCCL you give it through NCCLROOTDIR or by trying to find it in the standard systems paths. See facebookincubator/gloo You do have to set to make Gloo try and find it and compile in support.
So to fix this, you should be able to not specify anything aside from if you want to use system NCCL, and add if you have some custom location (either a PyTorch bundled version or a custom install altogether).


Question: } void THTensor_(sparseMask)(THSTensor *r_, THTensor *t, THSTensor *mask) { <ins> THArgCheck(mask->coalesced, 2, "mask is uncoalesced"); </ins> THSTensor_(resizeAs)(r_, mask); if (mask->nnz == 0) { THSTensor_(zero)(r_);

and I talked about the intended semantics of sparsemask when given a sparse tensor as an argument, and we came to the following conclusions: with an uncoalesced sparse tensor does not make sense, full stop. Unlike values, where your update might be linear and work correctly on an uncoalesced sparse tensor, there isn't any good reason why you want to pluck out values from the dense tensor multiple times, it is basically always a bug. the (eventual) documentation for sparsemask, we will recommend calling coalesce before doing any operations involving sparsemask (or nonlinear updates to indices/values). should add a test to sparsemask which checks if the flag of the input tensor is true, and raise an error if it is not. This is a cheap safety check which will prevent people from forgetting to call coalesce (as in (2)). There is a performance consequence to calling coalesce every iteration of training. If the gradient is producing coalesced vectors, we can alleviate this problem by adding a preprocessing step to coalesce() which tests if the input is already coalesced, and bugs out in that case. However, I think this is out of scope for this particular ticket for now.


Question: auto num_threads = leaked->get_thread_count(); // NOLINTNEXTLINE(modernize-make-unique) threadpool.reset(new PThreadPool(num_threads)); <del> TORCH_WARN("Leaking Caffe2 thread-pool after fork."); </del> } } return threadpool.get();

When numworker 0 (in DataLoader), I call setnum_threads function and get some warnings. Execute the following script: got log: there should be no any warnings. PyTorch Version (e.g., 1.0): torch1.9 OS (e.g., Linux): Centos7 How you installed PyTorch (, , source): pip Build command you used (if compiling from source): no Python version: 3.8 CUDA/cuDNN version: 11.1/ GPU models and configuration: TeslaV100 Any other relevant information:
Duplicate of .
closing as dupplicate


Question: from numbers import Integral import warnings import math <ins> from operator import mul from functools import reduce </ins> import torch from torch._C import _infer_size

Right now it makes everything .
To be clear, for a tensor, the problem is only when all of N, H, and W are 1. (So BatchNorm2d on batch size of 1 is OK as long as you don't have a 1x1 image). What's the desired behavior? The only reasonable behavior I can think of is: Raise an exception when the dimensions of which you are normalizing are one or Output zero (+ optional affine transform) I'm not sure the outputing zero is a good idea. I can't think of a case where that's what you want.


Question: #include <TH/TH.h> #include <libshm.h> #include "THP.h" <ins> #include "byte_order.h" </ins> #include "generic/Storage.cpp" #include <TH/THGenerateAllTypes.h> #include "generic/StorageCopy.cpp" #include <TH/THGenerateAllTypes.h>

<!-- A clear and concise description of what the bug is. --The target name is used by a test executable in mkldnn. Steps to reproduce the behavior: BUILDTEST=1 build <!-- If you have a code sample, error messages, stack traces, please provide it here as well --<!-- A clear and concise description of what you expected to happen. --CMake configure passes. Please copy and paste the output from our (or fill out the checklist below manually). You can get the script and run it with: PyTorch Version (e.g., 1.0): v1.5.0-rc2 OS (e.g., Linux): Windows How you installed PyTorch (, , source): source Build command you used (if compiling from source): python build Python version: 3.x CUDA/cuDNN version: 9.2 / 10.1 / 10.2 / NA GPU models and configuration: Tesla M60 Any other relevant information: <!-- Add any other context about the problem here. --We should not build tests for mkldnn.
I have encountered the same error, how do I resolve it?
It is actually mkldnn that is out of sync. So running the following script should help.
Thanks a lot for this I posted this on the PyTorch Discussions but to no avail, and now I've finally understood the reason of this error. Thanks a lot. Surprisingly, for me the build works out if I build from the master repo, but changing to a different version always fails.


Question: upstream="$1" pr="$2" git diff --name-only "$upstream" "$pr" <del> git diff --name-only "$upstream" "$pr" | grep -Eq '^(CMakeLists.txt|Makefile|.gitmodules|.jenkins/caffe2|binaries|caffe|caffe2|cmake|conda|docker|docs/caffe2|modules|scripts|third_party)' </del> <ins> # For safety, unconditionally trigger for any changes. #git diff --name-only "$upstream" "$pr" | grep -Eq '^(CMakeLists.txt|Makefile|.gitmodules|.jenkins/caffe2|binaries|caffe|caffe2|cmake|conda|docker|docs/caffe2|modules|scripts|third_party)' </ins>

This is most obvious by observing binary sizes, for example on pypi: (6.0 MB ) (33.8 MB ) Also, from the build log it's clear that 3.8 for some reason build with flag: CI cc
Which is a good old

Einsum currently modifies variables in-place (without an explicit indication that it does so), which prevents pytorch from automatically backpropagating. Results in the following runtime error: Demonstration and discussion can also be found . PyTorch or Caffe2: PyTorch How you installed PyTorch (conda, pip, source): pip OS: PyTorch version: 0.4.0 Python version: 3.6.1
Oops. Thank you for reporting and the minimal example. I'll see to get that fixed.
Saw the same issue over here. Thank you !
Is cloning the tensor before passing to einsum a valid workaround?
Yes, but a somewhat expensive one. If you have the ability to recompile, you could also apply the PR fixing this. Somehow it seems to be stuck in the review queue because it hit an unrelated CI problem...
Okay so how to use it then?
Just get a recent enough master and it will work.


Question: void evaluate_function(FunctionTask& task); ReadyQueue& ready_queue(int device); void start_threads(); <del> virtual void thread_main(std::shared_ptr<ReadyQueue> queue); </del> <ins> virtual void thread_main(std::shared_ptr<ReadyQueue> queue, int device); </ins> virtual void thread_on_exception(FunctionTask& task, std::exception& e); std::once_flag start_threads_flag;

Consider following code, and run it with multi gpus (e.g. 4): It will output: That is, the default device would always be zero even in DataParallel. My pytorch version is 0.1.122. I think this is not the desired behavior. It would cause some troubles. I tried to insert my own cuda kernel into backward to calculate the gradients, it become very slow, and I fixed it by (grad.getdevice()). Anyway, I think currentdevice in forward and backward should be the same, or could anyone explain to me why they are different?
this seems like something we should fix: ?
<!-- drci-comment-start --:pagefacingup: Preview :pagefacingup: Preview :question: Need help or want to give feedback on the CI? Visit our Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. <!-- drci-comment-end --


Question: GCC version: {gcc_version} Clang version: {clang_version} CMake version: {cmake_version} <ins> Libc version: {libc_version} </ins> Python version: {python_version} <ins> Python platform: {python_platform} </ins> Is CUDA available: {is_cuda_available} CUDA runtime version: {cuda_runtime_version} GPU models and configuration: {nvidia_gpu_models}

TensorPipe uses some advanced features of the Linux kernel. It does so on a "best effort" basis (i.e., use them if available, fall back on something else if not). This logic is unfortunately hard to test because it would require specific kernel versions on our CI machines. So it occasionally happens that we find out about issues when users report them. To help investigate these reports we've found it useful to know the kernel version and the glibc version used by the user (both when building and when running, if they're different). It would be great if these could be to the report produced by collect_env.
CC


Question: DESTINATION "${TH_INSTALL_BIN_SUBDIR}") ENDMACRO(Install_Required_Library libname) <del> IF (BLAS_FOUND AND BLAS_INSTALL_LIBRARIES) IF (BLAS_goto2_LIBRARY) Install_Required_Library(${BLAS_goto2_LIBRARY}) Install_Required_Library("${libpath}/libgfortran") Install_Required_Library("${libpath}/libquadmath") Install_Required_Library("${libpath}/libgcc") </del> <ins> FIND_PACKAGE(BLAS) IF(BLAS_FOUND) SET(USE_BLAS 1) IF(BLAS_INFO STREQUAL "mkl") ADD_DEFINITIONS(-DTH_BLAS_MKL) </ins> ENDIF() <del> IF (BLAS_openblas_LIBRARY) Install_Required_Library(${BLAS_openblas_LIBRARY}) Install_Required_Library("${libpath}/libquadmath") Install_Required_Library("${libpath}/libgfortran") Install_Required_Library("${libpath}/libgcc") ENDIF() ENDIF() </del> <ins> ENDIF(BLAS_FOUND) </ins> FIND_PACKAGE(LAPACK) IF(LAPACK_FOUND)

currently compiled master does not use any blas for any ops and uses our lame fallback C code. I'm looking into it. Basically USE_BLAS is not being set in


Question: else: self.gradInput = self.gradInput if not wasTable else input.clone() for i, module in enumerate(self.modules): <del> currentGradInput = getattr(module, method)(input, gradOutput[i], scale) </del> <ins> if method == 'updateGradInput': currentGradInput = module.updateGradInput(input, gradOutput[i]) elif method == 'backward': currentGradInput = module.backward(input, gradOutput[i], scale) </ins> if i == 0: self.gradInput.resize_as_(currentGradInput).copy_(currentGradInput) else:

Subclassing torch.Tensor with fails due to a on the latest nightly builds, whereas it previously worked without issue. Run this snippet of code: And you'll recieve an error message like this: Changing the to results in the exact same error message. There should be no error message as it should be working like it was previously in Torch 1.8.1 and below. I think that the issue started on Torch version: , and I can confirm that it still exists as of , . The issue started on the nightly builds at least 2 days ago, if that helps resolve things. It's been causing some of Captum's CircleCI tests to fail, and the tests show the first occurrence of the error on . cc
This is due to either or
I think the problem is I'm not supposed to delete because that means the super() call doesn't work. Instead, I should just verify that the passed in class is a subclass, then this should work.


Question: from contextlib import contextmanager import torch <ins> import torch.cuda </ins> import torch.distributed as dist from common import TestCase

is causing a crash when we try to build pytorch. Crash looks like this: (all times in US/West) Our 7AM, 8AM builds and earlier were all fine but 9AM, 10AM, 11AM builds all crashed with that same traceback. The new import was in which I think went in between 8AM and 9AM today See command below: See here if needed for : <!-- A clear and concise description of what you expected to happen. --Please copy and paste the output from our (or fill out the checklist below manually). You can get the script and run it with: PyTorch Version (e.g., 1.0): building from master OS (e.g., Linux): linux How you installed PyTorch (, , source): source Build command you used (if compiling from source): see above under 'reproduce' Python version: 3.6
maybe easier to read for build command used:
please try in the CircleCi environment?
in our build script seems to have fixed this. Thanks !


Question: [13, 14, 15, 16], [17, 18, 19, 20], ]) <del> exp_v = self.ValueTensor([7, 14, 14, 3, 20]) </del> <ins> exp_v = self.ValueTensor([7, 14, 3, 20]) </ins> res = dense._sparse_mask(x) expected = self.SparseTensor(i, exp_v, torch.Size([5, 4])) self.assertEqual(res, expected)

and I talked about the intended semantics of sparsemask when given a sparse tensor as an argument, and we came to the following conclusions: with an uncoalesced sparse tensor does not make sense, full stop. Unlike values, where your update might be linear and work correctly on an uncoalesced sparse tensor, there isn't any good reason why you want to pluck out values from the dense tensor multiple times, it is basically always a bug. the (eventual) documentation for sparsemask, we will recommend calling coalesce before doing any operations involving sparsemask (or nonlinear updates to indices/values). should add a test to sparsemask which checks if the flag of the input tensor is true, and raise an error if it is not. This is a cheap safety check which will prevent people from forgetting to call coalesce (as in (2)). There is a performance consequence to calling coalesce every iteration of training. If the gradient is producing coalesced vectors, we can alleviate this problem by adding a preprocessing step to coalesce() which tests if the input is already coalesced, and bugs out in that case. However, I think this is out of scope for this particular ticket for now.


Question: return new_var; } <ins> const char* ERR_BACKWARD_TWICE = "Trying to backward through the graph a second time, but the buffers have " "already been freed. Specify retain_variables=True when calling backward " "the first time."; </ins> }} // namespace torch::autograd

Usually calling backwards twice gives this message: But conv2d just segfaults. $ pt A B Segmentation fault (core dumped)


Question: } // Replace with nonzeros auto nonzero = index.nonzero(); <del> for (int64_t j = 0; j < nonzero.size(1); j++) { result.emplace_back(nonzero.select(1, j)); </del> <ins> auto is_empty = nonzero.numel() == 0; for (int64_t j = 0; j < index.dim(); j++) { if (is_empty) { // We can't call select on an empty tensor so we just create an empty // tensor. result.emplace_back(nonzero.type().tensor()); } else { result.emplace_back(nonzero.select(1, j)); } </ins> } } else { result.emplace_back(index);

In PyTorch master 0.4 , variables cannot be indexed. This used to work in PyTorch 0.2 :
This is breaking some of Pyro's inference algorithms on PyTorch master:


Question: idx = Variable(torch.LongTensor()) self.assertEqual(x[idx].numel(), 0) <ins> # empty assignment should have no effect but not throw an exception y = x.clone() y[idx] = -1 self.assertEqual(x, y) mask = torch.zeros(4, 3).byte() y[mask] = -1 self.assertEqual(x, y) </ins> def test_basic_advanced_combined(self): # From the NumPy indexing example x = Variable(torch.arange(0, 12).view(4, 3))

odd difference between cuda Tensor and Variable: encountered in torch.distributions.Categorical, built yesterday from master
related to hmm, here's the issue is for variables, so probably not (immediately) related
different code path but similar issue
This is a regression from the latest 0.3 binaries, which don't have this error.


Question: assert_strict_equal(zc, z) <del> def index_variable(num_indices, max_indices): index = torch.randperm(max_indices)[:num_indices].long() </del> <ins> def index_variable(shape, max_indices): if not isinstance(shape, tuple): shape = (shape,) index = torch.rand(*shape).mul_(max_indices).floor_().long() return Variable(index, requires_grad=False) def gather_variable(shape, index_dim, max_indices): assert len(shape) == 2 assert index_dim < 2 batch_dim = 1 - index_dim index = torch.LongTensor(*shape) for i in range(shape[index_dim]): index.select(index_dim, i).copy_( torch.randperm(max_indices)[:shape[batch_dim]]) </ins> return Variable(index, requires_grad=False)

<!-- A clear and concise description of what content in is an issue. If this has to do with the general website, please file an issue at instead. If this has to do with , please file an issue at --In the getting started section section the following quote appears: I guess this is from previous versions where CUDA support was not built-in and this can be removed, correct? cc
This seems to be easy fixable docs issue
If gets merged this is fixed.
Thanks for the PR Just merged it.


Question: result = x[rows[:, None], columns] self.assertEqual(result.data.tolist(), [[0, 2], [9, 11]]) <ins> def test_empty_index(self): x = Variable(torch.arange(0, 12).view(4, 3)) idx = Variable(torch.LongTensor()) self.assertEqual(x[idx].numel(), 0) </ins> def test_basic_advanced_combined(self): # From the NumPy indexing example x = Variable(torch.arange(0, 12).view(4, 3))

In PyTorch master 0.4 , variables cannot be indexed. This used to work in PyTorch 0.2 :
This is breaking some of Pyro's inference algorithms on PyTorch master:


Question: def forward(ctx, input, grid, padding_mode='zeros'): ctx.save_for_backward(input, grid) <ins> if input.device != grid.device: raise RuntimeError(("input (device {}) and grid (device {}) must be on the same device" + "for grid_sampler").format(input.device, grid.device)) </ins> if padding_mode == 'zeros': ctx.padding_mode = MODE_ZEROS elif padding_mode == 'border':

yields irrelevant errors when passing wrong arguments First one: Second one: PyTorch or Caffe2: pytorch 0.4 How you installed PyTorch (conda, pip, source): pip Build command you used (if compiling from source): OS: ubuntu16.04 PyTorch version: 0.4 Python version: 3.6 CUDA/cuDNN version: GPU models and configuration: 1080 GCC version (if compiling from source): CMake version: Versions of any other relevant libraries:
Thank you for the report! I'll move them to the new check for same GPU (which includes reasonable CPU vs. GPU reporting).
In PyTorch master, the error message has already improved for the second case:
I am getting exactly the first error reported: and I don't understand what is the problem. Can someone help on this?
if you use PyTorch v0.4.1, you should get a better error message helping you on what's wrong.
Thanks for your reply I found out that the problem was the hidden state in my recurrent net, I did not use the .cuda()


Question: IF(MSVC) # we want to respect the standard, and we are bored of those **** . ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE=1) <del> LIST(APPEND CUDA_NVCC_FLAGS "-Xcompiler /wd4819 -Xcompiler /wd4503") </del> <ins> LIST(APPEND CUDA_NVCC_FLAGS "-Xcompiler /wd4819 -Xcompiler /wd4503 -Xcompiler /wd4190 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4275 -Xcompiler /wd4522") </ins> ADD_DEFINITIONS(-DTH_EXPORTS) IF (NOT NO_CUDA) ADD_DEFINITIONS(-DTHC_EXPORTS)

That's pretty big! In contrast, an OS X build log is only 1.3M. Is there a reason they have to be this big? CC
My guess is that it's because of warnings. I remember having to get through thousands of them when looking for the error that failed the build.
Yes, the major part of them are warnings. And some of them is not fixable. We can hide them using some flags on the compilers.
And this build configuration actually contains both the CPU and GPU build, which may also be a possible reason.
The reduced log size after PR is about 1.2M.


Question: } if (k == 3) { <del> if (should_compute_output(0)) { grad_input = view3d(*grad_input); </del> <ins> if (grad_input) { grad_input = view3d(*grad_input); } if (grad_weight) { grad_weight = view3d(*grad_weight); </ins> } <del> grad_weight = view3d(*grad_weight); </del> } auto outputs =  as_tensor_list(std::move(grad_input),

I have a network defined as: --. In this particular case, I want to keep the two conv layer weights fixed, and only adapt the middle layer weights. In the code below I have three ways of defining the conv layers parameters, one with buffers, one with parameters that have , and one with regular parameters (which doesn't keep the weights fixed, but I'm using it as a reference). If I use the first two definitions (commented out in the code below), when I call it results in a kernel crash. If I use the third definition, it works fine albeit without maintaining fixed weights. In order to apply the linear layer I reshape the output and inputs, and I believe the crash stems from somewhere there (on a side note: Is this the right way to apply a linear layer on a time sequence?)
Looks like the problem is with . If I reimplement this network using 2D convolutions with unit widths it works fine.