# Source code for tensorplay.functional Source: https://www.tensorplay.cn/docs/_modules/tensorplay/functional.html ``` # Generated by tools/codegen/main.py -- Do not edit directly import builtins import tensorplay import tensorplay._C as _C from tensorplay._C import DType import tensorplay.graph as _graph from tensorplay.graph import capture_call as _capture_call _capturing = _graph.capturing def _ensure_device(device): # None stays None so the C++ factory layer resolves it against # only spellings the bindings cannot parse are normalized here. if device is None or device is Ellipsis: return None if isinstance(device, str): return tensorplay.device(device) return device _MISSING = object() def _traced_values(): # Whether a value-level trace is recording. A compile trace writes what a # call does, so a call whose eager contract is a Python scalar is written # through the tensor operations it stands for: a traced region hands back # memory, and the caller reads the zero-dim tensor it produced. from tensorplay.graph.experimental.proxy_tensor import get_proxy_mode return get_proxy_mode() is not None def _as_left_operand(value, other): # A plain-number left operand joins the right operand's device when one # is given, so reflected calls stay on the tensor's device. if isinstance(other, tensorplay.Tensor): return tensorplay.as_tensor(value, device=other.device) return tensorplay.as_tensor(value) def _draw_bounds(fn, args, low, high, rest): # A bounded draw is spelled (high, *rest) with low = 0, or as # (low, high, *rest); keywords fill the slots the positionals leave open. named = {'low': low, 'high': high} named.update(rest) shapes = (('high',) + tuple(rest), ('low', 'high') + tuple(rest)) for slots in shapes: if len(args) > len(slots) or (low is not _MISSING and 'low' not in slots): continue values = dict(zip(slots, args)) if builtins.any(named[n] is not _MISSING for n in values): continue for n in slots[len(args):]: values[n] = named[n] if builtins.any(v is _MISSING for v in values.values()): continue return (values.get('low', 0), values['high']) + tuple(values[n] for n in rest) raise TypeError(fn + '() takes ' + ' or '.join( '(' + ', '.join(slots) + ')' for slots in shapes)) [docs] def embedding(weight, indices, padding_idx=-1, scale_grad_by_freq=False, sparse=False): if _capturing(): _captured = _capture_call(embedding, (weight, indices, padding_idx, scale_grad_by_freq, sparse), {}) if _captured is not None: return _captured return _C.embedding(weight, indices, padding_idx, scale_grad_by_freq, sparse) def embedding_dense_backward(grad_output, indices, num_weights, padding_idx, scale_grad_by_freq): if _capturing(): _captured = _capture_call(embedding_dense_backward, (grad_output, indices, num_weights, padding_idx, scale_grad_by_freq), {}) if _captured is not None: return _captured return _C.embedding_dense_backward(grad_output, indices, num_weights, padding_idx, scale_grad_by_freq) def _embedding_bag(weight, indices, offsets, scale_grad_by_freq=False, mode=0, sparse=False, per_sample_weights=None, include_last_offset=False, padding_idx=-1): if _capturing(): _captured = _capture_call(_embedding_bag, (weight, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights, include_last_offset, padding_idx), {}) if _captured is not None: return _captured return _C._embedding_bag(weight, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights, include_last_offset, padding_idx) def _embedding_bag_forward_only(weight, indices, offsets, scale_grad_by_freq=False, mode=0, sparse=False, per_sample_weights=None, include_last_offset=False, padding_idx=-1): if _capturing(): _captured = _capture_call(_embedding_bag_forward_only, (weight, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights, include_last_offset, padding_idx), {}) if _captured is not None: return _captured return _C._embedding_bag_forward_only(weight, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights, include_last_offset, padding_idx) def _embedding_bag_dense_backward(grad_output, indices, offset2bag, bag_size, maximum_indices, num_weights, scale_grad_by_freq, mode, per_sample_weights=None, padding_idx=-1): if _capturing(): _captured = _capture_call(_embedding_bag_dense_backward, (grad_output, indices, offset2bag, bag_size, maximum_indices, num_weights, scale_grad_by_freq, mode, per_sample_weights, padding_idx), {}) if _captured is not None: return _captured return _C._embedding_bag_dense_backward(grad_output, indices, offset2bag, bag_size, maximum_indices, num_weights, scale_grad_by_freq, mode, per_sample_weights, padding_idx) def _embedding_bag_per_sample_weights_backward(grad_output, weight, indices, offsets, offset2bag, mode, padding_idx=-1): if _capturing(): _captured = _capture_call(_embedding_bag_per_sample_weights_backward, (grad_output, weight, indices, offsets, offset2bag, mode, padding_idx), {}) if _captured is not None: return _captured return _C._embedding_bag_per_sample_weights_backward(grad_output, weight, indices, offsets, offset2bag, mode, padding_idx) [docs] def convolution(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups): if _capturing(): _captured = _capture_call(convolution, (input, weight, bias, stride, padding, dilation, transposed, output_padding, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] return _C.convolution(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups) def convolution_backward(grad_output, input, weight, bias_sizes, stride, padding, dilation, transposed, output_padding, groups, output_mask): if _capturing(): _captured = _capture_call(convolution_backward, (grad_output, input, weight, bias_sizes, stride, padding, dilation, transposed, output_padding, groups, output_mask), {}) if _captured is not None: return _captured if isinstance(bias_sizes, int) and not isinstance(bias_sizes, bool): bias_sizes = [bias_sizes] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] return _C.convolution_backward(grad_output, input, weight, bias_sizes, stride, padding, dilation, transposed, output_padding, groups, output_mask) [docs] def convolution_overrideable(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups): if _capturing(): _captured = _capture_call(convolution_overrideable, (input, weight, bias, stride, padding, dilation, transposed, output_padding, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] return _C.convolution_overrideable(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups) [docs] def convolution_backward_overrideable(grad_output, input, weight, stride, padding, dilation, transposed, output_padding, groups, output_mask): if _capturing(): _captured = _capture_call(convolution_backward_overrideable, (grad_output, input, weight, stride, padding, dilation, transposed, output_padding, groups, output_mask), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] return _C.convolution_backward_overrideable(grad_output, input, weight, stride, padding, dilation, transposed, output_padding, groups, output_mask) [docs] def conv1d(input, weight, bias=None, stride=([1]), padding=([0]), dilation=([1]), groups=1): if _capturing(): _captured = _capture_call(conv1d, (input, weight, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv1d(input, weight, bias, stride, padding, dilation, groups) [docs] def conv1d_grad_input(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv1d_grad_input, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv1d_grad_input(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv1d_grad_weight(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv1d_grad_weight, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv1d_grad_weight(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv1d_grad_bias(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv1d_grad_bias, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv1d_grad_bias(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv2d(input, weight, bias=None, stride=([1, 1]), padding=([0, 0]), dilation=([1, 1]), groups=1): if _capturing(): _captured = _capture_call(conv2d, (input, weight, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv2d(input, weight, bias, stride, padding, dilation, groups) [docs] def conv2d_relu(input, weight, bias=None, stride=([1, 1]), padding=([0, 0]), dilation=([1, 1]), groups=1): if _capturing(): _captured = _capture_call(conv2d_relu, (input, weight, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv2d_relu(input, weight, bias, stride, padding, dilation, groups) [docs] def add_relu(input, other): if _capturing(): _captured = _capture_call(add_relu, (input, other), {}) if _captured is not None: return _captured return _C.add_relu(input, other) [docs] def conv2d_grad_input(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv2d_grad_input, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv2d_grad_input(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv2d_grad_weight(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv2d_grad_weight, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv2d_grad_weight(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv2d_grad_bias(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv2d_grad_bias, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv2d_grad_bias(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv3d(input, weight, bias=None, stride=([1, 1, 1]), padding=([0, 0, 0]), dilation=([1, 1, 1]), groups=1): if _capturing(): _captured = _capture_call(conv3d, (input, weight, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv3d(input, weight, bias, stride, padding, dilation, groups) [docs] def conv3d_grad_input(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv3d_grad_input, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv3d_grad_input(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv3d_grad_weight(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv3d_grad_weight, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv3d_grad_weight(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv3d_grad_bias(grad_output, input, weight, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(conv3d_grad_bias, (grad_output, input, weight, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv3d_grad_bias(grad_output, input, weight, stride, padding, dilation, groups) [docs] def conv_transpose2d(input, weight, bias=None, stride=([1, 1]), padding=([0, 0]), output_padding=([0, 0]), groups=1, dilation=([1, 1])): if _capturing(): _captured = _capture_call(conv_transpose2d, (input, weight, bias, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose2d(input, weight, bias, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose2d_grad_input(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose2d_grad_input, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose2d_grad_input(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose2d_grad_weight(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose2d_grad_weight, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose2d_grad_weight(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose2d_grad_bias(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose2d_grad_bias, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose2d_grad_bias(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose3d(input, weight, bias=None, stride=([1, 1, 1]), padding=([0, 0, 0]), output_padding=([0, 0, 0]), groups=1, dilation=([1, 1, 1])): if _capturing(): _captured = _capture_call(conv_transpose3d, (input, weight, bias, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose3d(input, weight, bias, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose3d_grad_input(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose3d_grad_input, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose3d_grad_input(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def constant_pad_nd(input, pad, value): if _capturing(): _captured = _capture_call(constant_pad_nd, (input, pad, value), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] if not isinstance(value, (tensorplay.Scalar, tensorplay.Tensor)): value = tensorplay.Scalar(value) return _C.constant_pad_nd(input, pad, value) def constant_pad_nd_backward(grad_output, pad): if _capturing(): _captured = _capture_call(constant_pad_nd_backward, (grad_output, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.constant_pad_nd_backward(grad_output, pad) [docs] def conv_transpose3d_grad_weight(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose3d_grad_weight, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose3d_grad_weight(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose3d_grad_bias(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose3d_grad_bias, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose3d_grad_bias(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def add(input, other, *, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(add, (input, other), {'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C.add(input, other, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(add, (input, other), {'alpha': alpha}) if _captured is not None: return _captured return _C.add(input, other, alpha=alpha) [docs] def add_(input, other, alpha=1): return input.add_(other=other, alpha=alpha) [docs] def sub(input, other, alpha=1): if _capturing(): _captured = _capture_call(sub, (input, other, alpha), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.sub(other=other, alpha=alpha) [docs] def sub_(input, other, alpha=1): return input.sub_(other=other, alpha=alpha) [docs] def mul(input, other): if _capturing(): _captured = _capture_call(mul, (input, other), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.mul(other=other) [docs] def mul_(input, other): return input.mul_(other=other) [docs] def div(input, other, rounding_mode=None): if _capturing(): _captured = _capture_call(div, (input, other), {'rounding_mode': rounding_mode}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) if rounding_mode is None: return input.div(other=other) return input.div(other=other, rounding_mode=rounding_mode) [docs] def divide(input, other, rounding_mode=None): if _capturing(): _captured = _capture_call(divide, (input, other), {'rounding_mode': rounding_mode}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) if rounding_mode is None: return input.divide(other=other) return input.divide(other=other, rounding_mode=rounding_mode) [docs] def true_divide(input, other): if _capturing(): _captured = _capture_call(true_divide, (input, other), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.true_divide(other=other) [docs] def floor_divide(input, other): if _capturing(): _captured = _capture_call(floor_divide, (input, other), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.floor_divide(other=other) [docs] def multiply(input, other): if _capturing(): _captured = _capture_call(multiply, (input, other), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.multiply(other=other) [docs] def subtract(input, other, alpha=1): if _capturing(): _captured = _capture_call(subtract, (input, other, alpha), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.subtract(other=other, alpha=alpha) [docs] def remainder(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(remainder, (input, other), {'out': out}) if _captured is not None: return _captured return _C.remainder(input, other, out=out) if _capturing(): _captured = _capture_call(remainder, (input, other), {}) if _captured is not None: return _captured return _C.remainder(input, other) [docs] def fmod(input, other): if _capturing(): _captured = _capture_call(fmod, (input, other), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.fmod(other=other) [docs] def copysign(input, other): if _capturing(): _captured = _capture_call(copysign, (input, other), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) return input.copysign(other=other) [docs] def clamp_min(input, min): if _capturing(): _captured = _capture_call(clamp_min, (input, min), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, min) return input.clamp_min(min=min) [docs] def clamp_max(input, max): if _capturing(): _captured = _capture_call(clamp_max, (input, max), {}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, max) return input.clamp_max(max=max) [docs] def rsub(input, other, alpha=1): if _capturing(): _captured = _capture_call(rsub, (input, other, alpha), {}) if _captured is not None: return _captured if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C.rsub(input, other, alpha=alpha) [docs] def fused_mul_add(input, other, addend): if _capturing(): _captured = _capture_call(fused_mul_add, (input, other, addend), {}) if _captured is not None: return _captured return _C.fused_mul_add(input, other, addend) def _foreach_sgd(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sgd, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sgd(input, *args, **kwargs) def _foreach_adam(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_adam, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_adam(input, *args, **kwargs) def _amp_foreach_non_finite_check_and_unscale_(input, found_inf, inv_scale): if _capturing(): _captured = _capture_call(_amp_foreach_non_finite_check_and_unscale_, (input, found_inf, inv_scale), {}) if _captured is not None: return _captured return _C._amp_foreach_non_finite_check_and_unscale_(input, found_inf, inv_scale) def _amp_update_scale_(input, growth_tracker, found_inf, growth_factor, backoff_factor, growth_interval): if _capturing(): _captured = _capture_call(_amp_update_scale_, (input, growth_tracker, found_inf, growth_factor, backoff_factor, growth_interval), {}) if _captured is not None: return _captured return _C._amp_update_scale_(input, growth_tracker, found_inf, growth_factor, backoff_factor, growth_interval) def _fused_adam_(input, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps, lr, beta1, beta2, weight_decay, eps, amsgrad, maximize, grad_scale=None, found_inf=None, exact=False): if _capturing(): _captured = _capture_call(_fused_adam_, (input, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps, lr, beta1, beta2, weight_decay, eps, amsgrad, maximize, grad_scale, found_inf, exact), {}) if _captured is not None: return _captured return _C._fused_adam_(input, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps, lr=lr, beta1=beta1, beta2=beta2, weight_decay=weight_decay, eps=eps, amsgrad=amsgrad, maximize=maximize, grad_scale=grad_scale, found_inf=found_inf, exact=exact) def _fused_adamw_(input, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps, lr, beta1, beta2, weight_decay, eps, amsgrad, maximize, grad_scale=None, found_inf=None, exact=False): if _capturing(): _captured = _capture_call(_fused_adamw_, (input, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps, lr, beta1, beta2, weight_decay, eps, amsgrad, maximize, grad_scale, found_inf, exact), {}) if _captured is not None: return _captured return _C._fused_adamw_(input, grads, exp_avgs, exp_avg_sqs, max_exp_avg_sqs, state_steps, lr=lr, beta1=beta1, beta2=beta2, weight_decay=weight_decay, eps=eps, amsgrad=amsgrad, maximize=maximize, grad_scale=grad_scale, found_inf=found_inf, exact=exact) def _fused_sgd_(input, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale=None, found_inf=None): if _capturing(): _captured = _capture_call(_fused_sgd_, (input, grads, momentum_buffer_list, weight_decay, momentum, lr, dampening, nesterov, maximize, is_first_step, grad_scale, found_inf), {}) if _captured is not None: return _captured return _C._fused_sgd_(input, grads, momentum_buffer_list, weight_decay=weight_decay, momentum=momentum, lr=lr, dampening=dampening, nesterov=nesterov, maximize=maximize, is_first_step=is_first_step, grad_scale=grad_scale, found_inf=found_inf) def _fused_adagrad_(input, grads, state_sums, state_steps, lr, lr_decay, weight_decay, eps, maximize, grad_scale=None, found_inf=None): if _capturing(): _captured = _capture_call(_fused_adagrad_, (input, grads, state_sums, state_steps, lr, lr_decay, weight_decay, eps, maximize, grad_scale, found_inf), {}) if _captured is not None: return _captured return _C._fused_adagrad_(input, grads, state_sums, state_steps, lr=lr, lr_decay=lr_decay, weight_decay=weight_decay, eps=eps, maximize=maximize, grad_scale=grad_scale, found_inf=found_inf) def _fused_rmsprop_(input, grads, square_avgs, grad_avgs, momentum_buffer_list, state_steps, lr, alpha, eps, weight_decay, momentum, centered, maximize): if _capturing(): _captured = _capture_call(_fused_rmsprop_, (input, grads, square_avgs, grad_avgs, momentum_buffer_list, state_steps, lr, alpha, eps, weight_decay, momentum, centered, maximize), {}) if _captured is not None: return _captured return _C._fused_rmsprop_(input, grads, square_avgs, grad_avgs, momentum_buffer_list, state_steps, lr=lr, alpha=alpha, eps=eps, weight_decay=weight_decay, momentum=momentum, centered=centered, maximize=maximize) def _fused_adadelta_(input, grads, square_avgs, acc_deltas, state_steps, lr, rho, eps, weight_decay, maximize): if _capturing(): _captured = _capture_call(_fused_adadelta_, (input, grads, square_avgs, acc_deltas, state_steps, lr, rho, eps, weight_decay, maximize), {}) if _captured is not None: return _captured return _C._fused_adadelta_(input, grads, square_avgs, acc_deltas, state_steps, lr=lr, rho=rho, eps=eps, weight_decay=weight_decay, maximize=maximize) def _fused_adamax_(input, grads, exp_avgs, exp_infs, state_steps, lr, beta1, beta2, eps, weight_decay, maximize): if _capturing(): _captured = _capture_call(_fused_adamax_, (input, grads, exp_avgs, exp_infs, state_steps, lr, beta1, beta2, eps, weight_decay, maximize), {}) if _captured is not None: return _captured return _C._fused_adamax_(input, grads, exp_avgs, exp_infs, state_steps, lr=lr, beta1=beta1, beta2=beta2, eps=eps, weight_decay=weight_decay, maximize=maximize) def _fused_asgd_(input, grads, axs, mus, etas, state_steps, lr, lambd, t0, alpha, weight_decay, maximize): if _capturing(): _captured = _capture_call(_fused_asgd_, (input, grads, axs, mus, etas, state_steps, lr, lambd, t0, alpha, weight_decay, maximize), {}) if _captured is not None: return _captured return _C._fused_asgd_(input, grads, axs, mus, etas, state_steps, lr=lr, lambd=lambd, t0=t0, alpha=alpha, weight_decay=weight_decay, maximize=maximize) def _fused_rprop_(input, grads, prevs, step_sizes, state_steps, step_size_min, step_size_max, etaminus, etaplus, maximize): if _capturing(): _captured = _capture_call(_fused_rprop_, (input, grads, prevs, step_sizes, state_steps, step_size_min, step_size_max, etaminus, etaplus, maximize), {}) if _captured is not None: return _captured return _C._fused_rprop_(input, grads, prevs, step_sizes, state_steps, step_size_min=step_size_min, step_size_max=step_size_max, etaminus=etaminus, etaplus=etaplus, maximize=maximize) def _fused_nadam_(input, grads, exp_avgs, exp_avg_sqs, mu_products, state_steps, lr, beta1, beta2, eps, weight_decay, momentum_decay, decoupled_weight_decay, maximize): if _capturing(): _captured = _capture_call(_fused_nadam_, (input, grads, exp_avgs, exp_avg_sqs, mu_products, state_steps, lr, beta1, beta2, eps, weight_decay, momentum_decay, decoupled_weight_decay, maximize), {}) if _captured is not None: return _captured return _C._fused_nadam_(input, grads, exp_avgs, exp_avg_sqs, mu_products, state_steps, lr=lr, beta1=beta1, beta2=beta2, eps=eps, weight_decay=weight_decay, momentum_decay=momentum_decay, decoupled_weight_decay=decoupled_weight_decay, maximize=maximize) def _fused_radam_(input, grads, exp_avgs, exp_avg_sqs, state_steps, lr, beta1, beta2, eps, weight_decay, decoupled_weight_decay, maximize): if _capturing(): _captured = _capture_call(_fused_radam_, (input, grads, exp_avgs, exp_avg_sqs, state_steps, lr, beta1, beta2, eps, weight_decay, decoupled_weight_decay, maximize), {}) if _captured is not None: return _captured return _C._fused_radam_(input, grads, exp_avgs, exp_avg_sqs, state_steps, lr=lr, beta1=beta1, beta2=beta2, eps=eps, weight_decay=weight_decay, decoupled_weight_decay=decoupled_weight_decay, maximize=maximize) def _fused_adafactor_(input, grads, variances, state_steps, lr, beta2_decay, eps1, eps2, d, weight_decay, maximize): if _capturing(): _captured = _capture_call(_fused_adafactor_, (input, grads, variances, state_steps, lr, beta2_decay, eps1, eps2, d, weight_decay, maximize), {}) if _captured is not None: return _captured return _C._fused_adafactor_(input, grads, variances, state_steps, lr=lr, beta2_decay=beta2_decay, eps1=eps1, eps2=eps2, d=d, weight_decay=weight_decay, maximize=maximize) def _fused_adafactor_factored_(input, grads, row_vars, col_vars, state_steps, lr, beta2_decay, eps1, eps2, d, weight_decay, maximize): if _capturing(): _captured = _capture_call(_fused_adafactor_factored_, (input, grads, row_vars, col_vars, state_steps, lr, beta2_decay, eps1, eps2, d, weight_decay, maximize), {}) if _captured is not None: return _captured return _C._fused_adafactor_factored_(input, grads, row_vars, col_vars, state_steps, lr=lr, beta2_decay=beta2_decay, eps1=eps1, eps2=eps2, d=d, weight_decay=weight_decay, maximize=maximize) def _foreach_add(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_add, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_add(input, *args, **kwargs) def _foreach_add_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_add_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_add_(input, *args, **kwargs) def _foreach_sub(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sub, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sub(input, *args, **kwargs) def _foreach_sub_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sub_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sub_(input, *args, **kwargs) def _foreach_mul(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_mul, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_mul(input, *args, **kwargs) def _foreach_mul_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_mul_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_mul_(input, *args, **kwargs) def _foreach_div(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_div, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_div(input, *args, **kwargs) def _foreach_div_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_div_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_div_(input, *args, **kwargs) def _foreach_addcmul(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_addcmul, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_addcmul(input, *args, **kwargs) def _foreach_addcmul_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_addcmul_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_addcmul_(input, *args, **kwargs) def _foreach_addcdiv(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_addcdiv, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_addcdiv(input, *args, **kwargs) def _foreach_addcdiv_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_addcdiv_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_addcdiv_(input, *args, **kwargs) def _foreach_lerp(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_lerp, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_lerp(input, *args, **kwargs) def _foreach_lerp_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_lerp_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_lerp_(input, *args, **kwargs) def _foreach_sqrt(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sqrt, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sqrt(input, *args, **kwargs) def _foreach_sqrt_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sqrt_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sqrt_(input, *args, **kwargs) def _foreach_rsqrt(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_rsqrt, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_rsqrt(input, *args, **kwargs) def _foreach_rsqrt_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_rsqrt_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_rsqrt_(input, *args, **kwargs) def _foreach_neg(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_neg, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_neg(input, *args, **kwargs) def _foreach_neg_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_neg_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_neg_(input, *args, **kwargs) def _foreach_abs(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_abs, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_abs(input, *args, **kwargs) def _foreach_abs_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_abs_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_abs_(input, *args, **kwargs) def _foreach_reciprocal(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_reciprocal, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_reciprocal(input, *args, **kwargs) def _foreach_reciprocal_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_reciprocal_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_reciprocal_(input, *args, **kwargs) def _foreach_sign(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sign, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sign(input, *args, **kwargs) def _foreach_sign_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sign_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sign_(input, *args, **kwargs) def _foreach_pow(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_pow, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_pow(input, *args, **kwargs) def _foreach_pow_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_pow_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_pow_(input, *args, **kwargs) def _foreach_clamp_min(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_clamp_min, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_clamp_min(input, *args, **kwargs) def _foreach_clamp_max(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_clamp_max, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_clamp_max(input, *args, **kwargs) def _foreach_clamp_min_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_clamp_min_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_clamp_min_(input, *args, **kwargs) def _foreach_clamp_max_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_clamp_max_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_clamp_max_(input, *args, **kwargs) def _foreach_maximum(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_maximum, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_maximum(input, *args, **kwargs) def _foreach_minimum(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_minimum, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_minimum(input, *args, **kwargs) def _foreach_maximum_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_maximum_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_maximum_(input, *args, **kwargs) def _foreach_minimum_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_minimum_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_minimum_(input, *args, **kwargs) def _foreach_copy_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_copy_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_copy_(input, *args, **kwargs) def _foreach_zero_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_zero_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_zero_(input, *args, **kwargs) [docs] def div_(input, other, rounding_mode=None): if _capturing(): _captured = _capture_call(div_, (input, other), {'rounding_mode': rounding_mode}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) if rounding_mode is None: return input.div_(other=other) return input.div_(other=other, rounding_mode=rounding_mode) [docs] def addcmul(input, tensor1, tensor2, *, value=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(addcmul, (input, tensor1, tensor2), {'value': value, 'out': out}) if _captured is not None: return _captured return _C.addcmul(self=input, tensor1=tensor1, tensor2=tensor2, value=value, out=out) if _capturing(): _captured = _capture_call(addcmul, (input, tensor1, tensor2), {'value': value}) if _captured is not None: return _captured return _C.addcmul(self=input, tensor1=tensor1, tensor2=tensor2, value=value) [docs] def addcmul_(input, tensor1, tensor2, value=1): return input.addcmul_(tensor1=tensor1, tensor2=tensor2, value=value) [docs] def addcdiv(input, tensor1, tensor2, *, value=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(addcdiv, (input, tensor1, tensor2), {'value': value, 'out': out}) if _captured is not None: return _captured return _C.addcdiv(self=input, tensor1=tensor1, tensor2=tensor2, value=value, out=out) if _capturing(): _captured = _capture_call(addcdiv, (input, tensor1, tensor2), {'value': value}) if _captured is not None: return _captured return _C.addcdiv(self=input, tensor1=tensor1, tensor2=tensor2, value=value) [docs] def addcdiv_(input, tensor1, tensor2, value=1): return input.addcdiv_(tensor1=tensor1, tensor2=tensor2, value=value) [docs] def where(condition, input=None, other=None): if _capturing(): _captured = _capture_call(where, (condition, input, other), {}) if _captured is not None: return _captured if input is None and other is None: # One-argument form: return a tuple of index tensors, # one per dimension, for the non-zero elements. return tuple(_C.where(condition)) _input_is_tensor = isinstance(input, tensorplay.Tensor) _other_is_tensor = isinstance(other, tensorplay.Tensor) if not _input_is_tensor: input = tensorplay.Scalar(input) if not _other_is_tensor: other = tensorplay.Scalar(other) return _C.where(condition=condition, self=input, other=other) [docs] def maximum(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(maximum, (input, other), {'out': out}) if _captured is not None: return _captured return _C.maximum(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(maximum, (input, other), {}) if _captured is not None: return _captured return _C.maximum(self=input, other=other) [docs] def minimum(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(minimum, (input, other), {'out': out}) if _captured is not None: return _captured return _C.minimum(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(minimum, (input, other), {}) if _captured is not None: return _captured return _C.minimum(self=input, other=other) [docs] def view_as_real(input): if _capturing(): _captured = _capture_call(view_as_real, (input,), {}) if _captured is not None: return _captured return _C.view_as_real(input) [docs] def view_as_complex(input): if _capturing(): _captured = _capture_call(view_as_complex, (input,), {}) if _captured is not None: return _captured return _C.view_as_complex(input) [docs] def is_complex(input): if _capturing(): _captured = _capture_call(is_complex, (input,), {}) if _captured is not None: return _captured return _C.is_complex(input) [docs] def mm(input, mat2): if _capturing(): _captured = _capture_call(mm, (input, mat2), {}) if _captured is not None: return _captured return _C.mm(input, mat2) [docs] def addmm(input, mat1, mat2, beta=1, alpha=1): if _capturing(): _captured = _capture_call(addmm, (input, mat1, mat2, beta, alpha), {}) if _captured is not None: return _captured return _C.addmm(input, mat1, mat2, beta=beta, alpha=alpha) [docs] def matmul(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(matmul, (input, other), {'out': out}) if _captured is not None: return _captured return _C.matmul(input, other, out=out) if _capturing(): _captured = _capture_call(matmul, (input, other), {}) if _captured is not None: return _captured return _C.matmul(input, other) [docs] def matmul_backward_self(grad_output, input, other): if _capturing(): _captured = _capture_call(matmul_backward_self, (grad_output, input, other), {}) if _captured is not None: return _captured return _C.matmul_backward_self(grad_output, input, other) [docs] def matmul_backward_other(grad_output, input, other): if _capturing(): _captured = _capture_call(matmul_backward_other, (grad_output, input, other), {}) if _captured is not None: return _captured return _C.matmul_backward_other(grad_output, input, other) [docs] def bmm(input, mat2, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(bmm, (input, mat2), {'out': out}) if _captured is not None: return _captured return _C.bmm(input, mat2, out=out) if _capturing(): _captured = _capture_call(bmm, (input, mat2), {}) if _captured is not None: return _captured return _C.bmm(input, mat2) [docs] def baddbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(baddbmm, (input, batch1, batch2), {'beta': beta, 'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C.baddbmm(input, batch1, batch2, beta=beta, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(baddbmm, (input, batch1, batch2), {'beta': beta, 'alpha': alpha}) if _captured is not None: return _captured return _C.baddbmm(input, batch1, batch2, beta=beta, alpha=alpha) [docs] def mv(input, vec, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(mv, (input, vec), {'out': out}) if _captured is not None: return _captured return _C.mv(self=input, vec=vec, out=out) if _capturing(): _captured = _capture_call(mv, (input, vec), {}) if _captured is not None: return _captured return _C.mv(self=input, vec=vec) [docs] def dot(input, tensor, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(dot, (input, tensor), {'out': out}) if _captured is not None: return _captured return _C.dot(self=input, tensor=tensor, out=out) if _capturing(): _captured = _capture_call(dot, (input, tensor), {}) if _captured is not None: return _captured return _C.dot(self=input, tensor=tensor) [docs] def inner(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(inner, (input, other), {'out': out}) if _captured is not None: return _captured return _C.inner(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(inner, (input, other), {}) if _captured is not None: return _captured return _C.inner(self=input, other=other) [docs] def inner_backward_self(grad_output, input, other): if _capturing(): _captured = _capture_call(inner_backward_self, (grad_output, input, other), {}) if _captured is not None: return _captured return _C.inner_backward_self(grad_output, input, other) [docs] def inner_backward_other(grad_output, input, other): if _capturing(): _captured = _capture_call(inner_backward_other, (grad_output, input, other), {}) if _captured is not None: return _captured return _C.inner_backward_other(grad_output, input, other) [docs] def outer(input, vec2, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(outer, (input, vec2), {'out': out}) if _captured is not None: return _captured return _C.outer(self=input, vec2=vec2, out=out) if _capturing(): _captured = _capture_call(outer, (input, vec2), {}) if _captured is not None: return _captured return _C.outer(self=input, vec2=vec2) def einsum(equation, *operands, path=None): if _capturing(): _captured = _capture_call(einsum, (equation, *operands), {}) if _captured is not None: return _captured return _C.einsum(equation, list(operands), path if path is not None else []) [docs] def eq(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(eq, (input, other), {'out': out}) if _captured is not None: return _captured return _C.eq(input, other, out=out) if _capturing(): _captured = _capture_call(eq, (input, other), {}) if _captured is not None: return _captured return _C.eq(input, other) [docs] def ne(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(ne, (input, other), {'out': out}) if _captured is not None: return _captured return _C.ne(input, other, out=out) if _capturing(): _captured = _capture_call(ne, (input, other), {}) if _captured is not None: return _captured return _C.ne(input, other) [docs] def lt(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(lt, (input, other), {'out': out}) if _captured is not None: return _captured return _C.lt(input, other, out=out) if _capturing(): _captured = _capture_call(lt, (input, other), {}) if _captured is not None: return _captured return _C.lt(input, other) [docs] def le(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(le, (input, other), {'out': out}) if _captured is not None: return _captured return _C.le(input, other, out=out) if _capturing(): _captured = _capture_call(le, (input, other), {}) if _captured is not None: return _captured return _C.le(input, other) [docs] def gt(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(gt, (input, other), {'out': out}) if _captured is not None: return _captured return _C.gt(input, other, out=out) if _capturing(): _captured = _capture_call(gt, (input, other), {}) if _captured is not None: return _captured return _C.gt(input, other) [docs] def ge(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(ge, (input, other), {'out': out}) if _captured is not None: return _captured return _C.ge(input, other, out=out) if _capturing(): _captured = _capture_call(ge, (input, other), {}) if _captured is not None: return _captured return _C.ge(input, other) [docs] def copy_(input, src, non_blocking=False): return input.copy_(src=src, non_blocking=non_blocking) [docs] def view(input, size): if _capturing(): _captured = _capture_call(view, (input, size), {}) if _captured is not None: return _captured return input.view(size=size) [docs] def fill_(input, value): return input.fill_(value=value) [docs] def transpose(input, dim0, dim1): if _capturing(): _captured = _capture_call(transpose, (input, dim0, dim1), {}) if _captured is not None: return _captured return _C.transpose(input, dim0, dim1) [docs] def t(input): if _capturing(): _captured = _capture_call(t, (input,), {}) if _captured is not None: return _captured return _C.t(input) [docs] def permute(input, dims): if _capturing(): _captured = _capture_call(permute, (input, dims), {}) if _captured is not None: return _captured if isinstance(dims, int) and not isinstance(dims, bool): dims = [dims] return _C.permute(input, dims) def permute_backward(grad_output, input, dims): if _capturing(): _captured = _capture_call(permute_backward, (grad_output, input, dims), {}) if _captured is not None: return _captured if isinstance(dims, int) and not isinstance(dims, bool): dims = [dims] return _C.permute_backward(grad_output, input, dims) [docs] def squeeze(input, dim=None): if _capturing(): _captured = _capture_call(squeeze, (input, dim), {}) if _captured is not None: return _captured if dim is None: return _C.squeeze(input) return _C.squeeze(input, dim) def squeeze_backward(grad_output, input): if _capturing(): _captured = _capture_call(squeeze_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.squeeze_backward(grad_output, input) [docs] def unsqueeze(input, dim): if _capturing(): _captured = _capture_call(unsqueeze, (input, dim), {}) if _captured is not None: return _captured return _C.unsqueeze(input, dim) [docs] def diagonal(input, offset=0, dim1=0, dim2=1): if _capturing(): _captured = _capture_call(diagonal, (input, offset, dim1, dim2), {}) if _captured is not None: return _captured return _C.diagonal(input, offset, dim1, dim2) def diagonal_backward(grad_output, input_sizes, offset, dim1, dim2): if _capturing(): _captured = _capture_call(diagonal_backward, (grad_output, input_sizes, offset, dim1, dim2), {}) if _captured is not None: return _captured if isinstance(input_sizes, int) and not isinstance(input_sizes, bool): input_sizes = [input_sizes] return _C.diagonal_backward(grad_output, input_sizes, offset, dim1, dim2) [docs] def movedim(input, source, destination): if _capturing(): _captured = _capture_call(movedim, (input, source, destination), {}) if _captured is not None: return _captured if isinstance(source, int) and not isinstance(source, bool): source = [source] if isinstance(destination, int) and not isinstance(destination, bool): destination = [destination] return _C.movedim(input, source, destination) [docs] def cat(tensors, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cat, (tensors, dim), {'out': out}) if _captured is not None: return _captured return _C.cat(tensors=tensors, dim=dim, out=out) if _capturing(): _captured = _capture_call(cat, (tensors, dim), {}) if _captured is not None: return _captured return _C.cat(tensors=tensors, dim=dim) [docs] def stack(tensors, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(stack, (tensors, dim), {'out': out}) if _captured is not None: return _captured return _C.stack(tensors=tensors, dim=dim, out=out) if _capturing(): _captured = _capture_call(stack, (tensors, dim), {}) if _captured is not None: return _captured return _C.stack(tensors=tensors, dim=dim) [docs] def split(input, split_size, dim=0): if _capturing(): _captured = _capture_call(split, (input, split_size, dim), {}) if _captured is not None: return _captured return _C.split(input, split_size, dim) [docs] def chunk(input, chunks, dim=0): if _capturing(): _captured = _capture_call(chunk, (input, chunks, dim), {}) if _captured is not None: return _captured return _C.chunk(input, chunks, dim) [docs] def reshape(input, shape): if _capturing(): _captured = _capture_call(reshape, (input, shape), {}) if _captured is not None: return _captured if isinstance(shape, int) and not isinstance(shape, bool): shape = [shape] return _C.reshape(input, shape) [docs] def unbind(input, dim=0): if _capturing(): _captured = _capture_call(unbind, (input, dim), {}) if _captured is not None: return _captured return _C.unbind(input, dim) [docs] def clone(input, memory_format=None): if _capturing(): _captured = _capture_call(clone, (input, memory_format), {}) if _captured is not None: return _captured return input.clone(memory_format=memory_format) [docs] def contiguous(input, memory_format=tensorplay.contiguous_format): if _capturing(): _captured = _capture_call(contiguous, (input, memory_format), {}) if _captured is not None: return _captured return input.contiguous(memory_format=memory_format) [docs] def item(input): if _capturing(): _captured = _capture_call(item, (input,), {}) if _captured is not None: return _captured return input.item() def select_backward(grad_output, input, dim, index): if _capturing(): _captured = _capture_call(select_backward, (grad_output, input, dim, index), {}) if _captured is not None: return _captured return _C.select_backward(grad_output, input, dim, index) def slice_backward(grad_output, input, dim=0, start=None, end=None, step=1): if _capturing(): _captured = _capture_call(slice_backward, (grad_output, input, dim, start, end, step), {}) if _captured is not None: return _captured return _C.slice_backward(grad_output, input, dim, start, end, step) _c_rand = _C.rand def rand(*size, generator=None, dtype=None, device=None, requires_grad=False): if _capturing(): _captured = _capture_call(rand, tuple(size), {'generator': generator, 'dtype': DType.undefined if dtype is None else dtype, 'device': device, 'requires_grad': requires_grad}) if _captured is not None: return _captured if isinstance(device, str): device = tensorplay.device(device) elif device is Ellipsis: device = None if len(size) == 1: s0 = size[0] if s0.__class__ in (list, tuple): size = s0 elif hasattr(s0, '__iter__'): size = list(s0) # Hot path: every option defaulted -> keyword-free positional # call (pybind kwarg parsing costs ~0.3us/call; the C++ side # applies identical defaults). if generator is None and dtype is None and device is None and not requires_grad: return _c_rand(size) if generator is not None: return _C.rand(size, generator=generator, dtype=dtype, device=device, requires_grad=requires_grad) return _C.rand(size=size, dtype=dtype, device=device, requires_grad=requires_grad) [docs] def rand_like(input, *, generator=None, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False, memory_format=None): if _capturing(): _captured = _capture_call(rand_like, (input,), {'generator': generator, 'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad, 'memory_format': memory_format}) if _captured is not None: return _captured if generator is None and layout is None and not pin_memory and memory_format is None: return _C.rand_like(input, dtype=DType.undefined if dtype is None else dtype, device=_ensure_device(device), requires_grad=requires_grad) return _C.rand_like(input, generator=generator, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, requires_grad=requires_grad, memory_format=memory_format) [docs] def randint(*args, low=_MISSING, high=_MISSING, size=_MISSING, generator=None, out=None, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False): low, high, size = _draw_bounds('randint', args, low, high, {'size': size}) if out is not None: if _capturing(): _captured = _capture_call(randint, (low, high, size), {'generator': generator, 'out': out}) if _captured is not None: return _captured return _C.randint(low, high, size, generator=generator, out=out) if _capturing(): _captured = _capture_call(randint, (low, high, size), {'generator': generator, 'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad}) if _captured is not None: return _captured if generator is None and layout is None and not pin_memory: return _C.randint(low, high, size, dtype=DType.int64 if dtype is None else dtype, device=_ensure_device(device), requires_grad=requires_grad) return _C.randint(low, high, size, generator=generator, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, requires_grad=requires_grad) [docs] def randint_like(input, *args, low=_MISSING, high=_MISSING, generator=None, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False, memory_format=None): low, high = _draw_bounds('randint_like', args, low, high, {}) if isinstance(high, tensorplay.Tensor): if low != 0: raise TypeError('randint_like() takes a tensor bound only as (input, high)') if _capturing(): _captured = _capture_call(randint_like, (input, high), {'generator': generator, 'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad, 'memory_format': memory_format}) if _captured is not None: return _captured return _C.randint_like(input, high, generator=generator, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, requires_grad=requires_grad, memory_format=memory_format) if _capturing(): _captured = _capture_call(randint_like, (input, low, high), {'generator': generator, 'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad, 'memory_format': memory_format}) if _captured is not None: return _captured if generator is None and layout is None and not pin_memory and memory_format is None: return _C.randint_like(input, low, high, dtype=DType.undefined if dtype is None else dtype, device=_ensure_device(device), requires_grad=requires_grad) return _C.randint_like(input, low, high, generator=generator, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, requires_grad=requires_grad, memory_format=memory_format) _c_randn = _C.randn def randn(*size, generator=None, dtype=None, device=None, requires_grad=False): if _capturing(): _captured = _capture_call(randn, tuple(size), {'generator': generator, 'dtype': DType.undefined if dtype is None else dtype, 'device': device, 'requires_grad': requires_grad}) if _captured is not None: return _captured if isinstance(device, str): device = tensorplay.device(device) elif device is Ellipsis: device = None if len(size) == 1: s0 = size[0] if s0.__class__ in (list, tuple): size = s0 elif hasattr(s0, '__iter__'): size = list(s0) # Hot path: every option defaulted -> keyword-free positional # call (pybind kwarg parsing costs ~0.3us/call; the C++ side # applies identical defaults). if generator is None and dtype is None and device is None and not requires_grad: return _c_randn(size) if generator is not None: return _C.randn(size, generator=generator, dtype=dtype, device=device, requires_grad=requires_grad) return _C.randn(size=size, dtype=dtype, device=device, requires_grad=requires_grad) [docs] def randn_like(input, *, generator=None, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False, memory_format=None): if _capturing(): _captured = _capture_call(randn_like, (input,), {'generator': generator, 'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad, 'memory_format': memory_format}) if _captured is not None: return _captured if generator is None and layout is None and not pin_memory and memory_format is None: return _C.randn_like(input, dtype=DType.undefined if dtype is None else dtype, device=_ensure_device(device), requires_grad=requires_grad) return _C.randn_like(input, generator=generator, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, requires_grad=requires_grad, memory_format=memory_format) [docs] def randperm(n, *, generator=None, out=None, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False): if out is not None: if _capturing(): _captured = _capture_call(randperm, (n,), {'generator': generator, 'out': out}) if _captured is not None: return _captured return _C.randperm(n, generator=generator, out=out) if _capturing(): _captured = _capture_call(randperm, (n,), {'generator': generator, 'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad}) if _captured is not None: return _captured if generator is None and layout is None and not pin_memory: return _C.randperm(n, dtype=DType.int64 if dtype is None else dtype, device=_ensure_device(device), requires_grad=requires_grad) return _C.randperm(n, generator=generator, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, requires_grad=requires_grad) [docs] def bernoulli(input, p=_MISSING, *, generator=None, out=None): if p is _MISSING: if out is not None: if _capturing(): _captured = _capture_call(bernoulli, (input,), {'generator': generator, 'out': out}) if _captured is not None: return _captured return _C.bernoulli(self=input, generator=generator, out=out) if _capturing(): _captured = _capture_call(bernoulli, (input,), {'generator': generator}) if _captured is not None: return _captured return _C.bernoulli(self=input, generator=generator) if out is not None: if _capturing(): _captured = _capture_call(bernoulli, (input, p), {'generator': generator, 'out': out}) if _captured is not None: return _captured return _C.bernoulli(self=input, p=p, generator=generator, out=out) if _capturing(): _captured = _capture_call(bernoulli, (input, p), {'generator': generator}) if _captured is not None: return _captured return _C.bernoulli(self=input, p=p, generator=generator) [docs] def native_dropout(input, p, train): if _capturing(): _captured = _capture_call(native_dropout, (input, p, train), {}) if _captured is not None: return _captured return _C.native_dropout(input, p, train) def native_dropout_backward(grad_output, mask, scale): if _capturing(): _captured = _capture_call(native_dropout_backward, (grad_output, mask, scale), {}) if _captured is not None: return _captured return _C.native_dropout_backward(grad_output, mask, scale) def native_dropout_double_backward(ggI, grad, mask, scale): if _capturing(): _captured = _capture_call(native_dropout_double_backward, (ggI, grad, mask, scale), {}) if _captured is not None: return _captured return _C.native_dropout_double_backward(ggI, grad, mask, scale) [docs] def native_alpha_dropout(input, p): if _capturing(): _captured = _capture_call(native_alpha_dropout, (input, p), {}) if _captured is not None: return _captured return _C.native_alpha_dropout(input, p) def _alpha_dropout_backward(grad_output, mask, p): if _capturing(): _captured = _capture_call(_alpha_dropout_backward, (grad_output, mask, p), {}) if _captured is not None: return _captured return _C._alpha_dropout_backward(grad_output, mask, p) [docs] def native_feature_dropout(input, p): if _capturing(): _captured = _capture_call(native_feature_dropout, (input, p), {}) if _captured is not None: return _captured return _C.native_feature_dropout(input, p) def _feature_dropout_backward(grad_output, mask, p): if _capturing(): _captured = _capture_call(_feature_dropout_backward, (grad_output, mask, p), {}) if _captured is not None: return _captured return _C._feature_dropout_backward(grad_output, mask, p) def quantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None): if out is not None: if _capturing(): _captured = _capture_call(quantile, (input, q, dim, keepdim), {'interpolation': interpolation, 'out': out}) if _captured is not None: return _captured return _C.quantile(input, q, dim, keepdim, interpolation=interpolation, out=out) if _capturing(): _captured = _capture_call(quantile, (input, q, dim, keepdim), {'interpolation': interpolation}) if _captured is not None: return _captured return _C.quantile(input, q, dim, keepdim, interpolation=interpolation) def nanquantile(input, q, dim=None, keepdim=False, *, interpolation='linear', out=None): if out is not None: if _capturing(): _captured = _capture_call(nanquantile, (input, q, dim, keepdim), {'interpolation': interpolation, 'out': out}) if _captured is not None: return _captured return _C.nanquantile(input, q, dim, keepdim, interpolation=interpolation, out=out) if _capturing(): _captured = _capture_call(nanquantile, (input, q, dim, keepdim), {'interpolation': interpolation}) if _captured is not None: return _captured return _C.nanquantile(input, q, dim, keepdim, interpolation=interpolation) def histogram(input, bins, *, weight=None, density=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(histogram, (input, bins), {'weight': weight, 'density': density, 'out': out}) if _captured is not None: return _captured return _C.histogram(input, bins, weight=weight, density=density, out=out) if _capturing(): _captured = _capture_call(histogram, (input, bins), {'weight': weight, 'density': density}) if _captured is not None: return _captured return _C.histogram(input, bins, weight=weight, density=density) [docs] def trapezoid(y, x=None, dx=1, dim=-1): if _capturing(): _captured = _capture_call(trapezoid, (y, x, dx, dim), {}) if _captured is not None: return _captured if not isinstance(dx, (tensorplay.Scalar, tensorplay.Tensor)): dx = tensorplay.Scalar(dx) return _C.trapezoid(y, x, dx=dx, dim=dim) [docs] def cumulative_trapezoid(y, x=None, dx=1, dim=-1): if _capturing(): _captured = _capture_call(cumulative_trapezoid, (y, x, dx, dim), {}) if _captured is not None: return _captured if not isinstance(dx, (tensorplay.Scalar, tensorplay.Tensor)): dx = tensorplay.Scalar(dx) return _C.cumulative_trapezoid(y, x, dx=dx, dim=dim) def _trapezoid_backward(grad_output, x, ysizes, dx, dim): if _capturing(): _captured = _capture_call(_trapezoid_backward, (grad_output, x, ysizes, dx, dim), {}) if _captured is not None: return _captured if isinstance(ysizes, int) and not isinstance(ysizes, bool): ysizes = [ysizes] if not isinstance(dx, (tensorplay.Scalar, tensorplay.Tensor)): dx = tensorplay.Scalar(dx) return _C._trapezoid_backward(grad_output, x, ysizes, dx, dim) def _cumulative_trapezoid_backward(grad_output, x, dx, dim): if _capturing(): _captured = _capture_call(_cumulative_trapezoid_backward, (grad_output, x, dx, dim), {}) if _captured is not None: return _captured if not isinstance(dx, (tensorplay.Scalar, tensorplay.Tensor)): dx = tensorplay.Scalar(dx) return _C._cumulative_trapezoid_backward(grad_output, x, dx, dim) def gradient(input, spacing=[], dim=[], edge_order=1): if _capturing(): _captured = _capture_call(gradient, (input, spacing, dim, edge_order), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.gradient(input, spacing, dim, edge_order) [docs] def cov(input, correction=1, fweights=None, aweights=None): if _capturing(): _captured = _capture_call(cov, (input, correction, fweights, aweights), {}) if _captured is not None: return _captured return _C.cov(input, correction=correction, fweights=fweights, aweights=aweights) [docs] def corrcoef(input): if _capturing(): _captured = _capture_call(corrcoef, (input,), {}) if _captured is not None: return _captured return _C.corrcoef(input) def _cov_backward(grad, input, correction, fweights, aweights): if _capturing(): _captured = _capture_call(_cov_backward, (grad, input, correction, fweights, aweights), {}) if _captured is not None: return _captured return _C._cov_backward(grad, input, correction, fweights, aweights) def _corrcoef_backward(grad, input): if _capturing(): _captured = _capture_call(_corrcoef_backward, (grad, input), {}) if _captured is not None: return _captured return _C._corrcoef_backward(grad, input) [docs] def resize_(input, size): return input.resize_(size=size) [docs] def abs(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(abs, (input,), {'out': out}) if _captured is not None: return _captured return _C.abs(self=input, out=out) if _capturing(): _captured = _capture_call(abs, (input,), {}) if _captured is not None: return _captured return _C.abs(self=input) [docs] def acos(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(acos, (input,), {'out': out}) if _captured is not None: return _captured return _C.acos(self=input, out=out) if _capturing(): _captured = _capture_call(acos, (input,), {}) if _captured is not None: return _captured return _C.acos(self=input) [docs] def acosh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(acosh, (input,), {'out': out}) if _captured is not None: return _captured return _C.acosh(self=input, out=out) if _capturing(): _captured = _capture_call(acosh, (input,), {}) if _captured is not None: return _captured return _C.acosh(self=input) [docs] def angle(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(angle, (input,), {'out': out}) if _captured is not None: return _captured return _C.angle(self=input, out=out) if _capturing(): _captured = _capture_call(angle, (input,), {}) if _captured is not None: return _captured return _C.angle(self=input) [docs] def asin(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(asin, (input,), {'out': out}) if _captured is not None: return _captured return _C.asin(self=input, out=out) if _capturing(): _captured = _capture_call(asin, (input,), {}) if _captured is not None: return _captured return _C.asin(self=input) [docs] def asinh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(asinh, (input,), {'out': out}) if _captured is not None: return _captured return _C.asinh(self=input, out=out) if _capturing(): _captured = _capture_call(asinh, (input,), {}) if _captured is not None: return _captured return _C.asinh(self=input) [docs] def atan(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(atan, (input,), {'out': out}) if _captured is not None: return _captured return _C.atan(self=input, out=out) if _capturing(): _captured = _capture_call(atan, (input,), {}) if _captured is not None: return _captured return _C.atan(self=input) [docs] def atan2(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(atan2, (input, other), {'out': out}) if _captured is not None: return _captured return _C.atan2(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(atan2, (input, other), {}) if _captured is not None: return _captured return _C.atan2(self=input, other=other) [docs] def poisson(input, generator=None): if _capturing(): _captured = _capture_call(poisson, (input, generator), {}) if _captured is not None: return _captured return _C.poisson(input, generator) [docs] def atanh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(atanh, (input,), {'out': out}) if _captured is not None: return _captured return _C.atanh(self=input, out=out) if _capturing(): _captured = _capture_call(atanh, (input,), {}) if _captured is not None: return _captured return _C.atanh(self=input) [docs] def ceil(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(ceil, (input,), {'out': out}) if _captured is not None: return _captured return _C.ceil(self=input, out=out) if _capturing(): _captured = _capture_call(ceil, (input,), {}) if _captured is not None: return _captured return _C.ceil(self=input) [docs] def clamp(input, min=None, max=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(clamp, (input, min, max), {'out': out}) if _captured is not None: return _captured return _C.clamp(input, min, max, out=out) if _capturing(): _captured = _capture_call(clamp, (input, min, max), {}) if _captured is not None: return _captured return _C.clamp(input, min, max) def clamp_backward(grad_output, input, min=None, max=None): if _capturing(): _captured = _capture_call(clamp_backward, (grad_output, input, min, max), {}) if _captured is not None: return _captured if min is not None and not isinstance(min, (tensorplay.Scalar, tensorplay.Tensor)): min = tensorplay.Scalar(min) if max is not None and not isinstance(max, (tensorplay.Scalar, tensorplay.Tensor)): max = tensorplay.Scalar(max) return _C.clamp_backward(grad_output, input, min, max) [docs] def cos(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cos, (input,), {'out': out}) if _captured is not None: return _captured return _C.cos(self=input, out=out) if _capturing(): _captured = _capture_call(cos, (input,), {}) if _captured is not None: return _captured return _C.cos(self=input) [docs] def cosh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cosh, (input,), {'out': out}) if _captured is not None: return _captured return _C.cosh(self=input, out=out) if _capturing(): _captured = _capture_call(cosh, (input,), {}) if _captured is not None: return _captured return _C.cosh(self=input) [docs] def erf(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(erf, (input,), {'out': out}) if _captured is not None: return _captured return _C.erf(self=input, out=out) if _capturing(): _captured = _capture_call(erf, (input,), {}) if _captured is not None: return _captured return _C.erf(self=input) [docs] def erfc(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(erfc, (input,), {'out': out}) if _captured is not None: return _captured return _C.erfc(self=input, out=out) if _capturing(): _captured = _capture_call(erfc, (input,), {}) if _captured is not None: return _captured return _C.erfc(self=input) [docs] def expm1(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(expm1, (input,), {'out': out}) if _captured is not None: return _captured return _C.expm1(self=input, out=out) if _capturing(): _captured = _capture_call(expm1, (input,), {}) if _captured is not None: return _captured return _C.expm1(self=input) [docs] def lgamma(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(lgamma, (input,), {'out': out}) if _captured is not None: return _captured return _C.lgamma(self=input, out=out) if _capturing(): _captured = _capture_call(lgamma, (input,), {}) if _captured is not None: return _captured return _C.lgamma(self=input) [docs] def log2(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log2, (input,), {'out': out}) if _captured is not None: return _captured return _C.log2(self=input, out=out) if _capturing(): _captured = _capture_call(log2, (input,), {}) if _captured is not None: return _captured return _C.log2(self=input) [docs] def reciprocal(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(reciprocal, (input,), {'out': out}) if _captured is not None: return _captured return _C.reciprocal(self=input, out=out) if _capturing(): _captured = _capture_call(reciprocal, (input,), {}) if _captured is not None: return _captured return _C.reciprocal(self=input) [docs] def trunc(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(trunc, (input,), {'out': out}) if _captured is not None: return _captured return _C.trunc(self=input, out=out) if _capturing(): _captured = _capture_call(trunc, (input,), {}) if _captured is not None: return _captured return _C.trunc(self=input) [docs] def exp(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(exp, (input,), {'out': out}) if _captured is not None: return _captured return _C.exp(self=input, out=out) if _capturing(): _captured = _capture_call(exp, (input,), {}) if _captured is not None: return _captured return _C.exp(self=input) [docs] def floor(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(floor, (input,), {'out': out}) if _captured is not None: return _captured return _C.floor(self=input, out=out) if _capturing(): _captured = _capture_call(floor, (input,), {}) if _captured is not None: return _captured return _C.floor(self=input) [docs] def lerp(input, end, weight, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(lerp, (input, end, weight), {'out': out}) if _captured is not None: return _captured return _C.lerp(input, end, weight, out=out) if _capturing(): _captured = _capture_call(lerp, (input, end, weight), {}) if _captured is not None: return _captured return _C.lerp(input, end, weight) [docs] def lerp_(input, end, weight): return input.lerp_(end=end, weight=weight) [docs] def abs_(input): return input.abs_() [docs] def neg_(input): return input.neg_() [docs] def sqrt_(input): return input.sqrt_() [docs] def rsqrt_(input): return input.rsqrt_() [docs] def log(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log, (input,), {'out': out}) if _captured is not None: return _captured return _C.log(self=input, out=out) if _capturing(): _captured = _capture_call(log, (input,), {}) if _captured is not None: return _captured return _C.log(self=input) [docs] def neg(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(neg, (input,), {'out': out}) if _captured is not None: return _captured return _C.neg(self=input, out=out) if _capturing(): _captured = _capture_call(neg, (input,), {}) if _captured is not None: return _captured return _C.neg(self=input) [docs] def pow(input, exponent, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(pow, (input, exponent), {'out': out}) if _captured is not None: return _captured return _C.pow(input, exponent, out=out) if _capturing(): _captured = _capture_call(pow, (input, exponent), {}) if _captured is not None: return _captured return _C.pow(input, exponent) [docs] def round(input, *, decimals=_MISSING, out=None): if decimals is not _MISSING: if out is not None: if _capturing(): _captured = _capture_call(round, (input,), {'decimals': decimals, 'out': out}) if _captured is not None: return _captured return _C.round(input, decimals=decimals, out=out) if _capturing(): _captured = _capture_call(round, (input,), {'decimals': decimals}) if _captured is not None: return _captured return _C.round(input, decimals=decimals) if out is not None: if _capturing(): _captured = _capture_call(round, (input,), {'out': out}) if _captured is not None: return _captured return _C.round(input, out=out) if _capturing(): _captured = _capture_call(round, (input,), {}) if _captured is not None: return _captured return _C.round(input) [docs] def rsqrt(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(rsqrt, (input,), {'out': out}) if _captured is not None: return _captured return _C.rsqrt(self=input, out=out) if _capturing(): _captured = _capture_call(rsqrt, (input,), {}) if _captured is not None: return _captured return _C.rsqrt(self=input) [docs] def sigmoid(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sigmoid, (input,), {'out': out}) if _captured is not None: return _captured return _C.sigmoid(self=input, out=out) if _capturing(): _captured = _capture_call(sigmoid, (input,), {}) if _captured is not None: return _captured return _C.sigmoid(self=input) [docs] def sign(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sign, (input,), {'out': out}) if _captured is not None: return _captured return _C.sign(self=input, out=out) if _capturing(): _captured = _capture_call(sign, (input,), {}) if _captured is not None: return _captured return _C.sign(self=input) [docs] def sin(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sin, (input,), {'out': out}) if _captured is not None: return _captured return _C.sin(self=input, out=out) if _capturing(): _captured = _capture_call(sin, (input,), {}) if _captured is not None: return _captured return _C.sin(self=input) [docs] def sinh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sinh, (input,), {'out': out}) if _captured is not None: return _captured return _C.sinh(self=input, out=out) if _capturing(): _captured = _capture_call(sinh, (input,), {}) if _captured is not None: return _captured return _C.sinh(self=input) [docs] def softmax(input, dim, dtype=DType.undefined, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(softmax, (input, dim, dtype), {'out': out}) if _captured is not None: return _captured return _C.softmax(input, dim, dtype, out=out) if _capturing(): _captured = _capture_call(softmax, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.softmax(input, dim, dtype) [docs] def log_softmax(input, dim, dtype=DType.undefined, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log_softmax, (input, dim, dtype), {'out': out}) if _captured is not None: return _captured return _C.log_softmax(input, dim, dtype, out=out) if _capturing(): _captured = _capture_call(log_softmax, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.log_softmax(input, dim, dtype) [docs] def sqrt(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sqrt, (input,), {'out': out}) if _captured is not None: return _captured return _C.sqrt(self=input, out=out) if _capturing(): _captured = _capture_call(sqrt, (input,), {}) if _captured is not None: return _captured return _C.sqrt(self=input) [docs] def square(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(square, (input,), {'out': out}) if _captured is not None: return _captured return _C.square(self=input, out=out) if _capturing(): _captured = _capture_call(square, (input,), {}) if _captured is not None: return _captured return _C.square(self=input) [docs] def tan(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(tan, (input,), {'out': out}) if _captured is not None: return _captured return _C.tan(self=input, out=out) if _capturing(): _captured = _capture_call(tan, (input,), {}) if _captured is not None: return _captured return _C.tan(self=input) [docs] def tanh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(tanh, (input,), {'out': out}) if _captured is not None: return _captured return _C.tanh(self=input, out=out) if _capturing(): _captured = _capture_call(tanh, (input,), {}) if _captured is not None: return _captured return _C.tanh(self=input) [docs] def relu(input): if _capturing(): _captured = _capture_call(relu, (input,), {}) if _captured is not None: return _captured return _C.relu(input) [docs] def relu_(input): if _capturing(): _captured = _capture_call(relu_, (input,), {}) if _captured is not None: return _captured return _C.relu_(input) def threshold_backward(grad_output, input, threshold, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(threshold_backward, (grad_output, input, threshold), {'out': out}) if _captured is not None: return _captured return _C.threshold_backward(grad_output=grad_output, self=input, threshold=threshold, out=out) if _capturing(): _captured = _capture_call(threshold_backward, (grad_output, input, threshold), {}) if _captured is not None: return _captured return _C.threshold_backward(grad_output=grad_output, self=input, threshold=threshold) [docs] def gelu(input, approximate='none', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(gelu, (input, approximate), {'out': out}) if _captured is not None: return _captured return _C.gelu(self=input, approximate=approximate, out=out) if _capturing(): _captured = _capture_call(gelu, (input, approximate), {}) if _captured is not None: return _captured return _C.gelu(self=input, approximate=approximate) def gelu_backward(grad_output, input, approximate='none', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(gelu_backward, (grad_output, input, approximate), {'out': out}) if _captured is not None: return _captured return _C.gelu_backward(grad_output=grad_output, self=input, approximate=approximate, out=out) if _capturing(): _captured = _capture_call(gelu_backward, (grad_output, input, approximate), {}) if _captured is not None: return _captured return _C.gelu_backward(grad_output=grad_output, self=input, approximate=approximate) [docs] def silu(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(silu, (input,), {'out': out}) if _captured is not None: return _captured return _C.silu(self=input, out=out) if _capturing(): _captured = _capture_call(silu, (input,), {}) if _captured is not None: return _captured return _C.silu(self=input) def silu_backward(grad_output, input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(silu_backward, (grad_output, input), {'out': out}) if _captured is not None: return _captured return _C.silu_backward(grad_output=grad_output, self=input, out=out) if _capturing(): _captured = _capture_call(silu_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.silu_backward(grad_output=grad_output, self=input) _c_empty = _C.empty def empty(*size, dtype=None, device=None, pin_memory=False, requires_grad=False): if _capturing(): _captured = _capture_call(empty, tuple(size), {'dtype': DType.undefined if dtype is None else dtype, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad}) if _captured is not None: return _captured if isinstance(device, str): device = tensorplay.device(device) elif device is Ellipsis: device = None if len(size) == 1: s0 = size[0] if s0.__class__ in (list, tuple): size = s0 elif hasattr(s0, '__iter__'): size = list(s0) # Hot path: every option defaulted -> keyword-free positional # call (pybind kwarg parsing costs ~0.3us/call; the C++ side # applies identical defaults). if dtype is None and device is None and not requires_grad and not pin_memory: return _c_empty(size) return _C.empty(size=size, dtype=dtype, device=device, pin_memory=pin_memory, requires_grad=requires_grad) def full(size, fill_value, *, dtype=DType.undefined, device=None, pin_memory=False, requires_grad=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(full, (size, fill_value), {'dtype': dtype, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad, 'out': out}) if _captured is not None: return _captured return _C.full(size=size, fill_value=fill_value, dtype=dtype, device=device, pin_memory=pin_memory, requires_grad=requires_grad, out=out) if _capturing(): _captured = _capture_call(full, (size, fill_value), {'dtype': dtype, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.full(size=size, fill_value=fill_value, dtype=dtype, device=device, pin_memory=pin_memory, requires_grad=requires_grad) _c_zeros = _C.zeros def zeros(*size, dtype=None, device=None, pin_memory=False, requires_grad=False): if _capturing(): _captured = _capture_call(zeros, tuple(size), {'dtype': DType.undefined if dtype is None else dtype, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad}) if _captured is not None: return _captured if isinstance(device, str): device = tensorplay.device(device) elif device is Ellipsis: device = None if len(size) == 1: s0 = size[0] if s0.__class__ in (list, tuple): size = s0 elif hasattr(s0, '__iter__'): size = list(s0) # Hot path: every option defaulted -> keyword-free positional # call (pybind kwarg parsing costs ~0.3us/call; the C++ side # applies identical defaults). if dtype is None and device is None and not requires_grad and not pin_memory: return _c_zeros(size) return _C.zeros(size=size, dtype=dtype, device=device, pin_memory=pin_memory, requires_grad=requires_grad) _c_ones = _C.ones def ones(*size, dtype=None, device=None, pin_memory=False, requires_grad=False): if _capturing(): _captured = _capture_call(ones, tuple(size), {'dtype': DType.undefined if dtype is None else dtype, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad}) if _captured is not None: return _captured if isinstance(device, str): device = tensorplay.device(device) elif device is Ellipsis: device = None if len(size) == 1: s0 = size[0] if s0.__class__ in (list, tuple): size = s0 elif hasattr(s0, '__iter__'): size = list(s0) # Hot path: every option defaulted -> keyword-free positional # call (pybind kwarg parsing costs ~0.3us/call; the C++ side # applies identical defaults). if dtype is None and device is None and not requires_grad and not pin_memory: return _c_ones(size) return _C.ones(size=size, dtype=dtype, device=device, pin_memory=pin_memory, requires_grad=requires_grad) def eye(n, m=-1, *, dtype=DType.float32, device=None, requires_grad=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(eye, (n, m), {'dtype': dtype, 'device': device, 'requires_grad': requires_grad, 'out': out}) if _captured is not None: return _captured return _C.eye(n, m, dtype=dtype, device=device, requires_grad=requires_grad, out=out) if _capturing(): _captured = _capture_call(eye, (n, m), {'dtype': dtype, 'device': device, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.eye(n, m, dtype=dtype, device=device, requires_grad=requires_grad) [docs] def arange(*args, dtype=DType.undefined, device=None, requires_grad=False, out=None): if out is not None: # The out= contract takes the destination's dtype and device. if _capturing(): _captured = _capture_call(arange, (*args,), {'out': out}) if _captured is not None: return _captured if len(args) == 1: return _C.arange(args[0], out=out) if len(args) == 2: return _C.arange(args[0], args[1], out=out) if len(args) == 3: return _C.arange(args[0], args[1], args[2], out=out) raise TypeError(f'arange expected 1-3 positional arguments, got {len(args)}') _captured = _capture_call(arange, tuple(args), {'dtype': dtype, 'device': device, 'requires_grad': requires_grad}) if _captured is not None: return _captured if dtype == DType.undefined: _has_float = False for _a in args: if isinstance(_a, float): _has_float = True break if _has_float: dtype = DType.float32 else: dtype = DType.int64 if len(args) == 1: return _C.arange(end=args[0], dtype=dtype, device=_ensure_device(device), requires_grad=requires_grad) elif len(args) == 2: return _C.arange(start=args[0], end=args[1], dtype=dtype, device=_ensure_device(device), requires_grad=requires_grad) elif len(args) == 3: return _C.arange(start=args[0], end=args[1], step=args[2], dtype=dtype, device=_ensure_device(device), requires_grad=requires_grad) else: raise TypeError(f'arange expected 1-3 positional arguments, got {len(args)}') [docs] def linspace(start, end, steps, *, dtype=DType.float32, device=None, requires_grad=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(linspace, (start, end, steps), {'dtype': dtype, 'device': device, 'requires_grad': requires_grad, 'out': out}) if _captured is not None: return _captured return _C.linspace(start, end, steps, dtype=dtype, device=device, requires_grad=requires_grad, out=out) if _capturing(): _captured = _capture_call(linspace, (start, end, steps), {'dtype': dtype, 'device': device, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.linspace(start, end, steps, dtype=dtype, device=device, requires_grad=requires_grad) [docs] def logspace(start, end, steps, base=10.0, *, dtype=DType.float32, device=None, requires_grad=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(logspace, (start, end, steps, base), {'dtype': dtype, 'device': device, 'requires_grad': requires_grad, 'out': out}) if _captured is not None: return _captured return _C.logspace(start, end, steps, base, dtype=dtype, device=device, requires_grad=requires_grad, out=out) if _capturing(): _captured = _capture_call(logspace, (start, end, steps, base), {'dtype': dtype, 'device': device, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.logspace(start, end, steps, base, dtype=dtype, device=device, requires_grad=requires_grad) [docs] def sum(input, dim=None, keepdim=False, *, dtype=DType.undefined): if _capturing(): _captured = _capture_call(sum, (input, dim, keepdim), {'dtype': dtype}) if _captured is not None: return _captured if dim is None: return _C.sum(input, dtype=dtype) return _C.sum(input, dim, keepdim, dtype=dtype) [docs] def mean(input, dim=None, keepdim=False, *, dtype=DType.undefined): if _capturing(): _captured = _capture_call(mean, (input, dim, keepdim), {'dtype': dtype}) if _captured is not None: return _captured if dim is None: return _C.mean(input, dtype=dtype) return _C.mean(input, dim, keepdim, dtype=dtype) def sum_squared_error(input, other, dim=[], keepdim=False): if _capturing(): _captured = _capture_call(sum_squared_error, (input, other, dim, keepdim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.sum_squared_error(input, other, dim, keepdim) def sum_abs_error(input, other, dim=[], keepdim=False): if _capturing(): _captured = _capture_call(sum_abs_error, (input, other, dim, keepdim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.sum_abs_error(input, other, dim, keepdim) def _sum_dim_backward(grad_output, input, dim, keepdim=False): if _capturing(): _captured = _capture_call(_sum_dim_backward, (grad_output, input, dim, keepdim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C._sum_dim_backward(grad_output, input, dim, keepdim) def mean_dim_backward(grad_output, input, dim, keepdim=False): if _capturing(): _captured = _capture_call(mean_dim_backward, (grad_output, input, dim, keepdim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.mean_dim_backward(grad_output, input, dim, keepdim) def max(input, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(max, (input, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C.max(input) return _C.max(input, dim, keepdim) def min(input, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(min, (input, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C.min(input) return _C.min(input, dim, keepdim) [docs] def prod(input, dim=None, keepdim=False, *, dtype=DType.undefined): if _capturing(): _captured = _capture_call(prod, (input, dim, keepdim), {'dtype': dtype}) if _captured is not None: return _captured if dim is None: return _C.prod(input, dtype=dtype) return _C.prod(input, dim, keepdim, dtype=dtype) [docs] def argmax(input, dim=None, keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(argmax, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.argmax(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(argmax, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.argmax(self=input, dim=dim, keepdim=keepdim) [docs] def argmin(input, dim=None, keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(argmin, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.argmin(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(argmin, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.argmin(self=input, dim=dim, keepdim=keepdim) [docs] def all(input, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(all, (input, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C.all(input) return _C.all(input, dim, keepdim) [docs] def any(input, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(any, (input, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C.any(input) return _C.any(input, dim, keepdim) [docs] def var(input, dim=None, unbiased=None, keepdim=False, *, correction=None): if _capturing(): _captured = _capture_call(var, (input, dim, unbiased, keepdim), {"correction": correction}) if _captured is not None: return _captured if correction is None: correction = 1 if (unbiased is None or unbiased) else 0 if dim is None: return _C.var(input, correction=correction, keepdim=keepdim) if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.var(input, list(dim), correction, keepdim) [docs] def std(input, dim=None, unbiased=None, keepdim=False, *, correction=None): if _capturing(): _captured = _capture_call(std, (input, dim, unbiased, keepdim), {"correction": correction}) if _captured is not None: return _captured if correction is None: correction = 1 if (unbiased is None or unbiased) else 0 if dim is None: return _C.std(input, correction=correction, keepdim=keepdim) if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.std(input, list(dim), correction, keepdim) [docs] def median(input, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(median, (input, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C.median(input) return _C.median(input, dim, keepdim) [docs] def norm(input, p=2.0, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(norm, (input, p, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C.norm(input, p) return _C.norm(input, dim, p, keepdim) [docs] def exponential_(input, lambd=1.0, generator=None): return input.exponential_(lambd=lambd, generator=generator) [docs] def geometric_(input, p, generator=None): return input.geometric_(p=p, generator=generator) [docs] def log_normal_(input, mean=1.0, std=2.0, generator=None): return input.log_normal_(mean=mean, std=std, generator=generator) [docs] def normal_(input, mean=0.0, std=1.0, generator=None): return input.normal_(mean=mean, std=std, generator=generator) [docs] def random_(input, generator=None): return input.random_(generator=generator) [docs] def uniform_(input, from_=0.0, to=1.0, generator=None): return input.uniform_(from_=from_, to=to, generator=generator) [docs] def bernoulli_(input, p, generator=None): return input.bernoulli_(p=p, generator=generator) [docs] def cauchy_(input, median=0.0, sigma=1.0, generator=None): return input.cauchy_(median=median, sigma=sigma, generator=generator) def empty_like(input, dtype=DType.undefined, device=None, requires_grad=False): if _capturing(): _captured = _capture_call(empty_like, (input,), {'device': device, 'dtype': dtype, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.empty_like(input, dtype=dtype, device=device, requires_grad=requires_grad) def zeros_like(input, dtype=DType.undefined, device=None, requires_grad=False): if _capturing(): _captured = _capture_call(zeros_like, (input,), {'device': device, 'dtype': dtype, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.zeros_like(input, dtype=dtype, device=device, requires_grad=requires_grad) def ones_like(input, dtype=DType.undefined, device=None, requires_grad=False): if _capturing(): _captured = _capture_call(ones_like, (input,), {'device': device, 'dtype': dtype, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.ones_like(input, dtype=dtype, device=device, requires_grad=requires_grad) def full_like(input, fill_value, dtype=DType.undefined, device=None, requires_grad=False): if _capturing(): _captured = _capture_call(full_like, (input, fill_value), {'device': device, 'dtype': dtype, 'requires_grad': requires_grad}) if _captured is not None: return _captured if not isinstance(fill_value, (tensorplay.Scalar, tensorplay.Tensor)): fill_value = tensorplay.Scalar(fill_value) return _C.full_like(input, fill_value, dtype=dtype, device=device, requires_grad=requires_grad) [docs] def masked_select(input, mask, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(masked_select, (input, mask), {'out': out}) if _captured is not None: return _captured return _C.masked_select(self=input, mask=mask, out=out) if _capturing(): _captured = _capture_call(masked_select, (input, mask), {}) if _captured is not None: return _captured return _C.masked_select(self=input, mask=mask) [docs] def zero_(input): return input.zero_() [docs] def max_pool2d(input, kernel_size, stride=([]), padding=([0, 0]), dilation=([1, 1]), ceil_mode=False): if _capturing(): _captured = _capture_call(max_pool2d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def max_pool3d(input, kernel_size, stride=([]), padding=([0, 0, 0]), dilation=([1, 1, 1]), ceil_mode=False): if _capturing(): _captured = _capture_call(max_pool3d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.max_pool3d(input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def max_pool2d_with_indices(input, kernel_size, stride=[], padding=[], dilation=[], ceil_mode=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(max_pool2d_with_indices, (input, kernel_size, stride, padding, dilation, ceil_mode), {'out': out}) if _captured is not None: return _captured return _C.max_pool2d_with_indices(input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode, out=out) if _capturing(): _captured = _capture_call(max_pool2d_with_indices, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured return _C.max_pool2d_with_indices(input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode) [docs] def max_pool3d_with_indices(input, kernel_size, stride=[], padding=[], dilation=[], ceil_mode=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(max_pool3d_with_indices, (input, kernel_size, stride, padding, dilation, ceil_mode), {'out': out}) if _captured is not None: return _captured return _C.max_pool3d_with_indices(input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode, out=out) if _capturing(): _captured = _capture_call(max_pool3d_with_indices, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured return _C.max_pool3d_with_indices(input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode) [docs] def avg_pool2d(input, kernel_size, stride=[], padding=[], ceil_mode=False, count_include_pad=True, divisor_override=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(avg_pool2d, (input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {'out': out}) if _captured is not None: return _captured return _C.avg_pool2d(input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override, out=out) if _capturing(): _captured = _capture_call(avg_pool2d, (input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {}) if _captured is not None: return _captured return _C.avg_pool2d(input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override) [docs] def avg_pool3d(input, kernel_size, stride=[], padding=[], ceil_mode=False, count_include_pad=True, divisor_override=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(avg_pool3d, (input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {'out': out}) if _captured is not None: return _captured return _C.avg_pool3d(input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override, out=out) if _capturing(): _captured = _capture_call(avg_pool3d, (input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {}) if _captured is not None: return _captured return _C.avg_pool3d(input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override) def avg_pool3d_backward(grad_output, input, kernel_size, stride=[], padding=[], ceil_mode=False, count_include_pad=True, divisor_override=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(avg_pool3d_backward, (grad_output, input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {'out': out}) if _captured is not None: return _captured return _C.avg_pool3d_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override, out=out) if _capturing(): _captured = _capture_call(avg_pool3d_backward, (grad_output, input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {}) if _captured is not None: return _captured return _C.avg_pool3d_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override) [docs] def adaptive_avg_pool3d(input, output_size, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(adaptive_avg_pool3d, (input, output_size), {'out': out}) if _captured is not None: return _captured return _C.adaptive_avg_pool3d(input=input, output_size=output_size, out=out) if _capturing(): _captured = _capture_call(adaptive_avg_pool3d, (input, output_size), {}) if _captured is not None: return _captured return _C.adaptive_avg_pool3d(input=input, output_size=output_size) def adaptive_avg_pool3d_backward(grad_output, input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(adaptive_avg_pool3d_backward, (grad_output, input), {'out': out}) if _captured is not None: return _captured return _C.adaptive_avg_pool3d_backward(grad_output=grad_output, input=input, out=out) if _capturing(): _captured = _capture_call(adaptive_avg_pool3d_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.adaptive_avg_pool3d_backward(grad_output=grad_output, input=input) [docs] def adaptive_avg_pool2d(input, output_size, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(adaptive_avg_pool2d, (input, output_size), {'out': out}) if _captured is not None: return _captured return _C.adaptive_avg_pool2d(input=input, output_size=output_size, out=out) if _capturing(): _captured = _capture_call(adaptive_avg_pool2d, (input, output_size), {}) if _captured is not None: return _captured return _C.adaptive_avg_pool2d(input=input, output_size=output_size) [docs] def adaptive_max_pool2d(input, output_size, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(adaptive_max_pool2d, (input, output_size), {'out': out}) if _captured is not None: return _captured return _C.adaptive_max_pool2d(input=input, output_size=output_size, out=out) if _capturing(): _captured = _capture_call(adaptive_max_pool2d, (input, output_size), {}) if _captured is not None: return _captured return _C.adaptive_max_pool2d(input=input, output_size=output_size) [docs] def adaptive_max_pool2d_with_indices(input, output_size): if _capturing(): _captured = _capture_call(adaptive_max_pool2d_with_indices, (input, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.adaptive_max_pool2d_with_indices(input, output_size) [docs] def adaptive_max_pool3d(input, output_size, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(adaptive_max_pool3d, (input, output_size), {'out': out}) if _captured is not None: return _captured return _C.adaptive_max_pool3d(input=input, output_size=output_size, out=out) if _capturing(): _captured = _capture_call(adaptive_max_pool3d, (input, output_size), {}) if _captured is not None: return _captured return _C.adaptive_max_pool3d(input=input, output_size=output_size) [docs] def fractional_max_pool2d(input, kernel_size, output_size, random_samples, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fractional_max_pool2d, (input, kernel_size, output_size, random_samples), {'out': out}) if _captured is not None: return _captured return _C.fractional_max_pool2d(self=input, kernel_size=kernel_size, output_size=output_size, random_samples=random_samples, out=out) if _capturing(): _captured = _capture_call(fractional_max_pool2d, (input, kernel_size, output_size, random_samples), {}) if _captured is not None: return _captured return _C.fractional_max_pool2d(self=input, kernel_size=kernel_size, output_size=output_size, random_samples=random_samples) def fractional_max_pool2d_backward(grad_output, input, kernel_size, output_size, indices, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fractional_max_pool2d_backward, (grad_output, input, kernel_size, output_size, indices), {'out': out}) if _captured is not None: return _captured return _C.fractional_max_pool2d_backward(grad_output=grad_output, self=input, kernel_size=kernel_size, output_size=output_size, indices=indices, out=out) if _capturing(): _captured = _capture_call(fractional_max_pool2d_backward, (grad_output, input, kernel_size, output_size, indices), {}) if _captured is not None: return _captured return _C.fractional_max_pool2d_backward(grad_output=grad_output, self=input, kernel_size=kernel_size, output_size=output_size, indices=indices) [docs] def fractional_max_pool3d(input, kernel_size, output_size, random_samples, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fractional_max_pool3d, (input, kernel_size, output_size, random_samples), {'out': out}) if _captured is not None: return _captured return _C.fractional_max_pool3d(self=input, kernel_size=kernel_size, output_size=output_size, random_samples=random_samples, out=out) if _capturing(): _captured = _capture_call(fractional_max_pool3d, (input, kernel_size, output_size, random_samples), {}) if _captured is not None: return _captured return _C.fractional_max_pool3d(self=input, kernel_size=kernel_size, output_size=output_size, random_samples=random_samples) def fractional_max_pool3d_backward(grad_output, input, kernel_size, output_size, indices, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fractional_max_pool3d_backward, (grad_output, input, kernel_size, output_size, indices), {'out': out}) if _captured is not None: return _captured return _C.fractional_max_pool3d_backward(grad_output=grad_output, self=input, kernel_size=kernel_size, output_size=output_size, indices=indices, out=out) if _capturing(): _captured = _capture_call(fractional_max_pool3d_backward, (grad_output, input, kernel_size, output_size, indices), {}) if _captured is not None: return _captured return _C.fractional_max_pool3d_backward(grad_output=grad_output, self=input, kernel_size=kernel_size, output_size=output_size, indices=indices) [docs] def max_unpool2d(input, indices, output_size, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(max_unpool2d, (input, indices, output_size), {'out': out}) if _captured is not None: return _captured return _C.max_unpool2d(self=input, indices=indices, output_size=output_size, out=out) if _capturing(): _captured = _capture_call(max_unpool2d, (input, indices, output_size), {}) if _captured is not None: return _captured return _C.max_unpool2d(self=input, indices=indices, output_size=output_size) def max_unpool2d_backward(grad_output, indices, output_size): if _capturing(): _captured = _capture_call(max_unpool2d_backward, (grad_output, indices, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.max_unpool2d_backward(grad_output, indices, output_size) [docs] def max_unpool3d(input, indices, output_size, stride, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(max_unpool3d, (input, indices, output_size, stride, padding), {'out': out}) if _captured is not None: return _captured return _C.max_unpool3d(self=input, indices=indices, output_size=output_size, stride=stride, padding=padding, out=out) if _capturing(): _captured = _capture_call(max_unpool3d, (input, indices, output_size, stride, padding), {}) if _captured is not None: return _captured return _C.max_unpool3d(self=input, indices=indices, output_size=output_size, stride=stride, padding=padding) def max_unpool3d_backward(grad_output, indices, output_size): if _capturing(): _captured = _capture_call(max_unpool3d_backward, (grad_output, indices, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.max_unpool3d_backward(grad_output, indices, output_size) [docs] def grid_sampler_2d(input, grid, interpolation_mode, padding_mode, align_corners): if _capturing(): _captured = _capture_call(grid_sampler_2d, (input, grid, interpolation_mode, padding_mode, align_corners), {}) if _captured is not None: return _captured return _C.grid_sampler_2d(input, grid, interpolation_mode, padding_mode, align_corners) def grid_sampler_2d_backward(grad_output, input, grid, interpolation_mode, padding_mode, align_corners, output_mask): if _capturing(): _captured = _capture_call(grid_sampler_2d_backward, (grad_output, input, grid, interpolation_mode, padding_mode, align_corners, output_mask), {}) if _captured is not None: return _captured return _C.grid_sampler_2d_backward(grad_output, input, grid, interpolation_mode, padding_mode, align_corners, output_mask) [docs] def grid_sampler_3d(input, grid, interpolation_mode, padding_mode, align_corners): if _capturing(): _captured = _capture_call(grid_sampler_3d, (input, grid, interpolation_mode, padding_mode, align_corners), {}) if _captured is not None: return _captured return _C.grid_sampler_3d(input, grid, interpolation_mode, padding_mode, align_corners) def grid_sampler_3d_backward(grad_output, input, grid, interpolation_mode, padding_mode, align_corners, output_mask): if _capturing(): _captured = _capture_call(grid_sampler_3d_backward, (grad_output, input, grid, interpolation_mode, padding_mode, align_corners, output_mask), {}) if _captured is not None: return _captured return _C.grid_sampler_3d_backward(grad_output, input, grid, interpolation_mode, padding_mode, align_corners, output_mask) [docs] def nll_loss(input, target, weight=None, reduction=1, ignore_index=-100, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nll_loss, (input, target, weight, reduction, ignore_index), {'out': out}) if _captured is not None: return _captured return _C.nll_loss(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, out=out) if _capturing(): _captured = _capture_call(nll_loss, (input, target, weight, reduction, ignore_index), {}) if _captured is not None: return _captured return _C.nll_loss(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index) def nll_loss_backward(grad_output, input, target, weight=None, reduction=1, ignore_index=-100, total_weight=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nll_loss_backward, (grad_output, input, target, weight, reduction, ignore_index, total_weight), {'out': out}) if _captured is not None: return _captured return _C.nll_loss_backward(grad_output=grad_output, self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, total_weight=total_weight, out=out) if _capturing(): _captured = _capture_call(nll_loss_backward, (grad_output, input, target, weight, reduction, ignore_index, total_weight), {}) if _captured is not None: return _captured return _C.nll_loss_backward(grad_output=grad_output, self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, total_weight=total_weight) [docs] def nll_loss2d(input, target, weight=None, reduction=1, ignore_index=-100, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nll_loss2d, (input, target, weight, reduction, ignore_index), {'out': out}) if _captured is not None: return _captured return _C.nll_loss2d(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, out=out) if _capturing(): _captured = _capture_call(nll_loss2d, (input, target, weight, reduction, ignore_index), {}) if _captured is not None: return _captured return _C.nll_loss2d(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index) def nll_loss2d_backward(grad_output, input, target, weight=None, reduction=1, ignore_index=-100, total_weight=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nll_loss2d_backward, (grad_output, input, target, weight, reduction, ignore_index, total_weight), {'out': out}) if _captured is not None: return _captured return _C.nll_loss2d_backward(grad_output=grad_output, self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, total_weight=total_weight, out=out) if _capturing(): _captured = _capture_call(nll_loss2d_backward, (grad_output, input, target, weight, reduction, ignore_index, total_weight), {}) if _captured is not None: return _captured return _C.nll_loss2d_backward(grad_output=grad_output, self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, total_weight=total_weight) def _ctc_loss(log_probs, targets, input_lengths, target_lengths, blank=0, zero_infinity=False): if _capturing(): _captured = _capture_call(_ctc_loss, (log_probs, targets, input_lengths, target_lengths, blank, zero_infinity), {}) if _captured is not None: return _captured return _C._ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, zero_infinity) def _ctc_loss_backward(grad_output, log_probs, targets, input_lengths, target_lengths, neg_log_likelihood, log_alpha, blank, zero_infinity): if _capturing(): _captured = _capture_call(_ctc_loss_backward, (grad_output, log_probs, targets, input_lengths, target_lengths, neg_log_likelihood, log_alpha, blank, zero_infinity), {}) if _captured is not None: return _captured return _C._ctc_loss_backward(grad_output, log_probs, targets, input_lengths, target_lengths, neg_log_likelihood, log_alpha, blank, zero_infinity) [docs] def mse_loss(input, target, reduction=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(mse_loss, (input, target, reduction), {'out': out}) if _captured is not None: return _captured return _C.mse_loss(self=input, target=target, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(mse_loss, (input, target, reduction), {}) if _captured is not None: return _captured return _C.mse_loss(self=input, target=target, reduction=reduction) def mse_loss_backward(grad_output, input, target, reduction=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(mse_loss_backward, (grad_output, input, target, reduction), {'out': out}) if _captured is not None: return _captured return _C.mse_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(mse_loss_backward, (grad_output, input, target, reduction), {}) if _captured is not None: return _captured return _C.mse_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction) def max_pool2d_backward(grad_output, input, kernel_size, stride=([]), padding=([0, 0]), dilation=([1, 1]), ceil_mode=False): if _capturing(): _captured = _capture_call(max_pool2d_backward, (grad_output, input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.max_pool2d_backward(grad_output, input, kernel_size, stride, padding, dilation, ceil_mode) def max_pool3d_backward(grad_output, input, kernel_size, stride=([]), padding=([0, 0, 0]), dilation=([1, 1, 1]), ceil_mode=False): if _capturing(): _captured = _capture_call(max_pool3d_backward, (grad_output, input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.max_pool3d_backward(grad_output, input, kernel_size, stride, padding, dilation, ceil_mode) def max_pool2d_with_indices_backward(grad_output, input, kernel_size, stride=[], padding=[], dilation=[], ceil_mode=False, indices=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(max_pool2d_with_indices_backward, (grad_output, input, kernel_size, stride, padding, dilation, ceil_mode, indices), {'out': out}) if _captured is not None: return _captured return _C.max_pool2d_with_indices_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode, indices=indices, out=out) if _capturing(): _captured = _capture_call(max_pool2d_with_indices_backward, (grad_output, input, kernel_size, stride, padding, dilation, ceil_mode, indices), {}) if _captured is not None: return _captured return _C.max_pool2d_with_indices_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode, indices=indices) def max_pool3d_with_indices_backward(grad_output, input, kernel_size, stride=[], padding=[], dilation=[], ceil_mode=False, indices=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(max_pool3d_with_indices_backward, (grad_output, input, kernel_size, stride, padding, dilation, ceil_mode, indices), {'out': out}) if _captured is not None: return _captured return _C.max_pool3d_with_indices_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode, indices=indices, out=out) if _capturing(): _captured = _capture_call(max_pool3d_with_indices_backward, (grad_output, input, kernel_size, stride, padding, dilation, ceil_mode, indices), {}) if _captured is not None: return _captured return _C.max_pool3d_with_indices_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, ceil_mode=ceil_mode, indices=indices) def avg_pool2d_backward(grad_output, input, kernel_size, stride=[], padding=[], ceil_mode=False, count_include_pad=True, divisor_override=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(avg_pool2d_backward, (grad_output, input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {'out': out}) if _captured is not None: return _captured return _C.avg_pool2d_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override, out=out) if _capturing(): _captured = _capture_call(avg_pool2d_backward, (grad_output, input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {}) if _captured is not None: return _captured return _C.avg_pool2d_backward(grad_output=grad_output, input=input, kernel_size=kernel_size, stride=stride, padding=padding, ceil_mode=ceil_mode, count_include_pad=count_include_pad, divisor_override=divisor_override) def adaptive_avg_pool2d_backward(grad_output, input): if _capturing(): _captured = _capture_call(adaptive_avg_pool2d_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.adaptive_avg_pool2d_backward(grad_output, input) def adaptive_max_pool2d_backward(grad_output, input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(adaptive_max_pool2d_backward, (grad_output, input), {'out': out}) if _captured is not None: return _captured return _C.adaptive_max_pool2d_backward(grad_output=grad_output, input=input, out=out) if _capturing(): _captured = _capture_call(adaptive_max_pool2d_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.adaptive_max_pool2d_backward(grad_output=grad_output, input=input) def adaptive_max_pool2d_with_indices_backward(grad_output, input, output_size, indices): if _capturing(): _captured = _capture_call(adaptive_max_pool2d_with_indices_backward, (grad_output, input, output_size, indices), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.adaptive_max_pool2d_with_indices_backward(grad_output, input, output_size, indices) def adaptive_max_pool3d_backward(grad_output, input, indices, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(adaptive_max_pool3d_backward, (grad_output, input, indices), {'out': out}) if _captured is not None: return _captured return _C.adaptive_max_pool3d_backward(grad_output=grad_output, input=input, indices=indices, out=out) if _capturing(): _captured = _capture_call(adaptive_max_pool3d_backward, (grad_output, input, indices), {}) if _captured is not None: return _captured return _C.adaptive_max_pool3d_backward(grad_output=grad_output, input=input, indices=indices) [docs] def batch_norm(input, weight, bias, running_mean, running_var, training, momentum, eps): if _capturing(): _captured = _capture_call(batch_norm, (input, weight, bias, running_mean, running_var, training, momentum, eps), {}) if _captured is not None: return _captured return _C.batch_norm(input, weight, bias, running_mean, running_var, training, momentum, eps) [docs] def layer_norm(input, normalized_shape, weight=None, bias=None, eps=1e-5): if _capturing(): _captured = _capture_call(layer_norm, (input, normalized_shape, weight, bias, eps), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C.layer_norm(input, normalized_shape, weight, bias, eps) [docs] def group_norm(input, num_groups, weight=None, bias=None, eps=1e-5): if _capturing(): _captured = _capture_call(group_norm, (input, num_groups, weight, bias, eps), {}) if _captured is not None: return _captured return _C.group_norm(input, num_groups, weight, bias, eps) [docs] def instance_norm(input, weight=None, bias=None, running_mean=None, running_var=None, use_input_stats=True, momentum=0.1, eps=1e-5): if _capturing(): _captured = _capture_call(instance_norm, (input, weight, bias, running_mean, running_var, use_input_stats, momentum, eps), {}) if _captured is not None: return _captured return _C.instance_norm(input, weight, bias, running_mean, running_var, use_input_stats, momentum, eps) def batch_norm_backward(grad_output, input, weight=None, running_mean=None, running_var=None, training=True, eps=1e-5): if _capturing(): _captured = _capture_call(batch_norm_backward, (grad_output, input, weight, running_mean, running_var, training, eps), {}) if _captured is not None: return _captured return _C.batch_norm_backward(grad_output, input, weight, running_mean, running_var, training, eps) def layer_norm_backward(grad_output, input, normalized_shape, weight=None, bias=None, eps=1e-5): if _capturing(): _captured = _capture_call(layer_norm_backward, (grad_output, input, normalized_shape, weight, bias, eps), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C.layer_norm_backward(grad_output, input, normalized_shape, weight, bias, eps) def group_norm_backward(grad_output, input, num_groups, weight=None, bias=None, eps=1e-5): if _capturing(): _captured = _capture_call(group_norm_backward, (grad_output, input, num_groups, weight, bias, eps), {}) if _captured is not None: return _captured return _C.group_norm_backward(grad_output, input, num_groups, weight, bias, eps) def instance_norm_backward(grad_output, input, weight=None, bias=None, running_mean=None, running_var=None, use_input_stats=True, eps=1e-5): if _capturing(): _captured = _capture_call(instance_norm_backward, (grad_output, input, weight, bias, running_mean, running_var, use_input_stats, eps), {}) if _captured is not None: return _captured return _C.instance_norm_backward(grad_output, input, weight, bias, running_mean, running_var, use_input_stats, eps) [docs] def multinomial(input, num_samples, replacement=False, *, generator=None, out=None): if out is not None: if _capturing(): _captured = _capture_call(multinomial, (input, num_samples, replacement), {'generator': generator, 'out': out}) if _captured is not None: return _captured return _C.multinomial(self=input, num_samples=num_samples, replacement=replacement, generator=generator, out=out) if _capturing(): _captured = _capture_call(multinomial, (input, num_samples, replacement), {'generator': generator}) if _captured is not None: return _captured return _C.multinomial(self=input, num_samples=num_samples, replacement=replacement, generator=generator) [docs] def topk(input, k, dim=-1, largest=True, sorted=True, impl=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(topk, (input, k, dim, largest, sorted, impl), {'out': out}) if _captured is not None: return _captured return _C.topk(self=input, k=k, dim=dim, largest=largest, sorted=sorted, impl=impl, out=out) if _capturing(): _captured = _capture_call(topk, (input, k, dim, largest, sorted, impl), {}) if _captured is not None: return _captured return _C.topk(self=input, k=k, dim=dim, largest=largest, sorted=sorted, impl=impl) [docs] def sample(logits, temperature=1.0, top_k=0, top_p=1.0, impl=0): if _capturing(): _captured = _capture_call(sample, (logits, temperature, top_k, top_p, impl), {}) if _captured is not None: return _captured return _C.sample(logits, temperature, top_k, top_p, impl) [docs] def scaled_dot_product_attention(query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False, scale=None, enable_gqa=False): if _capturing(): _captured = _capture_call(scaled_dot_product_attention, (query, key, value, attn_mask, dropout_p, is_causal, scale, enable_gqa), {}) if _captured is not None: return _captured return _C.scaled_dot_product_attention(query, key, value, attn_mask, dropout_p, is_causal, scale=scale, enable_gqa=enable_gqa) def _scaled_dot_product_attention_with_lse(query, key, value, is_causal=False, impl=0): if _capturing(): _captured = _capture_call(_scaled_dot_product_attention_with_lse, (query, key, value, is_causal, impl), {}) if _captured is not None: return _captured return _C._scaled_dot_product_attention_with_lse(query, key, value, is_causal, impl) def scaled_dot_product_attention_backward(grad_output, query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False, scale=None, enable_gqa=False): if _capturing(): _captured = _capture_call(scaled_dot_product_attention_backward, (grad_output, query, key, value, attn_mask, dropout_p, is_causal, scale, enable_gqa), {}) if _captured is not None: return _captured return _C.scaled_dot_product_attention_backward(grad_output, query, key, value, attn_mask, dropout_p, is_causal, scale=scale, enable_gqa=enable_gqa) def _scaled_dot_product_attention_backward_with_lse(grad_output, query, key, value, output, logsumexp, is_causal=False, impl=0): if _capturing(): _captured = _capture_call(_scaled_dot_product_attention_backward_with_lse, (grad_output, query, key, value, output, logsumexp, is_causal, impl), {}) if _captured is not None: return _captured return _C._scaled_dot_product_attention_backward_with_lse(grad_output, query, key, value, output, logsumexp, is_causal, impl) [docs] def tp_l1_loss(input, target, reduction=1): if _capturing(): _captured = _capture_call(tp_l1_loss, (input, target, reduction), {}) if _captured is not None: return _captured return _C.tp_l1_loss(input, target, reduction) def tp_l1_loss_backward(grad_output, input, target, reduction=1): if _capturing(): _captured = _capture_call(tp_l1_loss_backward, (grad_output, input, target, reduction), {}) if _captured is not None: return _captured return _C.tp_l1_loss_backward(grad_output, input, target, reduction) [docs] def tp_kl_div(input, target, reduction=1, log_target=False): if _capturing(): _captured = _capture_call(tp_kl_div, (input, target, reduction, log_target), {}) if _captured is not None: return _captured return _C.tp_kl_div(input, target, reduction, log_target) def tp_kl_div_backward(grad_output, input, target, reduction=1, log_target=False): if _capturing(): _captured = _capture_call(tp_kl_div_backward, (grad_output, input, target, reduction, log_target), {}) if _captured is not None: return _captured return _C.tp_kl_div_backward(grad_output, input, target, reduction, log_target) [docs] def tp_margin_ranking_loss(input1, input2, target, margin=0.0, reduction=1): if _capturing(): _captured = _capture_call(tp_margin_ranking_loss, (input1, input2, target, margin, reduction), {}) if _captured is not None: return _captured return _C.tp_margin_ranking_loss(input1, input2, target, margin, reduction) def tp_margin_ranking_loss_backward(grad_output, input1, input2, target, margin=0.0, reduction=1): if _capturing(): _captured = _capture_call(tp_margin_ranking_loss_backward, (grad_output, input1, input2, target, margin, reduction), {}) if _captured is not None: return _captured return _C.tp_margin_ranking_loss_backward(grad_output, input1, input2, target, margin, reduction) [docs] def tp_hinge_embedding_loss(input, target, margin=1.0, reduction=1): if _capturing(): _captured = _capture_call(tp_hinge_embedding_loss, (input, target, margin, reduction), {}) if _captured is not None: return _captured return _C.tp_hinge_embedding_loss(input, target, margin, reduction) def tp_hinge_embedding_loss_backward(grad_output, input, target, margin=1.0, reduction=1): if _capturing(): _captured = _capture_call(tp_hinge_embedding_loss_backward, (grad_output, input, target, margin, reduction), {}) if _captured is not None: return _captured return _C.tp_hinge_embedding_loss_backward(grad_output, input, target, margin, reduction) [docs] def tp_soft_margin_loss(input, target, reduction=1): if _capturing(): _captured = _capture_call(tp_soft_margin_loss, (input, target, reduction), {}) if _captured is not None: return _captured return _C.tp_soft_margin_loss(input, target, reduction) def tp_soft_margin_loss_backward(grad_output, input, target, reduction=1): if _capturing(): _captured = _capture_call(tp_soft_margin_loss_backward, (grad_output, input, target, reduction), {}) if _captured is not None: return _captured return _C.tp_soft_margin_loss_backward(grad_output, input, target, reduction) [docs] def tp_cosine_embedding_loss(input1, input2, target, margin=0.0, reduction=1): if _capturing(): _captured = _capture_call(tp_cosine_embedding_loss, (input1, input2, target, margin, reduction), {}) if _captured is not None: return _captured return _C.tp_cosine_embedding_loss(input1, input2, target, margin, reduction) def tp_cosine_embedding_loss_backward(grad_output, input1, input2, target, margin=0.0, reduction=1): if _capturing(): _captured = _capture_call(tp_cosine_embedding_loss_backward, (grad_output, input1, input2, target, margin, reduction), {}) if _captured is not None: return _captured return _C.tp_cosine_embedding_loss_backward(grad_output, input1, input2, target, margin, reduction) [docs] def tp_poisson_nll_loss(input, target, log_input=True, full=False, eps=1e-08, reduction=1): if _capturing(): _captured = _capture_call(tp_poisson_nll_loss, (input, target, log_input, full, eps, reduction), {}) if _captured is not None: return _captured return _C.tp_poisson_nll_loss(input, target, log_input, full, eps, reduction) def tp_poisson_nll_loss_backward(grad_output, input, target, log_input=True, full=False, eps=1e-08, reduction=1): if _capturing(): _captured = _capture_call(tp_poisson_nll_loss_backward, (grad_output, input, target, log_input, full, eps, reduction), {}) if _captured is not None: return _captured return _C.tp_poisson_nll_loss_backward(grad_output, input, target, log_input, full, eps, reduction) [docs] def fft_fft(input, n=-1, dim=-1, norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_fft, (input, n, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_fft(self=input, n=n, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_fft, (input, n, dim, norm), {}) if _captured is not None: return _captured return _C.fft_fft(self=input, n=n, dim=dim, norm=norm) [docs] def fft_ifft(input, n=-1, dim=-1, norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_ifft, (input, n, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_ifft(self=input, n=n, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_ifft, (input, n, dim, norm), {}) if _captured is not None: return _captured return _C.fft_ifft(self=input, n=n, dim=dim, norm=norm) [docs] def fft_rfft(input, n=-1, dim=-1, norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_rfft, (input, n, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_rfft(self=input, n=n, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_rfft, (input, n, dim, norm), {}) if _captured is not None: return _captured return _C.fft_rfft(self=input, n=n, dim=dim, norm=norm) [docs] def fft_irfft(input, n=-1, dim=-1, norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_irfft, (input, n, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_irfft(self=input, n=n, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_irfft, (input, n, dim, norm), {}) if _captured is not None: return _captured return _C.fft_irfft(self=input, n=n, dim=dim, norm=norm) [docs] def fft_fft2(input, s=None, dim=[-2,-1], norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_fft2, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_fft2(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_fft2, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_fft2(self=input, s=s, dim=dim, norm=norm) [docs] def fft_ifft2(input, s=None, dim=[-2,-1], norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_ifft2, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_ifft2(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_ifft2, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_ifft2(self=input, s=s, dim=dim, norm=norm) [docs] def fft_rfft2(input, s=None, dim=[-2,-1], norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_rfft2, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_rfft2(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_rfft2, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_rfft2(self=input, s=s, dim=dim, norm=norm) [docs] def fft_irfft2(input, s=None, dim=[-2,-1], norm='backward', *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_irfft2, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_irfft2(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_irfft2, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_irfft2(self=input, s=s, dim=dim, norm=norm) def fft_fft2_backward(grad_output, input, s=None, dim=[-2,-1], norm='backward'): if _capturing(): _captured = _capture_call(fft_fft2_backward, (grad_output, input, s, dim, norm), {}) if _captured is not None: return _captured if isinstance(s, int) and not isinstance(s, bool): s = [s] if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.fft_fft2_backward(grad_output, input, s, dim, norm) def fft_ifft2_backward(grad_output, input, s=None, dim=[-2,-1], norm='backward'): if _capturing(): _captured = _capture_call(fft_ifft2_backward, (grad_output, input, s, dim, norm), {}) if _captured is not None: return _captured if isinstance(s, int) and not isinstance(s, bool): s = [s] if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.fft_ifft2_backward(grad_output, input, s, dim, norm) def fft_rfft2_backward(grad_output, input, s=None, dim=[-2,-1], norm='backward'): if _capturing(): _captured = _capture_call(fft_rfft2_backward, (grad_output, input, s, dim, norm), {}) if _captured is not None: return _captured if isinstance(s, int) and not isinstance(s, bool): s = [s] if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.fft_rfft2_backward(grad_output, input, s, dim, norm) def fft_irfft2_backward(grad_output, input, s=None, dim=[-2,-1], norm='backward'): if _capturing(): _captured = _capture_call(fft_irfft2_backward, (grad_output, input, s, dim, norm), {}) if _captured is not None: return _captured if isinstance(s, int) and not isinstance(s, bool): s = [s] if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.fft_irfft2_backward(grad_output, input, s, dim, norm) def fft_fft_backward(grad_output, input, dim, norm): if _capturing(): _captured = _capture_call(fft_fft_backward, (grad_output, input, dim, norm), {}) if _captured is not None: return _captured return _C.fft_fft_backward(grad_output, input, dim, norm) def fft_ifft_backward(grad_output, input, dim, norm): if _capturing(): _captured = _capture_call(fft_ifft_backward, (grad_output, input, dim, norm), {}) if _captured is not None: return _captured return _C.fft_ifft_backward(grad_output, input, dim, norm) def fft_rfft_backward(grad_output, input, dim, norm, n=-1): if _capturing(): _captured = _capture_call(fft_rfft_backward, (grad_output, input, dim, norm, n), {}) if _captured is not None: return _captured return _C.fft_rfft_backward(grad_output, input, dim, norm, n) def fft_irfft_backward(grad_output, input, dim, norm): if _capturing(): _captured = _capture_call(fft_irfft_backward, (grad_output, input, dim, norm), {}) if _captured is not None: return _captured return _C.fft_irfft_backward(grad_output, input, dim, norm) [docs] def hann_window(window_length, periodic=True, dtype=None, *, device=None, layout=None, pin_memory=None): if _capturing(): _captured = _capture_call(hann_window, (window_length, periodic, dtype), {'device': device, 'layout': layout, 'pin_memory': pin_memory}) if _captured is not None: return _captured if device is None and layout is None and pin_memory is None: if dtype is None: dtype = DType.undefined return _C.hann_window(window_length, periodic, dtype) return _C.hann_window(window_length, periodic, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) [docs] def hamming_window(window_length, periodic=True, alpha=0.54, beta=0.46, dtype=None, *, device=None, layout=None, pin_memory=None): if _capturing(): _captured = _capture_call(hamming_window, (window_length, periodic, alpha, beta, dtype), {'device': device, 'layout': layout, 'pin_memory': pin_memory}) if _captured is not None: return _captured if device is None and layout is None and pin_memory is None: if dtype is None: dtype = DType.undefined return _C.hamming_window(window_length, periodic, alpha, beta, dtype) return _C.hamming_window(window_length, periodic, alpha, beta, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) [docs] def bartlett_window(window_length, periodic=True, dtype=None, *, device=None, layout=None, pin_memory=None): if _capturing(): _captured = _capture_call(bartlett_window, (window_length, periodic, dtype), {'device': device, 'layout': layout, 'pin_memory': pin_memory}) if _captured is not None: return _captured if device is None and layout is None and pin_memory is None: if dtype is None: dtype = DType.undefined return _C.bartlett_window(window_length, periodic, dtype) return _C.bartlett_window(window_length, periodic, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) [docs] def blackman_window(window_length, periodic=True, dtype=None, *, device=None, layout=None, pin_memory=None): if _capturing(): _captured = _capture_call(blackman_window, (window_length, periodic, dtype), {'device': device, 'layout': layout, 'pin_memory': pin_memory}) if _captured is not None: return _captured if device is None and layout is None and pin_memory is None: if dtype is None: dtype = DType.undefined return _C.blackman_window(window_length, periodic, dtype) return _C.blackman_window(window_length, periodic, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) [docs] def stft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, pad_mode='reflect', normalized=False, onesided=True, return_complex=True): if _capturing(): _captured = _capture_call(stft, (input, n_fft, hop_length, win_length, window, center, pad_mode, normalized, onesided, return_complex), {}) if _captured is not None: return _captured return _C.stft(input, n_fft, hop_length, win_length, window, center, pad_mode, normalized, onesided, return_complex) [docs] def istft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, normalized=False, onesided=True, length=None, return_complex=False): if _capturing(): _captured = _capture_call(istft, (input, n_fft, hop_length, win_length, window, center, normalized, onesided, length, return_complex), {}) if _captured is not None: return _captured return _C.istft(input, n_fft, hop_length, win_length, window, center, normalized, onesided, length, return_complex) def stft_backward(grad_output, input, n_fft, hop_length=None, win_length=None, window=None, center=True, pad_mode='reflect', normalized=False, onesided=True): if _capturing(): _captured = _capture_call(stft_backward, (grad_output, input, n_fft, hop_length, win_length, window, center, pad_mode, normalized, onesided), {}) if _captured is not None: return _captured return _C.stft_backward(grad_output, input, n_fft, hop_length, win_length, window, center, pad_mode, normalized, onesided) [docs] def cumsum(input, dim=0, dtype=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cumsum, (input, dim, dtype), {'out': out}) if _captured is not None: return _captured return _C.cumsum(self=input, dim=dim, dtype=dtype, out=out) if _capturing(): _captured = _capture_call(cumsum, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.cumsum(self=input, dim=dim, dtype=dtype) [docs] def flip(input, dims=[]): if _capturing(): _captured = _capture_call(flip, (input, dims), {}) if _captured is not None: return _captured if isinstance(dims, int) and not isinstance(dims, bool): dims = [dims] return _C.flip(input, dims) [docs] def index_select(input, dim, index, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(index_select, (input, dim, index), {'out': out}) if _captured is not None: return _captured return _C.index_select(self=input, dim=dim, index=index, out=out) if _capturing(): _captured = _capture_call(index_select, (input, dim, index), {}) if _captured is not None: return _captured return _C.index_select(self=input, dim=dim, index=index) [docs] def index_add(input, dim, index, source, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(index_add, (input, dim, index, source), {'out': out}) if _captured is not None: return _captured return _C.index_add(self=input, dim=dim, index=index, source=source, out=out) if _capturing(): _captured = _capture_call(index_add, (input, dim, index, source), {}) if _captured is not None: return _captured return _C.index_add(self=input, dim=dim, index=index, source=source) [docs] def nonzero(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nonzero, (input,), {'out': out}) if _captured is not None: return _captured return _C.nonzero(self=input, out=out) if _capturing(): _captured = _capture_call(nonzero, (input,), {}) if _captured is not None: return _captured return _C.nonzero(self=input) [docs] def unique(input, sorted=True, return_inverse=False, return_counts=False, dim=None): if dim is not None: values, inverse, counts = unique_dim(input, dim, sorted, return_inverse, return_counts) outs = [values] if return_inverse: outs.append(inverse) if return_counts: outs.append(counts) return outs[0] if len(outs) == 1 else tuple(outs) if _capturing(): _captured = _capture_call(unique, (input, sorted, return_inverse, return_counts), {}) if _captured is not None: return _captured values, inverse, counts = _C.unique(input, sorted, return_inverse, return_counts) outs = [values] if return_inverse: outs.append(inverse) if return_counts: outs.append(counts) return outs[0] if len(outs) == 1 else tuple(outs) [docs] def count_nonzero(input, dim=[]): if _capturing(): _captured = _capture_call(count_nonzero, (input, dim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.count_nonzero(input, dim) [docs] def log10(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log10, (input,), {'out': out}) if _captured is not None: return _captured return _C.log10(self=input, out=out) if _capturing(): _captured = _capture_call(log10, (input,), {}) if _captured is not None: return _captured return _C.log10(self=input) [docs] def log1p(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log1p, (input,), {'out': out}) if _captured is not None: return _captured return _C.log1p(self=input, out=out) if _capturing(): _captured = _capture_call(log1p, (input,), {}) if _captured is not None: return _captured return _C.log1p(self=input) [docs] def frac(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(frac, (input,), {'out': out}) if _captured is not None: return _captured return _C.frac(self=input, out=out) if _capturing(): _captured = _capture_call(frac, (input,), {}) if _captured is not None: return _captured return _C.frac(self=input) [docs] def i0(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(i0, (input,), {'out': out}) if _captured is not None: return _captured return _C.i0(self=input, out=out) if _capturing(): _captured = _capture_call(i0, (input,), {}) if _captured is not None: return _captured return _C.i0(self=input) [docs] def polar(abs, angle, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(polar, (abs, angle), {'out': out}) if _captured is not None: return _captured return _C.polar(abs=abs, angle=angle, out=out) if _capturing(): _captured = _capture_call(polar, (abs, angle), {}) if _captured is not None: return _captured return _C.polar(abs=abs, angle=angle) [docs] def real(input): if _capturing(): _captured = _capture_call(real, (input,), {}) if _captured is not None: return _captured return _C.real(input) [docs] def diff(input, n=1, dim=-1, prepend=None, append=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(diff, (input, n, dim, prepend, append), {'out': out}) if _captured is not None: return _captured return _C.diff(self=input, n=n, dim=dim, prepend=prepend, append=append, out=out) if _capturing(): _captured = _capture_call(diff, (input, n, dim, prepend, append), {}) if _captured is not None: return _captured return _C.diff(self=input, n=n, dim=dim, prepend=prepend, append=append) [docs] def logical_and(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logical_and, (input, other), {'out': out}) if _captured is not None: return _captured return _C.logical_and(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(logical_and, (input, other), {}) if _captured is not None: return _captured return _C.logical_and(self=input, other=other) [docs] def cross(input, other, dim=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cross, (input, other, dim), {'out': out}) if _captured is not None: return _captured return _C.cross(self=input, other=other, dim=dim, out=out) if _capturing(): _captured = _capture_call(cross, (input, other, dim), {}) if _captured is not None: return _captured return _C.cross(self=input, other=other, dim=dim) [docs] def roll(input, shifts, dims=[]): if _capturing(): _captured = _capture_call(roll, (input, shifts, dims), {}) if _captured is not None: return _captured if isinstance(shifts, int) and not isinstance(shifts, bool): shifts = [shifts] if isinstance(dims, int) and not isinstance(dims, bool): dims = [dims] return _C.roll(input, shifts, dims) [docs] def unfold(input, dimension, size, step): if _capturing(): _captured = _capture_call(unfold, (input, dimension, size, step), {}) if _captured is not None: return _captured return _C.unfold(input, dimension, size, step) def unfold_backward(grad_output, input_sizes, dim, size, step): if _capturing(): _captured = _capture_call(unfold_backward, (grad_output, input_sizes, dim, size, step), {}) if _captured is not None: return _captured if isinstance(input_sizes, int) and not isinstance(input_sizes, bool): input_sizes = [input_sizes] return _C.unfold_backward(grad_output, input_sizes, dim, size, step) [docs] def threshold(input, threshold, value, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(threshold, (input, threshold, value), {'out': out}) if _captured is not None: return _captured return _C.threshold(self=input, threshold=threshold, value=value, out=out) if _capturing(): _captured = _capture_call(threshold, (input, threshold, value), {}) if _captured is not None: return _captured return _C.threshold(self=input, threshold=threshold, value=value) [docs] def relu6(input): if _capturing(): _captured = _capture_call(relu6, (input,), {}) if _captured is not None: return _captured return _C.relu6(input) [docs] def leaky_relu(input, negative_slope=0.01, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(leaky_relu, (input, negative_slope), {'out': out}) if _captured is not None: return _captured return _C.leaky_relu(self=input, negative_slope=negative_slope, out=out) if _capturing(): _captured = _capture_call(leaky_relu, (input, negative_slope), {}) if _captured is not None: return _captured return _C.leaky_relu(self=input, negative_slope=negative_slope) def leaky_relu_backward(grad_output, input, negative_slope, self_is_result, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(leaky_relu_backward, (grad_output, input, negative_slope, self_is_result), {'out': out}) if _captured is not None: return _captured return _C.leaky_relu_backward(grad_output=grad_output, self=input, negative_slope=negative_slope, self_is_result=self_is_result, out=out) if _capturing(): _captured = _capture_call(leaky_relu_backward, (grad_output, input, negative_slope, self_is_result), {}) if _captured is not None: return _captured return _C.leaky_relu_backward(grad_output=grad_output, self=input, negative_slope=negative_slope, self_is_result=self_is_result) [docs] def rrelu_with_noise(input, noise, lower=0.125, upper=0.3333333333333333, training=False, generator=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(rrelu_with_noise, (input, noise, lower, upper, training, generator), {'out': out}) if _captured is not None: return _captured return _C.rrelu_with_noise(self=input, noise=noise, lower=lower, upper=upper, training=training, generator=generator, out=out) if _capturing(): _captured = _capture_call(rrelu_with_noise, (input, noise, lower, upper, training, generator), {}) if _captured is not None: return _captured return _C.rrelu_with_noise(self=input, noise=noise, lower=lower, upper=upper, training=training, generator=generator) def rrelu_with_noise_backward(grad_output, input, noise, lower, upper, training, self_is_result): if _capturing(): _captured = _capture_call(rrelu_with_noise_backward, (grad_output, input, noise, lower, upper, training, self_is_result), {}) if _captured is not None: return _captured if not isinstance(lower, (tensorplay.Scalar, tensorplay.Tensor)): lower = tensorplay.Scalar(lower) if not isinstance(upper, (tensorplay.Scalar, tensorplay.Tensor)): upper = tensorplay.Scalar(upper) return _C.rrelu_with_noise_backward(grad_output, input, noise, lower, upper, training, self_is_result) [docs] def log_sigmoid(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log_sigmoid, (input,), {'out': out}) if _captured is not None: return _captured return _C.log_sigmoid(self=input, out=out) if _capturing(): _captured = _capture_call(log_sigmoid, (input,), {}) if _captured is not None: return _captured return _C.log_sigmoid(self=input) def log_sigmoid_backward(grad_output, input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log_sigmoid_backward, (grad_output, input), {'out': out}) if _captured is not None: return _captured return _C.log_sigmoid_backward(grad_output=grad_output, self=input, out=out) if _capturing(): _captured = _capture_call(log_sigmoid_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.log_sigmoid_backward(grad_output=grad_output, self=input) [docs] def hardtanh(input, min_val=-1, max_val=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hardtanh, (input, min_val, max_val), {'out': out}) if _captured is not None: return _captured return _C.hardtanh(self=input, min_val=min_val, max_val=max_val, out=out) if _capturing(): _captured = _capture_call(hardtanh, (input, min_val, max_val), {}) if _captured is not None: return _captured return _C.hardtanh(self=input, min_val=min_val, max_val=max_val) def hardtanh_backward(grad_output, input, min_val, max_val, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hardtanh_backward, (grad_output, input, min_val, max_val), {'out': out}) if _captured is not None: return _captured return _C.hardtanh_backward(grad_output=grad_output, self=input, min_val=min_val, max_val=max_val, out=out) if _capturing(): _captured = _capture_call(hardtanh_backward, (grad_output, input, min_val, max_val), {}) if _captured is not None: return _captured return _C.hardtanh_backward(grad_output=grad_output, self=input, min_val=min_val, max_val=max_val) [docs] def hardswish(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hardswish, (input,), {'out': out}) if _captured is not None: return _captured return _C.hardswish(self=input, out=out) if _capturing(): _captured = _capture_call(hardswish, (input,), {}) if _captured is not None: return _captured return _C.hardswish(self=input) def hardswish_backward(grad_output, input): if _capturing(): _captured = _capture_call(hardswish_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.hardswish_backward(grad_output, input) def sec(input): if _capturing(): _captured = _capture_call(sec, (input,), {}) if _captured is not None: return _captured return _C.sec(input) def csc(input): if _capturing(): _captured = _capture_call(csc, (input,), {}) if _captured is not None: return _captured return _C.csc(input) def cot(input): if _capturing(): _captured = _capture_call(cot, (input,), {}) if _captured is not None: return _captured return _C.cot(input) def tanhshrink(input): if _capturing(): _captured = _capture_call(tanhshrink, (input,), {}) if _captured is not None: return _captured return _C.tanhshrink(input) def squared_difference(input, other): if _capturing(): _captured = _capture_call(squared_difference, (input, other), {}) if _captured is not None: return _captured return _C.squared_difference(input, other) def swish(input): if _capturing(): _captured = _capture_call(swish, (input,), {}) if _captured is not None: return _captured return _C.swish(input) [docs] def hardsigmoid(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hardsigmoid, (input,), {'out': out}) if _captured is not None: return _captured return _C.hardsigmoid(self=input, out=out) if _capturing(): _captured = _capture_call(hardsigmoid, (input,), {}) if _captured is not None: return _captured return _C.hardsigmoid(self=input) def hardsigmoid_backward(grad_output, input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hardsigmoid_backward, (grad_output, input), {'out': out}) if _captured is not None: return _captured return _C.hardsigmoid_backward(grad_output=grad_output, self=input, out=out) if _capturing(): _captured = _capture_call(hardsigmoid_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.hardsigmoid_backward(grad_output=grad_output, self=input) [docs] def softplus(input, beta=1, threshold=20, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(softplus, (input, beta, threshold), {'out': out}) if _captured is not None: return _captured return _C.softplus(self=input, beta=beta, threshold=threshold, out=out) if _capturing(): _captured = _capture_call(softplus, (input, beta, threshold), {}) if _captured is not None: return _captured return _C.softplus(self=input, beta=beta, threshold=threshold) def softplus_backward(grad_output, input, beta, threshold, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(softplus_backward, (grad_output, input, beta, threshold), {'out': out}) if _captured is not None: return _captured return _C.softplus_backward(grad_output=grad_output, self=input, beta=beta, threshold=threshold, out=out) if _capturing(): _captured = _capture_call(softplus_backward, (grad_output, input, beta, threshold), {}) if _captured is not None: return _captured return _C.softplus_backward(grad_output=grad_output, self=input, beta=beta, threshold=threshold) [docs] def elu(input, alpha=1, scale=1, input_scale=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(elu, (input, alpha, scale, input_scale), {'out': out}) if _captured is not None: return _captured return _C.elu(self=input, alpha=alpha, scale=scale, input_scale=input_scale, out=out) if _capturing(): _captured = _capture_call(elu, (input, alpha, scale, input_scale), {}) if _captured is not None: return _captured return _C.elu(self=input, alpha=alpha, scale=scale, input_scale=input_scale) def elu_backward(grad_output, alpha, scale, input_scale, is_result, self_or_result, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(elu_backward, (grad_output, alpha, scale, input_scale, is_result, self_or_result), {'out': out}) if _captured is not None: return _captured return _C.elu_backward(grad_output=grad_output, alpha=alpha, scale=scale, input_scale=input_scale, is_result=is_result, self_or_result=self_or_result, out=out) if _capturing(): _captured = _capture_call(elu_backward, (grad_output, alpha, scale, input_scale, is_result, self_or_result), {}) if _captured is not None: return _captured return _C.elu_backward(grad_output=grad_output, alpha=alpha, scale=scale, input_scale=input_scale, is_result=is_result, self_or_result=self_or_result) [docs] def selu(input): if _capturing(): _captured = _capture_call(selu, (input,), {}) if _captured is not None: return _captured return _C.selu(input) [docs] def celu(input, alpha=1.0): if _capturing(): _captured = _capture_call(celu, (input, alpha), {}) if _captured is not None: return _captured if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C.celu(input, alpha) [docs] def mish(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(mish, (input,), {'out': out}) if _captured is not None: return _captured return _C.mish(self=input, out=out) if _capturing(): _captured = _capture_call(mish, (input,), {}) if _captured is not None: return _captured return _C.mish(self=input) def mish_backward(grad_output, input): if _capturing(): _captured = _capture_call(mish_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.mish_backward(grad_output, input) [docs] def softshrink(input, lambd=0.5, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(softshrink, (input, lambd), {'out': out}) if _captured is not None: return _captured return _C.softshrink(self=input, lambd=lambd, out=out) if _capturing(): _captured = _capture_call(softshrink, (input, lambd), {}) if _captured is not None: return _captured return _C.softshrink(self=input, lambd=lambd) def softshrink_backward(grad_output, input, lambd, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(softshrink_backward, (grad_output, input, lambd), {'out': out}) if _captured is not None: return _captured return _C.softshrink_backward(grad_output=grad_output, self=input, lambd=lambd, out=out) if _capturing(): _captured = _capture_call(softshrink_backward, (grad_output, input, lambd), {}) if _captured is not None: return _captured return _C.softshrink_backward(grad_output=grad_output, self=input, lambd=lambd) [docs] def hardshrink(input, lambd=0.5, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hardshrink, (input, lambd), {'out': out}) if _captured is not None: return _captured return _C.hardshrink(self=input, lambd=lambd, out=out) if _capturing(): _captured = _capture_call(hardshrink, (input, lambd), {}) if _captured is not None: return _captured return _C.hardshrink(self=input, lambd=lambd) def hardshrink_backward(grad_out, input, lambd, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hardshrink_backward, (grad_out, input, lambd), {'out': out}) if _captured is not None: return _captured return _C.hardshrink_backward(grad_out=grad_out, self=input, lambd=lambd, out=out) if _capturing(): _captured = _capture_call(hardshrink_backward, (grad_out, input, lambd), {}) if _captured is not None: return _captured return _C.hardshrink_backward(grad_out=grad_out, self=input, lambd=lambd) [docs] def glu(input, dim=-1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(glu, (input, dim), {'out': out}) if _captured is not None: return _captured return _C.glu(self=input, dim=dim, out=out) if _capturing(): _captured = _capture_call(glu, (input, dim), {}) if _captured is not None: return _captured return _C.glu(self=input, dim=dim) def glu_backward(grad_output, input, dim=-1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(glu_backward, (grad_output, input, dim), {'out': out}) if _captured is not None: return _captured return _C.glu_backward(grad_output=grad_output, self=input, dim=dim, out=out) if _capturing(): _captured = _capture_call(glu_backward, (grad_output, input, dim), {}) if _captured is not None: return _captured return _C.glu_backward(grad_output=grad_output, self=input, dim=dim) [docs] def one_hot(input, num_classes=-1): if _capturing(): _captured = _capture_call(one_hot, (input, num_classes), {}) if _captured is not None: return _captured return _C.one_hot(input, num_classes) [docs] def narrow(input, dim, start, length): if _capturing(): _captured = _capture_call(narrow, (input, dim, start, length), {}) if _captured is not None: return _captured return _C.narrow(input, dim, start, length) [docs] def pixel_shuffle(input, upscale_factor): if _capturing(): _captured = _capture_call(pixel_shuffle, (input, upscale_factor), {}) if _captured is not None: return _captured return _C.pixel_shuffle(input, upscale_factor) [docs] def pixel_unshuffle(input, downscale_factor): if _capturing(): _captured = _capture_call(pixel_unshuffle, (input, downscale_factor), {}) if _captured is not None: return _captured return _C.pixel_unshuffle(input, downscale_factor) [docs] def reflection_pad_nd(input, pad): if _capturing(): _captured = _capture_call(reflection_pad_nd, (input, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.reflection_pad_nd(input, pad) def reflection_pad_nd_backward(grad_output, input, pad): if _capturing(): _captured = _capture_call(reflection_pad_nd_backward, (grad_output, input, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.reflection_pad_nd_backward(grad_output, input, pad) [docs] def replication_pad_nd(input, pad): if _capturing(): _captured = _capture_call(replication_pad_nd, (input, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.replication_pad_nd(input, pad) def replication_pad_nd_backward(grad_output, input, pad): if _capturing(): _captured = _capture_call(replication_pad_nd_backward, (grad_output, input, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.replication_pad_nd_backward(grad_output, input, pad) [docs] def circular_pad_nd(input, pad): if _capturing(): _captured = _capture_call(circular_pad_nd, (input, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.circular_pad_nd(input, pad) def circular_pad_nd_backward(grad_output, input, pad): if _capturing(): _captured = _capture_call(circular_pad_nd_backward, (grad_output, input, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.circular_pad_nd_backward(grad_output, input, pad) [docs] def im2col(input, kernel_size, dilation=[], padding=[], stride=[], *, out=None): if out is not None: if _capturing(): _captured = _capture_call(im2col, (input, kernel_size, dilation, padding, stride), {'out': out}) if _captured is not None: return _captured return _C.im2col(self=input, kernel_size=kernel_size, dilation=dilation, padding=padding, stride=stride, out=out) if _capturing(): _captured = _capture_call(im2col, (input, kernel_size, dilation, padding, stride), {}) if _captured is not None: return _captured return _C.im2col(self=input, kernel_size=kernel_size, dilation=dilation, padding=padding, stride=stride) def im2col_backward(grad_output, input_size, kernel_size, dilation, padding, stride): if _capturing(): _captured = _capture_call(im2col_backward, (grad_output, input_size, kernel_size, dilation, padding, stride), {}) if _captured is not None: return _captured if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C.im2col_backward(grad_output, input_size, kernel_size, dilation, padding, stride) [docs] def col2im(input, output_size, kernel_size, dilation=[], padding=[], stride=[], *, out=None): if out is not None: if _capturing(): _captured = _capture_call(col2im, (input, output_size, kernel_size, dilation, padding, stride), {'out': out}) if _captured is not None: return _captured return _C.col2im(self=input, output_size=output_size, kernel_size=kernel_size, dilation=dilation, padding=padding, stride=stride, out=out) if _capturing(): _captured = _capture_call(col2im, (input, output_size, kernel_size, dilation, padding, stride), {}) if _captured is not None: return _captured return _C.col2im(self=input, output_size=output_size, kernel_size=kernel_size, dilation=dilation, padding=padding, stride=stride) def col2im_backward(grad_output, input_size, output_size, kernel_size, dilation, padding, stride): if _capturing(): _captured = _capture_call(col2im_backward, (grad_output, input_size, output_size, kernel_size, dilation, padding, stride), {}) if _captured is not None: return _captured if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C.col2im_backward(grad_output, input_size, output_size, kernel_size, dilation, padding, stride) [docs] def conv_transpose1d(input, weight, bias=None, stride=[], padding=[], output_padding=[], groups=1, dilation=[]): if _capturing(): _captured = _capture_call(conv_transpose1d, (input, weight, bias, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose1d(input, weight, bias, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose1d_grad_input(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose1d_grad_input, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose1d_grad_input(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose1d_grad_weight(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose1d_grad_weight, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose1d_grad_weight(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def conv_transpose1d_grad_bias(grad_output, input, weight, stride, padding, output_padding, groups, dilation): if _capturing(): _captured = _capture_call(conv_transpose1d_grad_bias, (grad_output, input, weight, stride, padding, output_padding, groups, dilation), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_transpose1d_grad_bias(grad_output, input, weight, stride, padding, output_padding, groups, dilation) [docs] def upsample_nearest1d(input, output_size, scales=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_nearest1d, (input, output_size, scales), {'out': out}) if _captured is not None: return _captured return _C.upsample_nearest1d(input, output_size, scales, out=out) if _capturing(): _captured = _capture_call(upsample_nearest1d, (input, output_size, scales), {}) if _captured is not None: return _captured return _C.upsample_nearest1d(input, output_size, scales) def upsample_nearest1d_backward(grad_output, output_size, input_size, scales=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_nearest1d_backward, (grad_output, output_size, input_size, scales), {'out': out}) if _captured is not None: return _captured return _C.upsample_nearest1d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales=scales, out=out) if _capturing(): _captured = _capture_call(upsample_nearest1d_backward, (grad_output, output_size, input_size, scales), {}) if _captured is not None: return _captured return _C.upsample_nearest1d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales=scales) [docs] def upsample_nearest2d(input, output_size, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_nearest2d, (input, output_size, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_nearest2d(input, output_size, scales_h, scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_nearest2d, (input, output_size, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_nearest2d(input, output_size, scales_h, scales_w) def upsample_nearest2d_backward(grad_output, output_size, input_size, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_nearest2d_backward, (grad_output, output_size, input_size, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_nearest2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_nearest2d_backward, (grad_output, output_size, input_size, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_nearest2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_h=scales_h, scales_w=scales_w) [docs] def upsample_nearest3d(input, output_size, scales_d=None, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_nearest3d, (input, output_size, scales_d, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_nearest3d(input, output_size, scales_d, scales_h, scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_nearest3d, (input, output_size, scales_d, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_nearest3d(input, output_size, scales_d, scales_h, scales_w) def upsample_nearest3d_backward(grad_output, output_size, input_size, scales_d=None, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_nearest3d_backward, (grad_output, output_size, input_size, scales_d, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_nearest3d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_d=scales_d, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_nearest3d_backward, (grad_output, output_size, input_size, scales_d, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_nearest3d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_d=scales_d, scales_h=scales_h, scales_w=scales_w) [docs] def upsample_linear1d(input, output_size, align_corners, scales=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_linear1d, (input, output_size, align_corners, scales), {'out': out}) if _captured is not None: return _captured return _C.upsample_linear1d(input, output_size, align_corners, scales, out=out) if _capturing(): _captured = _capture_call(upsample_linear1d, (input, output_size, align_corners, scales), {}) if _captured is not None: return _captured return _C.upsample_linear1d(input, output_size, align_corners, scales) def upsample_linear1d_backward(grad_output, output_size, input_size, align_corners, scales=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_linear1d_backward, (grad_output, output_size, input_size, align_corners, scales), {'out': out}) if _captured is not None: return _captured return _C.upsample_linear1d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales=scales, out=out) if _capturing(): _captured = _capture_call(upsample_linear1d_backward, (grad_output, output_size, input_size, align_corners, scales), {}) if _captured is not None: return _captured return _C.upsample_linear1d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales=scales) [docs] def upsample_bilinear2d(input, output_size, align_corners, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_bilinear2d, (input, output_size, align_corners, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_bilinear2d(input, output_size, align_corners, scales_h, scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_bilinear2d, (input, output_size, align_corners, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_bilinear2d(input, output_size, align_corners, scales_h, scales_w) def upsample_bilinear2d_backward(grad_output, output_size, input_size, align_corners, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_bilinear2d_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_bilinear2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_bilinear2d_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_bilinear2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w) [docs] def upsample_bicubic2d(input, output_size, align_corners, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_bicubic2d, (input, output_size, align_corners, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_bicubic2d(input, output_size, align_corners, scales_h, scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_bicubic2d, (input, output_size, align_corners, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_bicubic2d(input, output_size, align_corners, scales_h, scales_w) def upsample_bicubic2d_backward(grad_output, output_size, input_size, align_corners, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_bicubic2d_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_bicubic2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_bicubic2d_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_bicubic2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w) [docs] def upsample_trilinear3d(input, output_size, align_corners, scales_d=None, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_trilinear3d, (input, output_size, align_corners, scales_d, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_trilinear3d(input, output_size, align_corners, scales_d, scales_h, scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_trilinear3d, (input, output_size, align_corners, scales_d, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_trilinear3d(input, output_size, align_corners, scales_d, scales_h, scales_w) def upsample_trilinear3d_backward(grad_output, output_size, input_size, align_corners, scales_d=None, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(upsample_trilinear3d_backward, (grad_output, output_size, input_size, align_corners, scales_d, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C.upsample_trilinear3d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_d=scales_d, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(upsample_trilinear3d_backward, (grad_output, output_size, input_size, align_corners, scales_d, scales_h, scales_w), {}) if _captured is not None: return _captured return _C.upsample_trilinear3d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_d=scales_d, scales_h=scales_h, scales_w=scales_w) [docs] def addbmm(input, batch1, batch2, *, beta=1, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(addbmm, (input, batch1, batch2), {'beta': beta, 'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C.addbmm(self=input, batch1=batch1, batch2=batch2, beta=beta, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(addbmm, (input, batch1, batch2), {'beta': beta, 'alpha': alpha}) if _captured is not None: return _captured return _C.addbmm(self=input, batch1=batch1, batch2=batch2, beta=beta, alpha=alpha) [docs] def addmv(input, mat, vec, *, beta=1, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(addmv, (input, mat, vec), {'beta': beta, 'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C.addmv(self=input, mat=mat, vec=vec, beta=beta, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(addmv, (input, mat, vec), {'beta': beta, 'alpha': alpha}) if _captured is not None: return _captured return _C.addmv(self=input, mat=mat, vec=vec, beta=beta, alpha=alpha) [docs] def addr(input, vec1, vec2, *, beta=1, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(addr, (input, vec1, vec2), {'beta': beta, 'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C.addr(self=input, vec1=vec1, vec2=vec2, beta=beta, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(addr, (input, vec1, vec2), {'beta': beta, 'alpha': alpha}) if _captured is not None: return _captured return _C.addr(self=input, vec1=vec1, vec2=vec2, beta=beta, alpha=alpha) [docs] def amax(input, dim=[], keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(amax, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.amax(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(amax, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.amax(self=input, dim=dim, keepdim=keepdim) [docs] def amin(input, dim=[], keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(amin, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.amin(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(amin, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.amin(self=input, dim=dim, keepdim=keepdim) [docs] def aminmax(input, dim=[], keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(aminmax, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.aminmax(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(aminmax, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.aminmax(self=input, dim=dim, keepdim=keepdim) [docs] def argsort(input, dim=-1, descending=False, *, stable=_MISSING, out=None): if stable is not _MISSING: if out is not None: if _capturing(): _captured = _capture_call(argsort, (input, dim, descending), {'stable': stable, 'out': out}) if _captured is not None: return _captured return _C.argsort(input, stable=stable, dim=dim, descending=descending, out=out) if _capturing(): _captured = _capture_call(argsort, (input, dim, descending), {'stable': stable}) if _captured is not None: return _captured return _C.argsort(input, stable=stable, dim=dim, descending=descending) if out is not None: if _capturing(): _captured = _capture_call(argsort, (input, dim, descending), {'out': out}) if _captured is not None: return _captured return _C.argsort(input, dim, descending, out=out) if _capturing(): _captured = _capture_call(argsort, (input, dim, descending), {}) if _captured is not None: return _captured return _C.argsort(input, dim, descending) [docs] def bincount(input, weights=None, minlength=0): if _capturing(): _captured = _capture_call(bincount, (input, weights, minlength), {}) if _captured is not None: return _captured return _C.bincount(input, weights, minlength) def block_diag(*args): if _capturing(): _captured = _capture_call(block_diag, (*args,), {}) if _captured is not None: return _captured return _C.block_diag(list(args)) def broadcast_tensors(*args): if _capturing(): _captured = _capture_call(broadcast_tensors, (*args,), {}) if _captured is not None: return _captured return _C.broadcast_tensors(list(args)) [docs] def channel_shuffle(input, groups): if _capturing(): _captured = _capture_call(channel_shuffle, (input, groups), {}) if _captured is not None: return _captured return _C.channel_shuffle(input, groups) def roi_align(input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned): if _capturing(): _captured = _capture_call(roi_align, (input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned), {}) if _captured is not None: return _captured return _C.roi_align(input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned) def roi_align_backward(grad_output, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned, input_size): if _capturing(): _captured = _capture_call(roi_align_backward, (grad_output, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned, input_size), {}) if _captured is not None: return _captured if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] return _C.roi_align_backward(grad_output, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, aligned, input_size) def roi_pool(input, rois, spatial_scale, pooled_height, pooled_width): if _capturing(): _captured = _capture_call(roi_pool, (input, rois, spatial_scale, pooled_height, pooled_width), {}) if _captured is not None: return _captured return _C.roi_pool(input, rois, spatial_scale, pooled_height, pooled_width) def roi_pool_backward(grad_output, input, rois, spatial_scale, pooled_height, pooled_width): if _capturing(): _captured = _capture_call(roi_pool_backward, (grad_output, input, rois, spatial_scale, pooled_height, pooled_width), {}) if _captured is not None: return _captured return _C.roi_pool_backward(grad_output, input, rois, spatial_scale, pooled_height, pooled_width) def ps_roi_align(input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio): if _capturing(): _captured = _capture_call(ps_roi_align, (input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio), {}) if _captured is not None: return _captured return _C.ps_roi_align(input, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio) def ps_roi_align_backward(grad_output, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, input_size): if _capturing(): _captured = _capture_call(ps_roi_align_backward, (grad_output, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, input_size), {}) if _captured is not None: return _captured if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] return _C.ps_roi_align_backward(grad_output, rois, spatial_scale, pooled_height, pooled_width, sampling_ratio, input_size) def ps_roi_pool(input, rois, spatial_scale, pooled_height, pooled_width): if _capturing(): _captured = _capture_call(ps_roi_pool, (input, rois, spatial_scale, pooled_height, pooled_width), {}) if _captured is not None: return _captured return _C.ps_roi_pool(input, rois, spatial_scale, pooled_height, pooled_width) def ps_roi_pool_backward(grad_output, rois, spatial_scale, pooled_height, pooled_width, input_size): if _capturing(): _captured = _capture_call(ps_roi_pool_backward, (grad_output, rois, spatial_scale, pooled_height, pooled_width, input_size), {}) if _captured is not None: return _captured if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] return _C.ps_roi_pool_backward(grad_output, rois, spatial_scale, pooled_height, pooled_width, input_size) def nms(boxes, scores, iou_threshold): if _capturing(): _captured = _capture_call(nms, (boxes, scores, iou_threshold), {}) if _captured is not None: return _captured return _C.nms(boxes, scores, iou_threshold) def box_iou(boxes1, boxes2): if _capturing(): _captured = _capture_call(box_iou, (boxes1, boxes2), {}) if _captured is not None: return _captured return _C.box_iou(boxes1, boxes2) def deform_conv2d(input, weight, offset, mask, bias, stride, padding, dilation, groups, offset_groups, use_mask): if _capturing(): _captured = _capture_call(deform_conv2d, (input, weight, offset, mask, bias, stride, padding, dilation, groups, offset_groups, use_mask), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.deform_conv2d(input, weight, offset, mask, bias, stride, padding, dilation, groups, offset_groups, use_mask) def deform_conv2d_backward(grad_output, input, weight, offset, mask, bias, stride, padding, dilation, groups, offset_groups, use_mask, output_mask): if _capturing(): _captured = _capture_call(deform_conv2d_backward, (grad_output, input, weight, offset, mask, bias, stride, padding, dilation, groups, offset_groups, use_mask, output_mask), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.deform_conv2d_backward(grad_output, input, weight, offset, mask, bias, stride, padding, dilation, groups, offset_groups, use_mask, output_mask) [docs] def cholesky(input, upper=False): if _capturing(): _captured = _capture_call(cholesky, (input, upper), {}) if _captured is not None: return _captured return _C.cholesky(input, upper) [docs] def cholesky_inverse(input, upper=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cholesky_inverse, (input, upper), {'out': out}) if _captured is not None: return _captured return _C.cholesky_inverse(self=input, upper=upper, out=out) if _capturing(): _captured = _capture_call(cholesky_inverse, (input, upper), {}) if _captured is not None: return _captured return _C.cholesky_inverse(self=input, upper=upper) [docs] def cholesky_solve(input, input2, upper=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cholesky_solve, (input, input2, upper), {'out': out}) if _captured is not None: return _captured return _C.cholesky_solve(self=input, input2=input2, upper=upper, out=out) if _capturing(): _captured = _capture_call(cholesky_solve, (input, input2, upper), {}) if _captured is not None: return _captured return _C.cholesky_solve(self=input, input2=input2, upper=upper) [docs] def clip(input, min=None, max=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(clip, (input, min, max), {'out': out}) if _captured is not None: return _captured return _C.clip(input, min, max, out=out) if _capturing(): _captured = _capture_call(clip, (input, min, max), {}) if _captured is not None: return _captured return _C.clip(input, min, max) [docs] def clamp_(input, min=None, max=None): if _capturing(): _captured = _capture_call(clamp_, (input, min, max), {}) if _captured is not None: return _captured if min is not None and not isinstance(min, (tensorplay.Scalar, tensorplay.Tensor)): min = tensorplay.Scalar(min) if max is not None and not isinstance(max, (tensorplay.Scalar, tensorplay.Tensor)): max = tensorplay.Scalar(max) return _C.clamp_(input, min, max) [docs] def clamp_min_(input, min): if _capturing(): _captured = _capture_call(clamp_min_, (input, min), {}) if _captured is not None: return _captured if not isinstance(min, (tensorplay.Scalar, tensorplay.Tensor)): min = tensorplay.Scalar(min) return _C.clamp_min_(input, min) [docs] def clamp_max_(input, max): if _capturing(): _captured = _capture_call(clamp_max_, (input, max), {}) if _captured is not None: return _captured if not isinstance(max, (tensorplay.Scalar, tensorplay.Tensor)): max = tensorplay.Scalar(max) return _C.clamp_max_(input, max) [docs] def complex(real, imag, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(complex, (real, imag), {'out': out}) if _captured is not None: return _captured return _C.complex(real=real, imag=imag, out=out) if _capturing(): _captured = _capture_call(complex, (real, imag), {}) if _captured is not None: return _captured return _C.complex(real=real, imag=imag) [docs] def conj(input): if _capturing(): _captured = _capture_call(conj, (input,), {}) if _captured is not None: return _captured return _C.conj(input) [docs] def adjoint(input): if _capturing(): _captured = _capture_call(adjoint, (input,), {}) if _captured is not None: return _captured return _C.adjoint(input) [docs] def imag(input): if _capturing(): _captured = _capture_call(imag, (input,), {}) if _captured is not None: return _captured return _C.imag(input) [docs] def cummax(input, dim, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cummax, (input, dim), {'out': out}) if _captured is not None: return _captured return _C.cummax(self=input, dim=dim, out=out) if _capturing(): _captured = _capture_call(cummax, (input, dim), {}) if _captured is not None: return _captured return _C.cummax(self=input, dim=dim) [docs] def cummin(input, dim, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cummin, (input, dim), {'out': out}) if _captured is not None: return _captured return _C.cummin(self=input, dim=dim, out=out) if _capturing(): _captured = _capture_call(cummin, (input, dim), {}) if _captured is not None: return _captured return _C.cummin(self=input, dim=dim) [docs] def cumprod(input, dim, dtype=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cumprod, (input, dim, dtype), {'out': out}) if _captured is not None: return _captured return _C.cumprod(self=input, dim=dim, dtype=dtype, out=out) if _capturing(): _captured = _capture_call(cumprod, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.cumprod(self=input, dim=dim, dtype=dtype) [docs] def logcumsumexp(input, dim, dtype=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logcumsumexp, (input, dim, dtype), {'out': out}) if _captured is not None: return _captured return _C.logcumsumexp(self=input, dim=dim, dtype=dtype, out=out) if _capturing(): _captured = _capture_call(logcumsumexp, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.logcumsumexp(self=input, dim=dim, dtype=dtype) [docs] def diag(input, diagonal=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(diag, (input, diagonal), {'out': out}) if _captured is not None: return _captured return _C.diag(self=input, diagonal=diagonal, out=out) if _capturing(): _captured = _capture_call(diag, (input, diagonal), {}) if _captured is not None: return _captured return _C.diag(self=input, diagonal=diagonal) [docs] def diag_embed(input, offset=0, dim1=-2, dim2=-1): if _capturing(): _captured = _capture_call(diag_embed, (input, offset, dim1, dim2), {}) if _captured is not None: return _captured return _C.diag_embed(input, offset, dim1, dim2) [docs] def dist(input, other, p=2): if _capturing(): _captured = _capture_call(dist, (input, other, p), {}) if _captured is not None: return _captured if not isinstance(p, (tensorplay.Scalar, tensorplay.Tensor)): p = tensorplay.Scalar(p) return _C.dist(input, other, p) [docs] def gather(input, dim, index, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(gather, (input, dim, index), {'out': out}) if _captured is not None: return _captured return _C.gather(self=input, dim=dim, index=index, out=out) if _capturing(): _captured = _capture_call(gather, (input, dim, index), {}) if _captured is not None: return _captured return _C.gather(self=input, dim=dim, index=index) [docs] def take(input, index, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(take, (input, index), {'out': out}) if _captured is not None: return _captured return _C.take(self=input, index=index, out=out) if _capturing(): _captured = _capture_call(take, (input, index), {}) if _captured is not None: return _captured return _C.take(self=input, index=index) [docs] def take_along_dim(input, indices, dim=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(take_along_dim, (input, indices, dim), {'out': out}) if _captured is not None: return _captured return _C.take_along_dim(self=input, indices=indices, dim=dim, out=out) if _capturing(): _captured = _capture_call(take_along_dim, (input, indices, dim), {}) if _captured is not None: return _captured return _C.take_along_dim(self=input, indices=indices, dim=dim) [docs] def select_scatter(input, src, dim, index): if _capturing(): _captured = _capture_call(select_scatter, (input, src, dim, index), {}) if _captured is not None: return _captured return _C.select_scatter(input, src, dim, index) [docs] def slice_scatter(input, src, dim=0, start=None, end=None, step=1): if _capturing(): _captured = _capture_call(slice_scatter, (input, src, dim, start, end, step), {}) if _captured is not None: return _captured return _C.slice_scatter(input, src, dim, start, end, step) [docs] def diagonal_scatter(input, src, offset=0, dim1=0, dim2=1): if _capturing(): _captured = _capture_call(diagonal_scatter, (input, src, offset, dim1, dim2), {}) if _captured is not None: return _captured return _C.diagonal_scatter(input, src, offset, dim1, dim2) [docs] def msort(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(msort, (input,), {'out': out}) if _captured is not None: return _captured return _C.msort(self=input, out=out) if _capturing(): _captured = _capture_call(msort, (input,), {}) if _captured is not None: return _captured return _C.msort(self=input) [docs] def nanmean(input, dim=None, keepdim=False, *, dtype=None, out=None): if out is not None: if _capturing(): _captured = _capture_call(nanmean, (input, dim, keepdim), {'dtype': dtype, 'out': out}) if _captured is not None: return _captured return _C.nanmean(self=input, dim=dim, keepdim=keepdim, dtype=dtype, out=out) if _capturing(): _captured = _capture_call(nanmean, (input, dim, keepdim), {'dtype': dtype}) if _captured is not None: return _captured return _C.nanmean(self=input, dim=dim, keepdim=keepdim, dtype=dtype) [docs] def isclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False): if _capturing(): _captured = _capture_call(isclose, (input, other, rtol, atol, equal_nan), {}) if _captured is not None: return _captured return _C.isclose(input, other, rtol, atol, equal_nan) [docs] def isreal(input): if _capturing(): _captured = _capture_call(isreal, (input,), {}) if _captured is not None: return _captured return _C.isreal(input) [docs] def bitwise_not(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(bitwise_not, (input,), {'out': out}) if _captured is not None: return _captured return _C.bitwise_not(self=input, out=out) if _capturing(): _captured = _capture_call(bitwise_not, (input,), {}) if _captured is not None: return _captured return _C.bitwise_not(self=input) [docs] def bitwise_and(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(bitwise_and, (input, other), {'out': out}) if _captured is not None: return _captured return _C.bitwise_and(input, other, out=out) if _capturing(): _captured = _capture_call(bitwise_and, (input, other), {}) if _captured is not None: return _captured return _C.bitwise_and(input, other) [docs] def bitwise_or(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(bitwise_or, (input, other), {'out': out}) if _captured is not None: return _captured return _C.bitwise_or(input, other, out=out) if _capturing(): _captured = _capture_call(bitwise_or, (input, other), {}) if _captured is not None: return _captured return _C.bitwise_or(input, other) [docs] def bitwise_xor(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(bitwise_xor, (input, other), {'out': out}) if _captured is not None: return _captured return _C.bitwise_xor(input, other, out=out) if _capturing(): _captured = _capture_call(bitwise_xor, (input, other), {}) if _captured is not None: return _captured return _C.bitwise_xor(input, other) [docs] def bitwise_left_shift(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(bitwise_left_shift, (input, other), {'out': out}) if _captured is not None: return _captured return _C.bitwise_left_shift(input, other, out=out) if _capturing(): _captured = _capture_call(bitwise_left_shift, (input, other), {}) if _captured is not None: return _captured return _C.bitwise_left_shift(input, other) [docs] def bitwise_right_shift(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(bitwise_right_shift, (input, other), {'out': out}) if _captured is not None: return _captured return _C.bitwise_right_shift(input, other, out=out) if _capturing(): _captured = _capture_call(bitwise_right_shift, (input, other), {}) if _captured is not None: return _captured return _C.bitwise_right_shift(input, other) [docs] def index_copy(input, dim, index, source, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(index_copy, (input, dim, index, source), {'out': out}) if _captured is not None: return _captured return _C.index_copy(self=input, dim=dim, index=index, source=source, out=out) if _capturing(): _captured = _capture_call(index_copy, (input, dim, index, source), {}) if _captured is not None: return _captured return _C.index_copy(self=input, dim=dim, index=index, source=source) [docs] def index_fill(input, dim, index, value): if _capturing(): _captured = _capture_call(index_fill, (input, dim, index, value), {}) if _captured is not None: return _captured if not isinstance(value, (tensorplay.Scalar, tensorplay.Tensor)): value = tensorplay.Scalar(value) return _C.index_fill(input, dim, index, value) [docs] def index_fill_(input, dim, index, value): if _capturing(): _captured = _capture_call(index_fill_, (input, dim, index, value), {}) if _captured is not None: return _captured if not isinstance(value, (tensorplay.Scalar, tensorplay.Tensor)): value = tensorplay.Scalar(value) return _C.index_fill_(input, dim, index, value) [docs] def searchsorted(sorted_sequence, input, *, out_int32=False, right=False, side=None, sorter=None, out=None): if out is not None: if _capturing(): _captured = _capture_call(searchsorted, (sorted_sequence, input), {'out_int32': out_int32, 'right': right, 'side': side, 'sorter': sorter, 'out': out}) if _captured is not None: return _captured return _C.searchsorted(sorted_sequence, input, out_int32=out_int32, right=right, side=side, sorter=sorter, out=out) if _capturing(): _captured = _capture_call(searchsorted, (sorted_sequence, input), {'out_int32': out_int32, 'right': right, 'side': side, 'sorter': sorter}) if _captured is not None: return _captured return _C.searchsorted(sorted_sequence, input, out_int32=out_int32, right=right, side=side, sorter=sorter) [docs] def bucketize(input, boundaries, *, out_int32=False, right=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(bucketize, (input, boundaries), {'out_int32': out_int32, 'right': right, 'out': out}) if _captured is not None: return _captured return _C.bucketize(input, boundaries, out_int32=out_int32, right=right, out=out) if _capturing(): _captured = _capture_call(bucketize, (input, boundaries), {'out_int32': out_int32, 'right': right}) if _captured is not None: return _captured return _C.bucketize(input, boundaries, out_int32=out_int32, right=right) [docs] def scatter(input, dim, index, src, *, reduce=_MISSING, out=None): if reduce is not _MISSING: if out is not None: if _capturing(): _captured = _capture_call(scatter, (input, dim, index, src), {'reduce': reduce, 'out': out}) if _captured is not None: return _captured return _C.scatter(input, dim, index, src, reduce=reduce, out=out) if _capturing(): _captured = _capture_call(scatter, (input, dim, index, src), {'reduce': reduce}) if _captured is not None: return _captured return _C.scatter(input, dim, index, src, reduce=reduce) if out is not None: if _capturing(): _captured = _capture_call(scatter, (input, dim, index, src), {'out': out}) if _captured is not None: return _captured return _C.scatter(input, dim, index, src, out=out) if _capturing(): _captured = _capture_call(scatter, (input, dim, index, src), {}) if _captured is not None: return _captured return _C.scatter(input, dim, index, src) [docs] def scatter_(input, dim, index, src): if _capturing(): _captured = _capture_call(scatter_, (input, dim, index, src), {}) if _captured is not None: return _captured return _C.scatter_(input, dim, index, src) [docs] def masked_fill(input, mask, value): if _capturing(): _captured = _capture_call(masked_fill, (input, mask, value), {}) if _captured is not None: return _captured return _C.masked_fill(input, mask, value) [docs] def masked_fill_(input, mask, value): if _capturing(): _captured = _capture_call(masked_fill_, (input, mask, value), {}) if _captured is not None: return _captured return _C.masked_fill_(input, mask, value) [docs] def index_put(input, indices, values, accumulate=False): if _capturing(): _captured = _capture_call(index_put, (input, indices, values, accumulate), {}) if _captured is not None: return _captured return _C.index_put(input, indices, values, accumulate) [docs] def index_put_(input, indices, values, accumulate=False): if _capturing(): _captured = _capture_call(index_put_, (input, indices, values, accumulate), {}) if _captured is not None: return _captured return _C.index_put_(input, indices, values, accumulate) [docs] def masked_scatter(input, mask, source): if _capturing(): _captured = _capture_call(masked_scatter, (input, mask, source), {}) if _captured is not None: return _captured return _C.masked_scatter(input, mask, source) [docs] def scatter_add(input, dim, index, src, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(scatter_add, (input, dim, index, src), {'out': out}) if _captured is not None: return _captured return _C.scatter_add(self=input, dim=dim, index=index, src=src, out=out) if _capturing(): _captured = _capture_call(scatter_add, (input, dim, index, src), {}) if _captured is not None: return _captured return _C.scatter_add(self=input, dim=dim, index=index, src=src) [docs] def scatter_add_(input, dim, index, src): if _capturing(): _captured = _capture_call(scatter_add_, (input, dim, index, src), {}) if _captured is not None: return _captured return _C.scatter_add_(input, dim, index, src) [docs] def sort(input, dim=-1, descending=False, *, stable=_MISSING, out=None): if stable is not _MISSING: if _capturing(): _captured = _capture_call(sort, (input, dim, descending), {'stable': stable}) if _captured is not None: return _captured return _C.sort(input, stable=stable, dim=dim, descending=descending) if out is not None: if _capturing(): _captured = _capture_call(sort, (input, dim, descending), {'out': out}) if _captured is not None: return _captured return _C.sort(input, dim, descending, out=out) if _capturing(): _captured = _capture_call(sort, (input, dim, descending), {}) if _captured is not None: return _captured return _C.sort(input, dim, descending) [docs] def mode(input, dim=-1, keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(mode, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.mode(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(mode, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.mode(self=input, dim=dim, keepdim=keepdim) [docs] def kthvalue(input, k, dim=-1, keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(kthvalue, (input, k, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.kthvalue(self=input, k=k, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(kthvalue, (input, k, dim, keepdim), {}) if _captured is not None: return _captured return _C.kthvalue(self=input, k=k, dim=dim, keepdim=keepdim) [docs] def nanmedian(input, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(nanmedian, (input, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C.nanmedian(input) return _C.nanmedian(input, dim, keepdim) [docs] def nansum(input, dim=[], keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nansum, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.nansum(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(nansum, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.nansum(self=input, dim=dim, keepdim=keepdim) [docs] def std_mean(input, dim=None, unbiased=None, keepdim=False, *, correction=None): if _capturing(): _captured = _capture_call(std_mean, (input, dim, unbiased, keepdim), {"correction": correction}) if _captured is not None: return _captured if correction is None: correction = 1 if (unbiased is None or unbiased) else 0 if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] elif dim is not None: dim = list(dim) return _C.std_mean(input, dim, correction=correction, keepdim=keepdim) [docs] def var_mean(input, dim=None, unbiased=None, keepdim=False, *, correction=None): if _capturing(): _captured = _capture_call(var_mean, (input, dim, unbiased, keepdim), {"correction": correction}) if _captured is not None: return _captured if correction is None: correction = 1 if (unbiased is None or unbiased) else 0 if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] elif dim is not None: dim = list(dim) return _C.var_mean(input, dim, correction=correction, keepdim=keepdim) [docs] def trace(input): if _capturing(): _captured = _capture_call(trace, (input,), {}) if _captured is not None: return _captured return _C.trace(input) [docs] def renorm(input, p, dim, maxnorm, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(renorm, (input, p, dim, maxnorm), {'out': out}) if _captured is not None: return _captured return _C.renorm(self=input, p=p, dim=dim, maxnorm=maxnorm, out=out) if _capturing(): _captured = _capture_call(renorm, (input, p, dim, maxnorm), {}) if _captured is not None: return _captured return _C.renorm(self=input, p=p, dim=dim, maxnorm=maxnorm) [docs] def rot90(input, k=1, dims=[0,1]): if _capturing(): _captured = _capture_call(rot90, (input, k, dims), {}) if _captured is not None: return _captured if isinstance(dims, int) and not isinstance(dims, bool): dims = [dims] return _C.rot90(input, k, dims) [docs] def split_with_sizes(input, split_sizes, dim=0): if _capturing(): _captured = _capture_call(split_with_sizes, (input, split_sizes, dim), {}) if _captured is not None: return _captured if isinstance(split_sizes, int) and not isinstance(split_sizes, bool): split_sizes = [split_sizes] return _C.split_with_sizes(input, split_sizes, dim) [docs] def meshgrid(tensors, indexing='ij'): if _capturing(): _captured = _capture_call(meshgrid, (tensors, indexing), {}) if _captured is not None: return _captured return _C.meshgrid(tensors, indexing) [docs] def greater(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(greater, (input, other), {'out': out}) if _captured is not None: return _captured return _C.greater(input, other, out=out) if _capturing(): _captured = _capture_call(greater, (input, other), {}) if _captured is not None: return _captured return _C.greater(input, other) [docs] def greater_equal(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(greater_equal, (input, other), {'out': out}) if _captured is not None: return _captured return _C.greater_equal(input, other, out=out) if _capturing(): _captured = _capture_call(greater_equal, (input, other), {}) if _captured is not None: return _captured return _C.greater_equal(input, other) [docs] def less(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(less, (input, other), {'out': out}) if _captured is not None: return _captured return _C.less(input, other, out=out) if _capturing(): _captured = _capture_call(less, (input, other), {}) if _captured is not None: return _captured return _C.less(input, other) [docs] def less_equal(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(less_equal, (input, other), {'out': out}) if _captured is not None: return _captured return _C.less_equal(input, other, out=out) if _capturing(): _captured = _capture_call(less_equal, (input, other), {}) if _captured is not None: return _captured return _C.less_equal(input, other) [docs] def not_equal(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(not_equal, (input, other), {'out': out}) if _captured is not None: return _captured return _C.not_equal(input, other, out=out) if _capturing(): _captured = _capture_call(not_equal, (input, other), {}) if _captured is not None: return _captured return _C.not_equal(input, other) [docs] def logical_not(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logical_not, (input,), {'out': out}) if _captured is not None: return _captured return _C.logical_not(self=input, out=out) if _capturing(): _captured = _capture_call(logical_not, (input,), {}) if _captured is not None: return _captured return _C.logical_not(self=input) [docs] def logical_or(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logical_or, (input, other), {'out': out}) if _captured is not None: return _captured return _C.logical_or(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(logical_or, (input, other), {}) if _captured is not None: return _captured return _C.logical_or(self=input, other=other) [docs] def logical_xor(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logical_xor, (input, other), {'out': out}) if _captured is not None: return _captured return _C.logical_xor(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(logical_xor, (input, other), {}) if _captured is not None: return _captured return _C.logical_xor(self=input, other=other) [docs] def deg2rad(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(deg2rad, (input,), {'out': out}) if _captured is not None: return _captured return _C.deg2rad(self=input, out=out) if _capturing(): _captured = _capture_call(deg2rad, (input,), {}) if _captured is not None: return _captured return _C.deg2rad(self=input) [docs] def rad2deg(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(rad2deg, (input,), {'out': out}) if _captured is not None: return _captured return _C.rad2deg(self=input, out=out) if _capturing(): _captured = _capture_call(rad2deg, (input,), {}) if _captured is not None: return _captured return _C.rad2deg(self=input) [docs] def exp2(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(exp2, (input,), {'out': out}) if _captured is not None: return _captured return _C.exp2(self=input, out=out) if _capturing(): _captured = _capture_call(exp2, (input,), {}) if _captured is not None: return _captured return _C.exp2(self=input) [docs] def fix(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fix, (input,), {'out': out}) if _captured is not None: return _captured return _C.fix(self=input, out=out) if _capturing(): _captured = _capture_call(fix, (input,), {}) if _captured is not None: return _captured return _C.fix(self=input) [docs] def digamma(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(digamma, (input,), {'out': out}) if _captured is not None: return _captured return _C.digamma(self=input, out=out) if _capturing(): _captured = _capture_call(digamma, (input,), {}) if _captured is not None: return _captured return _C.digamma(self=input) [docs] def erfinv(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(erfinv, (input,), {'out': out}) if _captured is not None: return _captured return _C.erfinv(self=input, out=out) if _capturing(): _captured = _capture_call(erfinv, (input,), {}) if _captured is not None: return _captured return _C.erfinv(self=input) [docs] def erfcx(input): if _capturing(): _captured = _capture_call(erfcx, (input,), {}) if _captured is not None: return _captured return _C.erfcx(input) [docs] def ndtr(input): if _capturing(): _captured = _capture_call(ndtr, (input,), {}) if _captured is not None: return _captured return _C.ndtr(input) [docs] def ndtri(input): if _capturing(): _captured = _capture_call(ndtri, (input,), {}) if _captured is not None: return _captured return _C.ndtri(input) [docs] def log_ndtr(input): if _capturing(): _captured = _capture_call(log_ndtr, (input,), {}) if _captured is not None: return _captured return _C.log_ndtr(input) [docs] def entr(input): if _capturing(): _captured = _capture_call(entr, (input,), {}) if _captured is not None: return _captured return _C.entr(input) [docs] def sgn(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sgn, (input,), {'out': out}) if _captured is not None: return _captured return _C.sgn(self=input, out=out) if _capturing(): _captured = _capture_call(sgn, (input,), {}) if _captured is not None: return _captured return _C.sgn(self=input) [docs] def signbit(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(signbit, (input,), {'out': out}) if _captured is not None: return _captured return _C.signbit(self=input, out=out) if _capturing(): _captured = _capture_call(signbit, (input,), {}) if _captured is not None: return _captured return _C.signbit(self=input) [docs] def sinc(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sinc, (input,), {'out': out}) if _captured is not None: return _captured return _C.sinc(self=input, out=out) if _capturing(): _captured = _capture_call(sinc, (input,), {}) if _captured is not None: return _captured return _C.sinc(self=input) [docs] def heaviside(input, values, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(heaviside, (input, values), {'out': out}) if _captured is not None: return _captured return _C.heaviside(self=input, values=values, out=out) if _capturing(): _captured = _capture_call(heaviside, (input, values), {}) if _captured is not None: return _captured return _C.heaviside(self=input, values=values) def snn_lif_step(input, v, decay, threshold, v_reset=None, surrogate=0, alpha=1.0, detach_reset=True): if _capturing(): _captured = _capture_call(snn_lif_step, (input, v, decay, threshold, v_reset, surrogate, alpha, detach_reset), {}) if _captured is not None: return _captured return _C.snn_lif_step(input, v, decay, threshold, v_reset, surrogate, alpha, detach_reset) def snn_lif_step_backward(grad_spike, grad_v, input, v, decay, threshold, spike, v_new, v_reset=None, surrogate=0, alpha=1.0, detach_reset=True): if _capturing(): _captured = _capture_call(snn_lif_step_backward, (grad_spike, grad_v, input, v, decay, threshold, spike, v_new, v_reset, surrogate, alpha, detach_reset), {}) if _captured is not None: return _captured return _C.snn_lif_step_backward(grad_spike, grad_v, input, v, decay, threshold, spike, v_new, v_reset, surrogate, alpha, detach_reset) def snn_lif_seq(input, v_init, decay, threshold, v_reset=None, surrogate=0, alpha=1.0, detach_reset=True): if _capturing(): _captured = _capture_call(snn_lif_seq, (input, v_init, decay, threshold, v_reset, surrogate, alpha, detach_reset), {}) if _captured is not None: return _captured return _C.snn_lif_seq(input, v_init, decay, threshold, v_reset, surrogate, alpha, detach_reset) def snn_lif_seq_backward(grad_spikes, grad_v_final, grad_v_seq, input, v_init, decay, threshold, spikes, v_final, v_reset=None, surrogate=0, alpha=1.0, detach_reset=True): if _capturing(): _captured = _capture_call(snn_lif_seq_backward, (grad_spikes, grad_v_final, grad_v_seq, input, v_init, decay, threshold, spikes, v_final, v_reset, surrogate, alpha, detach_reset), {}) if _captured is not None: return _captured return _C.snn_lif_seq_backward(grad_spikes, grad_v_final, grad_v_seq, input, v_init, decay, threshold, spikes, v_final, v_reset, surrogate, alpha, detach_reset) def snn_surrogate_grad(x, surrogate=0, alpha=1.0, beta=1.0, w=1.0, c=0.0, n=1, T_period=1.0): if _capturing(): _captured = _capture_call(snn_surrogate_grad, (x, surrogate, alpha, beta, w, c, n, T_period), {}) if _captured is not None: return _captured return _C.snn_surrogate_grad(x, surrogate, alpha, beta, w, c, n, T_period) [docs] def hypot(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hypot, (input, other), {'out': out}) if _captured is not None: return _captured return _C.hypot(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(hypot, (input, other), {}) if _captured is not None: return _captured return _C.hypot(self=input, other=other) [docs] def logaddexp(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logaddexp, (input, other), {'out': out}) if _captured is not None: return _captured return _C.logaddexp(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(logaddexp, (input, other), {}) if _captured is not None: return _captured return _C.logaddexp(self=input, other=other) [docs] def logaddexp2(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logaddexp2, (input, other), {'out': out}) if _captured is not None: return _captured return _C.logaddexp2(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(logaddexp2, (input, other), {}) if _captured is not None: return _captured return _C.logaddexp2(self=input, other=other) [docs] def logit(input, eps=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logit, (input, eps), {'out': out}) if _captured is not None: return _captured return _C.logit(self=input, eps=eps, out=out) if _capturing(): _captured = _capture_call(logit, (input, eps), {}) if _captured is not None: return _captured return _C.logit(self=input, eps=eps) def logit_backward(grad_output, input, eps=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logit_backward, (grad_output, input, eps), {'out': out}) if _captured is not None: return _captured return _C.logit_backward(grad_output=grad_output, self=input, eps=eps, out=out) if _capturing(): _captured = _capture_call(logit_backward, (grad_output, input, eps), {}) if _captured is not None: return _captured return _C.logit_backward(grad_output=grad_output, self=input, eps=eps) def sigmoid_backward(grad_output, output, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(sigmoid_backward, (grad_output, output), {'out': out}) if _captured is not None: return _captured return _C.sigmoid_backward(grad_output=grad_output, output=output, out=out) if _capturing(): _captured = _capture_call(sigmoid_backward, (grad_output, output), {}) if _captured is not None: return _captured return _C.sigmoid_backward(grad_output=grad_output, output=output) def tanh_backward(grad_output, output, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(tanh_backward, (grad_output, output), {'out': out}) if _captured is not None: return _captured return _C.tanh_backward(grad_output=grad_output, output=output, out=out) if _capturing(): _captured = _capture_call(tanh_backward, (grad_output, output), {}) if _captured is not None: return _captured return _C.tanh_backward(grad_output=grad_output, output=output) [docs] def gcd(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(gcd, (input, other), {'out': out}) if _captured is not None: return _captured return _C.gcd(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(gcd, (input, other), {}) if _captured is not None: return _captured return _C.gcd(self=input, other=other) [docs] def lcm(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(lcm, (input, other), {'out': out}) if _captured is not None: return _captured return _C.lcm(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(lcm, (input, other), {}) if _captured is not None: return _captured return _C.lcm(self=input, other=other) [docs] def nextafter(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nextafter, (input, other), {'out': out}) if _captured is not None: return _captured return _C.nextafter(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(nextafter, (input, other), {}) if _captured is not None: return _captured return _C.nextafter(self=input, other=other) [docs] def isfinite(input): if _capturing(): _captured = _capture_call(isfinite, (input,), {}) if _captured is not None: return _captured return _C.isfinite(input) [docs] def isinf(input): if _capturing(): _captured = _capture_call(isinf, (input,), {}) if _captured is not None: return _captured return _C.isinf(input) [docs] def isnan(input): if _capturing(): _captured = _capture_call(isnan, (input,), {}) if _captured is not None: return _captured return _C.isnan(input) [docs] def isneginf(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(isneginf, (input,), {'out': out}) if _captured is not None: return _captured return _C.isneginf(self=input, out=out) if _capturing(): _captured = _capture_call(isneginf, (input,), {}) if _captured is not None: return _captured return _C.isneginf(self=input) [docs] def isposinf(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(isposinf, (input,), {'out': out}) if _captured is not None: return _captured return _C.isposinf(self=input, out=out) if _capturing(): _captured = _capture_call(isposinf, (input,), {}) if _captured is not None: return _captured return _C.isposinf(self=input) [docs] def nan_to_num(input, nan=0.0, posinf=None, neginf=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nan_to_num, (input, nan, posinf, neginf), {'out': out}) if _captured is not None: return _captured return _C.nan_to_num(self=input, nan=nan, posinf=posinf, neginf=neginf, out=out) if _capturing(): _captured = _capture_call(nan_to_num, (input, nan, posinf, neginf), {}) if _captured is not None: return _captured return _C.nan_to_num(self=input, nan=nan, posinf=posinf, neginf=neginf) [docs] def negative(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(negative, (input,), {'out': out}) if _captured is not None: return _captured return _C.negative(self=input, out=out) if _capturing(): _captured = _capture_call(negative, (input,), {}) if _captured is not None: return _captured return _C.negative(self=input) [docs] def positive(input): if _capturing(): _captured = _capture_call(positive, (input,), {}) if _captured is not None: return _captured return _C.positive(input) [docs] def svd(input, some=True, compute_uv=True, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(svd, (input, some, compute_uv), {'out': out}) if _captured is not None: return _captured return _C.svd(self=input, some=some, compute_uv=compute_uv, out=out) if _capturing(): _captured = _capture_call(svd, (input, some, compute_uv), {}) if _captured is not None: return _captured return _C.svd(self=input, some=some, compute_uv=compute_uv) [docs] def triangular_solve(input, A, upper=True, transpose=False, unitriangular=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(triangular_solve, (input, A, upper, transpose, unitriangular), {'out': out}) if _captured is not None: return _captured return _C.triangular_solve(self=input, A=A, upper=upper, transpose=transpose, unitriangular=unitriangular, out=out) if _capturing(): _captured = _capture_call(triangular_solve, (input, A, upper, transpose, unitriangular), {}) if _captured is not None: return _captured return _C.triangular_solve(self=input, A=A, upper=upper, transpose=transpose, unitriangular=unitriangular) [docs] def vdot(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(vdot, (input, other), {'out': out}) if _captured is not None: return _captured return _C.vdot(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(vdot, (input, other), {}) if _captured is not None: return _captured return _C.vdot(self=input, other=other) [docs] def prelu(input, weight): if _capturing(): _captured = _capture_call(prelu, (input, weight), {}) if _captured is not None: return _captured return _C.prelu(input, weight) [docs] def pdist(input, p=2.0): if _capturing(): _captured = _capture_call(pdist, (input, p), {}) if _captured is not None: return _captured return _C.pdist(input, p) [docs] def pairwise_distance(x1, x2, p=2.0, eps=1e-06, keepdim=False): if _capturing(): _captured = _capture_call(pairwise_distance, (x1, x2, p, eps, keepdim), {}) if _captured is not None: return _captured return _C.pairwise_distance(x1, x2, p, eps, keepdim) [docs] def l1_loss(input, target): if _capturing(): _captured = _capture_call(l1_loss, (input, target), {}) if _captured is not None: return _captured return _C.l1_loss(input, target) [docs] def smooth_l1_loss(input, target, reduction=1, beta=1.0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(smooth_l1_loss, (input, target, reduction, beta), {'out': out}) if _captured is not None: return _captured return _C.smooth_l1_loss(self=input, target=target, reduction=reduction, beta=beta, out=out) if _capturing(): _captured = _capture_call(smooth_l1_loss, (input, target, reduction, beta), {}) if _captured is not None: return _captured return _C.smooth_l1_loss(self=input, target=target, reduction=reduction, beta=beta) def smooth_l1_loss_backward(grad_output, input, target, reduction, beta, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(smooth_l1_loss_backward, (grad_output, input, target, reduction, beta), {'out': out}) if _captured is not None: return _captured return _C.smooth_l1_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, beta=beta, out=out) if _capturing(): _captured = _capture_call(smooth_l1_loss_backward, (grad_output, input, target, reduction, beta), {}) if _captured is not None: return _captured return _C.smooth_l1_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, beta=beta) [docs] def huber_loss(input, target, reduction=1, delta=1.0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(huber_loss, (input, target, reduction, delta), {'out': out}) if _captured is not None: return _captured return _C.huber_loss(self=input, target=target, reduction=reduction, delta=delta, out=out) if _capturing(): _captured = _capture_call(huber_loss, (input, target, reduction, delta), {}) if _captured is not None: return _captured return _C.huber_loss(self=input, target=target, reduction=reduction, delta=delta) def huber_loss_backward(grad_output, input, target, reduction, delta, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(huber_loss_backward, (grad_output, input, target, reduction, delta), {'out': out}) if _captured is not None: return _captured return _C.huber_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, delta=delta, out=out) if _capturing(): _captured = _capture_call(huber_loss_backward, (grad_output, input, target, reduction, delta), {}) if _captured is not None: return _captured return _C.huber_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, delta=delta) [docs] def kl_div(input, target): if _capturing(): _captured = _capture_call(kl_div, (input, target), {}) if _captured is not None: return _captured return _C.kl_div(input, target) [docs] def binary_cross_entropy(input, target, weight=None, reduction=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(binary_cross_entropy, (input, target, weight, reduction), {'out': out}) if _captured is not None: return _captured return _C.binary_cross_entropy(self=input, target=target, weight=weight, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(binary_cross_entropy, (input, target, weight, reduction), {}) if _captured is not None: return _captured return _C.binary_cross_entropy(self=input, target=target, weight=weight, reduction=reduction) def binary_cross_entropy_backward(grad_output, input, target, weight=None, reduction=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(binary_cross_entropy_backward, (grad_output, input, target, weight, reduction), {'out': out}) if _captured is not None: return _captured return _C.binary_cross_entropy_backward(grad_output=grad_output, self=input, target=target, weight=weight, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(binary_cross_entropy_backward, (grad_output, input, target, weight, reduction), {}) if _captured is not None: return _captured return _C.binary_cross_entropy_backward(grad_output=grad_output, self=input, target=target, weight=weight, reduction=reduction) [docs] def binary_cross_entropy_with_logits(input, target, weight=None, pos_weight=None): if _capturing(): _captured = _capture_call(binary_cross_entropy_with_logits, (input, target, weight, pos_weight), {}) if _captured is not None: return _captured return _C.binary_cross_entropy_with_logits(input, target, weight, pos_weight) [docs] def poisson_nll_loss(input, target, log_input=True, full=False, eps=1e-08): if _capturing(): _captured = _capture_call(poisson_nll_loss, (input, target, log_input, full, eps), {}) if _captured is not None: return _captured return _C.poisson_nll_loss(input, target, log_input, full, eps) [docs] def soft_margin_loss(input, target, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(soft_margin_loss, (input, target), {'out': out}) if _captured is not None: return _captured return _C.soft_margin_loss(input=input, target=target, out=out) if _capturing(): _captured = _capture_call(soft_margin_loss, (input, target), {}) if _captured is not None: return _captured return _C.soft_margin_loss(input=input, target=target) [docs] def cosine_embedding_loss(x1, x2, target, margin=0): if _capturing(): _captured = _capture_call(cosine_embedding_loss, (x1, x2, target, margin), {}) if _captured is not None: return _captured if not isinstance(margin, (tensorplay.Scalar, tensorplay.Tensor)): margin = tensorplay.Scalar(margin) return _C.cosine_embedding_loss(x1, x2, target, margin) [docs] def margin_ranking_loss(input1, input2, target, margin=0): if _capturing(): _captured = _capture_call(margin_ranking_loss, (input1, input2, target, margin), {}) if _captured is not None: return _captured if not isinstance(margin, (tensorplay.Scalar, tensorplay.Tensor)): margin = tensorplay.Scalar(margin) return _C.margin_ranking_loss(input1, input2, target, margin) [docs] def hinge_embedding_loss(input, target, margin=1.0): if _capturing(): _captured = _capture_call(hinge_embedding_loss, (input, target, margin), {}) if _captured is not None: return _captured if not isinstance(margin, (tensorplay.Scalar, tensorplay.Tensor)): margin = tensorplay.Scalar(margin) return _C.hinge_embedding_loss(input, target, margin) [docs] def multi_margin_loss(input, target, p=1, margin=1, weight=None, reduction=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(multi_margin_loss, (input, target, p, margin, weight, reduction), {'out': out}) if _captured is not None: return _captured return _C.multi_margin_loss(self=input, target=target, p=p, margin=margin, weight=weight, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(multi_margin_loss, (input, target, p, margin, weight, reduction), {}) if _captured is not None: return _captured return _C.multi_margin_loss(self=input, target=target, p=p, margin=margin, weight=weight, reduction=reduction) def multi_margin_loss_backward(grad_output, input, target, p, margin, weight=None, reduction=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(multi_margin_loss_backward, (grad_output, input, target, p, margin, weight, reduction), {'out': out}) if _captured is not None: return _captured return _C.multi_margin_loss_backward(grad_output=grad_output, self=input, target=target, p=p, margin=margin, weight=weight, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(multi_margin_loss_backward, (grad_output, input, target, p, margin, weight, reduction), {}) if _captured is not None: return _captured return _C.multi_margin_loss_backward(grad_output=grad_output, self=input, target=target, p=p, margin=margin, weight=weight, reduction=reduction) [docs] def multilabel_margin_loss(input, target, reduction=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(multilabel_margin_loss, (input, target, reduction), {'out': out}) if _captured is not None: return _captured return _C.multilabel_margin_loss(self=input, target=target, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(multilabel_margin_loss, (input, target, reduction), {}) if _captured is not None: return _captured return _C.multilabel_margin_loss(self=input, target=target, reduction=reduction) [docs] def multilabel_margin_loss_forward(input, target, reduction, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(multilabel_margin_loss_forward, (input, target, reduction), {'out': out}) if _captured is not None: return _captured return _C.multilabel_margin_loss_forward(self=input, target=target, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(multilabel_margin_loss_forward, (input, target, reduction), {}) if _captured is not None: return _captured return _C.multilabel_margin_loss_forward(self=input, target=target, reduction=reduction) def multilabel_margin_loss_backward(grad_output, input, target, reduction, is_target, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(multilabel_margin_loss_backward, (grad_output, input, target, reduction, is_target), {'out': out}) if _captured is not None: return _captured return _C.multilabel_margin_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, is_target=is_target, out=out) if _capturing(): _captured = _capture_call(multilabel_margin_loss_backward, (grad_output, input, target, reduction, is_target), {}) if _captured is not None: return _captured return _C.multilabel_margin_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, is_target=is_target) [docs] def multilabel_soft_margin_loss(input, target): if _capturing(): _captured = _capture_call(multilabel_soft_margin_loss, (input, target), {}) if _captured is not None: return _captured return _C.multilabel_soft_margin_loss(input, target) [docs] def triplet_margin_loss(anchor, positive, negative, margin=1.0, p=2.0): if _capturing(): _captured = _capture_call(triplet_margin_loss, (anchor, positive, negative, margin, p), {}) if _captured is not None: return _captured if not isinstance(margin, (tensorplay.Scalar, tensorplay.Tensor)): margin = tensorplay.Scalar(margin) return _C.triplet_margin_loss(anchor, positive, negative, margin, p) [docs] def lstm(input, hx, params, has_biases=True, num_layers=1, dropout_p=0.0, training=False, bidirectional=False, batch_first=False): if _capturing(): _captured = _capture_call(lstm, (input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first), {}) if _captured is not None: return _captured return _C.lstm(input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first) [docs] def gru(input, hx, params, has_biases=True, num_layers=1, dropout_p=0.0, training=False, bidirectional=False, batch_first=False): if _capturing(): _captured = _capture_call(gru, (input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first), {}) if _captured is not None: return _captured return _C.gru(input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first) [docs] def rnn_relu(input, hx, params, has_biases=True, num_layers=1, dropout_p=0.0, training=False, bidirectional=False, batch_first=False): if _capturing(): _captured = _capture_call(rnn_relu, (input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first), {}) if _captured is not None: return _captured return _C.rnn_relu(input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first) [docs] def rnn_tanh(input, hx, params, has_biases=True, num_layers=1, dropout_p=0.0, training=False, bidirectional=False, batch_first=False): if _capturing(): _captured = _capture_call(rnn_tanh, (input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first), {}) if _captured is not None: return _captured return _C.rnn_tanh(input, hx, params, has_biases, num_layers, dropout_p, training, bidirectional, batch_first) [docs] def logsumexp(input, dim, keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(logsumexp, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.logsumexp(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(logsumexp, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.logsumexp(self=input, dim=dim, keepdim=keepdim) [docs] def tril(input, diagonal=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(tril, (input, diagonal), {'out': out}) if _captured is not None: return _captured return _C.tril(self=input, diagonal=diagonal, out=out) if _capturing(): _captured = _capture_call(tril, (input, diagonal), {}) if _captured is not None: return _captured return _C.tril(self=input, diagonal=diagonal) [docs] def triu(input, diagonal=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(triu, (input, diagonal), {'out': out}) if _captured is not None: return _captured return _C.triu(self=input, diagonal=diagonal, out=out) if _capturing(): _captured = _capture_call(triu, (input, diagonal), {}) if _captured is not None: return _captured return _C.triu(self=input, diagonal=diagonal) [docs] def bessel_j0(input): if _capturing(): _captured = _capture_call(bessel_j0, (input,), {}) if _captured is not None: return _captured return _C.bessel_j0(input) [docs] def bessel_j1(input): if _capturing(): _captured = _capture_call(bessel_j1, (input,), {}) if _captured is not None: return _captured return _C.bessel_j1(input) [docs] def bessel_y0(input): if _capturing(): _captured = _capture_call(bessel_y0, (input,), {}) if _captured is not None: return _captured return _C.bessel_y0(input) [docs] def bessel_y1(input): if _capturing(): _captured = _capture_call(bessel_y1, (input,), {}) if _captured is not None: return _captured return _C.bessel_y1(input) [docs] def airy_ai(input): if _capturing(): _captured = _capture_call(airy_ai, (input,), {}) if _captured is not None: return _captured return _C.airy_ai(input) [docs] def spherical_bessel_j0(input): if _capturing(): _captured = _capture_call(spherical_bessel_j0, (input,), {}) if _captured is not None: return _captured return _C.spherical_bessel_j0(input) [docs] def modified_bessel_i0(input): if _capturing(): _captured = _capture_call(modified_bessel_i0, (input,), {}) if _captured is not None: return _captured return _C.modified_bessel_i0(input) [docs] def modified_bessel_i1(input): if _capturing(): _captured = _capture_call(modified_bessel_i1, (input,), {}) if _captured is not None: return _captured return _C.modified_bessel_i1(input) [docs] def modified_bessel_k0(input): if _capturing(): _captured = _capture_call(modified_bessel_k0, (input,), {}) if _captured is not None: return _captured return _C.modified_bessel_k0(input) [docs] def modified_bessel_k1(input): if _capturing(): _captured = _capture_call(modified_bessel_k1, (input,), {}) if _captured is not None: return _captured return _C.modified_bessel_k1(input) [docs] def scaled_modified_bessel_k0(input): if _capturing(): _captured = _capture_call(scaled_modified_bessel_k0, (input,), {}) if _captured is not None: return _captured return _C.scaled_modified_bessel_k0(input) [docs] def scaled_modified_bessel_k1(input): if _capturing(): _captured = _capture_call(scaled_modified_bessel_k1, (input,), {}) if _captured is not None: return _captured return _C.scaled_modified_bessel_k1(input) [docs] def i0e(input): if _capturing(): _captured = _capture_call(i0e, (input,), {}) if _captured is not None: return _captured return _C.i0e(input) [docs] def i1(input): if _capturing(): _captured = _capture_call(i1, (input,), {}) if _captured is not None: return _captured return _C.i1(input) [docs] def i1e(input): if _capturing(): _captured = _capture_call(i1e, (input,), {}) if _captured is not None: return _captured return _C.i1e(input) [docs] def chebyshev_polynomial_t(x, n): if _capturing(): _captured = _capture_call(chebyshev_polynomial_t, (x, n), {}) if _captured is not None: return _captured return _C.chebyshev_polynomial_t(x, n) [docs] def chebyshev_polynomial_u(x, n): if _capturing(): _captured = _capture_call(chebyshev_polynomial_u, (x, n), {}) if _captured is not None: return _captured return _C.chebyshev_polynomial_u(x, n) [docs] def chebyshev_polynomial_v(x, n): if _capturing(): _captured = _capture_call(chebyshev_polynomial_v, (x, n), {}) if _captured is not None: return _captured return _C.chebyshev_polynomial_v(x, n) [docs] def chebyshev_polynomial_w(x, n): if _capturing(): _captured = _capture_call(chebyshev_polynomial_w, (x, n), {}) if _captured is not None: return _captured return _C.chebyshev_polynomial_w(x, n) [docs] def shifted_chebyshev_polynomial_t(x, n): if _capturing(): _captured = _capture_call(shifted_chebyshev_polynomial_t, (x, n), {}) if _captured is not None: return _captured return _C.shifted_chebyshev_polynomial_t(x, n) [docs] def shifted_chebyshev_polynomial_u(x, n): if _capturing(): _captured = _capture_call(shifted_chebyshev_polynomial_u, (x, n), {}) if _captured is not None: return _captured return _C.shifted_chebyshev_polynomial_u(x, n) [docs] def shifted_chebyshev_polynomial_v(x, n): if _capturing(): _captured = _capture_call(shifted_chebyshev_polynomial_v, (x, n), {}) if _captured is not None: return _captured return _C.shifted_chebyshev_polynomial_v(x, n) [docs] def shifted_chebyshev_polynomial_w(x, n): if _capturing(): _captured = _capture_call(shifted_chebyshev_polynomial_w, (x, n), {}) if _captured is not None: return _captured return _C.shifted_chebyshev_polynomial_w(x, n) [docs] def hermite_polynomial_h(x, n): if _capturing(): _captured = _capture_call(hermite_polynomial_h, (x, n), {}) if _captured is not None: return _captured return _C.hermite_polynomial_h(x, n) [docs] def hermite_polynomial_he(x, n): if _capturing(): _captured = _capture_call(hermite_polynomial_he, (x, n), {}) if _captured is not None: return _captured return _C.hermite_polynomial_he(x, n) [docs] def laguerre_polynomial_l(x, n): if _capturing(): _captured = _capture_call(laguerre_polynomial_l, (x, n), {}) if _captured is not None: return _captured return _C.laguerre_polynomial_l(x, n) [docs] def legendre_polynomial_p(x, n): if _capturing(): _captured = _capture_call(legendre_polynomial_p, (x, n), {}) if _captured is not None: return _captured return _C.legendre_polynomial_p(x, n) [docs] def zeta(input, other): if _capturing(): _captured = _capture_call(zeta, (input, other), {}) if _captured is not None: return _captured return _C.zeta(input, other) [docs] def gammainc(a, x): if _capturing(): _captured = _capture_call(gammainc, (a, x), {}) if _captured is not None: return _captured return _C.gammainc(a, x) [docs] def gammaincc(a, x): if _capturing(): _captured = _capture_call(gammaincc, (a, x), {}) if _captured is not None: return _captured return _C.gammaincc(a, x) [docs] def polygamma(n, input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(polygamma, (n, input), {'out': out}) if _captured is not None: return _captured return _C.polygamma(n=n, self=input, out=out) if _capturing(): _captured = _capture_call(polygamma, (n, input), {}) if _captured is not None: return _captured return _C.polygamma(n=n, self=input) [docs] def sparse_coo_tensor(indices, values, size=None, is_coalesced=False): if _capturing(): _captured = _capture_call(sparse_coo_tensor, (indices, values, size, is_coalesced), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C.sparse_coo_tensor(indices, values, size, is_coalesced=is_coalesced) [docs] def to_dense(input): if _capturing(): _captured = _capture_call(to_dense, (input,), {}) if _captured is not None: return _captured return _C.to_dense(input) [docs] def to_sparse(input, sparse_dim=None): if _capturing(): _captured = _capture_call(to_sparse, (input, sparse_dim), {}) if _captured is not None: return _captured if sparse_dim is None: return _C.to_sparse(input) return _C.to_sparse(input, sparse_dim) [docs] def to_sparse_csr(input): if _capturing(): _captured = _capture_call(to_sparse_csr, (input,), {}) if _captured is not None: return _captured return _C.to_sparse_csr(input) def _nnz(input): if _capturing(): _captured = _capture_call(_nnz, (input,), {}) if _captured is not None: return _captured return _C._nnz(input) [docs] def sparse_mm(input, dense): if _capturing(): _captured = _capture_call(sparse_mm, (input, dense), {}) if _captured is not None: return _captured return _C.sparse_mm(input, dense) def _to_sparse_semi_structured(dense): if _capturing(): _captured = _capture_call(_to_sparse_semi_structured, (dense,), {}) if _captured is not None: return _captured return _C._to_sparse_semi_structured(dense) def _sparse_semi_structured_to_dense(packed, meta): if _capturing(): _captured = _capture_call(_sparse_semi_structured_to_dense, (packed, meta), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_to_dense(packed, meta) def _sparse_semi_structured_mask_grad(grad, packed, meta): if _capturing(): _captured = _capture_call(_sparse_semi_structured_mask_grad, (grad, packed, meta), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_mask_grad(grad, packed, meta) def _sparse_semi_structured_gather_grad(grad_output, packed, meta): if _capturing(): _captured = _capture_call(_sparse_semi_structured_gather_grad, (grad_output, packed, meta), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_gather_grad(grad_output, packed, meta) def _sparse_semi_structured_mm(mat1, mat1_meta, mat2, out_dtype=None): if _capturing(): _captured = _capture_call(_sparse_semi_structured_mm, (mat1, mat1_meta, mat2, out_dtype), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_mm(mat1, mat1_meta, mat2, out_dtype=out_dtype) def _sparse_semi_structured_mm_right(mat2, mat1, mat1_meta, out_dtype=None): if _capturing(): _captured = _capture_call(_sparse_semi_structured_mm_right, (mat2, mat1, mat1_meta, out_dtype), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_mm_right(mat2, mat1, mat1_meta, out_dtype=out_dtype) def _sparse_semi_structured_addmm(input, mat1, mat1_meta, mat2, alpha=1, beta=1, out_dtype=None): if _capturing(): _captured = _capture_call(_sparse_semi_structured_addmm, (input, mat1, mat1_meta, mat2, alpha, beta, out_dtype), {}) if _captured is not None: return _captured if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) if not isinstance(beta, (tensorplay.Scalar, tensorplay.Tensor)): beta = tensorplay.Scalar(beta) return _C._sparse_semi_structured_addmm(input, mat1, mat1_meta, mat2, alpha=alpha, beta=beta, out_dtype=out_dtype) [docs] def sparse_sum(input, dim=None, dtype=None): if _capturing(): _captured = _capture_call(sparse_sum, (input, dim, dtype), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.sparse_sum(input, dim, dtype) [docs] def sparse_add(input, other): if _capturing(): _captured = _capture_call(sparse_add, (input, other), {}) if _captured is not None: return _captured return _C.sparse_add(input, other) [docs] def sparse_mul(input, other): if _capturing(): _captured = _capture_call(sparse_mul, (input, other), {}) if _captured is not None: return _captured return _C.sparse_mul(input, other) [docs] def spdiags(diagonals, offsets, shape, layout=None): if _capturing(): _captured = _capture_call(spdiags, (diagonals, offsets, shape, layout), {}) if _captured is not None: return _captured if isinstance(shape, int) and not isinstance(shape, bool): shape = [shape] return _C.spdiags(diagonals, offsets, shape, layout) [docs] def quantize_per_tensor_dynamic(input, dtype, reduce_range): if _capturing(): _captured = _capture_call(quantize_per_tensor_dynamic, (input, dtype, reduce_range), {}) if _captured is not None: return _captured return _C.quantize_per_tensor_dynamic(input, dtype, reduce_range) [docs] def quantize_per_tensor(input, scale, zero_point, dtype): if _capturing(): _captured = _capture_call(quantize_per_tensor, (input, scale, zero_point, dtype), {}) if _captured is not None: return _captured return _C.quantize_per_tensor(input, scale, zero_point, dtype) [docs] def quantize_per_channel(input, scales, zero_points, axis, dtype): if _capturing(): _captured = _capture_call(quantize_per_channel, (input, scales, zero_points, axis, dtype), {}) if _captured is not None: return _captured return _C.quantize_per_channel(input, scales, zero_points, axis, dtype) def quantize_affine(input, block_size, scales, zero_points, dtype, quant_min, quant_max): if _capturing(): _captured = _capture_call(quantize_affine, (input, block_size, scales, zero_points, dtype, quant_min, quant_max), {}) if _captured is not None: return _captured if isinstance(block_size, int) and not isinstance(block_size, bool): block_size = [block_size] return _C.quantize_affine(input, block_size, scales, zero_points, dtype, quant_min, quant_max) def dequantize_affine(input, block_size, scales, zero_points=None): if _capturing(): _captured = _capture_call(dequantize_affine, (input, block_size, scales, zero_points), {}) if _captured is not None: return _captured if isinstance(block_size, int) and not isinstance(block_size, bool): block_size = [block_size] return _C.dequantize_affine(input, block_size, scales, zero_points) def quantize_affine_float8(input, scale, dtype): if _capturing(): _captured = _capture_call(quantize_affine_float8, (input, scale, dtype), {}) if _captured is not None: return _captured return _C.quantize_affine_float8(input, scale, dtype) def dequantize_affine_float8(input, scale, output_dtype): if _capturing(): _captured = _capture_call(dequantize_affine_float8, (input, scale, output_dtype), {}) if _captured is not None: return _captured return _C.dequantize_affine_float8(input, scale, output_dtype) def choose_scale_float8(input, block_size, float8_dtype, hp_value_lb=None, hp_value_ub=None): if _capturing(): _captured = _capture_call(choose_scale_float8, (input, block_size, float8_dtype, hp_value_lb, hp_value_ub), {}) if _captured is not None: return _captured if isinstance(block_size, int) and not isinstance(block_size, bool): block_size = [block_size] return _C.choose_scale_float8(input, block_size, float8_dtype, hp_value_lb, hp_value_ub) def _quantize_int8_rowwise(input, eps): if _capturing(): _captured = _capture_call(_quantize_int8_rowwise, (input, eps), {}) if _captured is not None: return _captured return _C._quantize_int8_rowwise(input, eps) def _quantize_int4_rowwise(input, eps): if _capturing(): _captured = _capture_call(_quantize_int4_rowwise, (input, eps), {}) if _captured is not None: return _captured return _C._quantize_int4_rowwise(input, eps) def _quantize_int2_rowwise(input, eps): if _capturing(): _captured = _capture_call(_quantize_int2_rowwise, (input, eps), {}) if _captured is not None: return _captured return _C._quantize_int2_rowwise(input, eps) def _quantize_binary_rowwise(input, eps): if _capturing(): _captured = _capture_call(_quantize_binary_rowwise, (input, eps), {}) if _captured is not None: return _captured return _C._quantize_binary_rowwise(input, eps) def _int8_mm_rescale(out, row_scale, col_scale): if _capturing(): _captured = _capture_call(_int8_mm_rescale, (out, row_scale, col_scale), {}) if _captured is not None: return _captured return _C._int8_mm_rescale(out, row_scale, col_scale) [docs] def dequantize(*args): if _capturing(): _captured = _capture_call(dequantize, (*args,), {}) if _captured is not None: return _captured return _C.dequantize(*args) [docs] def quantized_linear(input, weight, input_scale, input_zero_point, weight_scales, weight_zero_points, bias=None, out_scale=1.0, out_zero_point=0): if _capturing(): _captured = _capture_call(quantized_linear, (input, weight, input_scale, input_zero_point, weight_scales, weight_zero_points, bias, out_scale, out_zero_point), {}) if _captured is not None: return _captured return _C.quantized_linear(input, weight, input_scale, input_zero_point, weight_scales, weight_zero_points, bias, out_scale, out_zero_point) def quantized_linear_dynamic(input, weight, weight_scales, weight_zero_points, bias=None, reduce_range=False): if _capturing(): _captured = _capture_call(quantized_linear_dynamic, (input, weight, weight_scales, weight_zero_points, bias, reduce_range), {}) if _captured is not None: return _captured return _C.quantized_linear_dynamic(input, weight, weight_scales, weight_zero_points, bias, reduce_range) [docs] def quantized_add(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point): if _capturing(): _captured = _capture_call(quantized_add, (a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point), {}) if _captured is not None: return _captured return _C.quantized_add(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point) [docs] def quantized_sub(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point): if _capturing(): _captured = _capture_call(quantized_sub, (a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point), {}) if _captured is not None: return _captured return _C.quantized_sub(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point) [docs] def quantized_mul(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point): if _capturing(): _captured = _capture_call(quantized_mul, (a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point), {}) if _captured is not None: return _captured return _C.quantized_mul(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point) [docs] def quantized_div(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point): if _capturing(): _captured = _capture_call(quantized_div, (a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point), {}) if _captured is not None: return _captured return _C.quantized_div(a, b, a_scale, a_zero_point, b_scale, b_zero_point, out_scale, out_zero_point) [docs] def quantized_clamp(input, self_scale, self_zero_point, out_scale, out_zero_point, min=None, max=None): if _capturing(): _captured = _capture_call(quantized_clamp, (input, self_scale, self_zero_point, out_scale, out_zero_point, min, max), {}) if _captured is not None: return _captured if min is not None and not isinstance(min, (tensorplay.Scalar, tensorplay.Tensor)): min = tensorplay.Scalar(min) if max is not None and not isinstance(max, (tensorplay.Scalar, tensorplay.Tensor)): max = tensorplay.Scalar(max) return _C.quantized_clamp(input, self_scale, self_zero_point, out_scale, out_zero_point, min, max) [docs] def quantized_max_pool2d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(quantized_max_pool2d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.quantized_max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def quantized_conv2d_prepack(weight, weight_scales, weight_zero_points, bias=None, transposed=False): if _capturing(): _captured = _capture_call(quantized_conv2d_prepack, (weight, weight_scales, weight_zero_points, bias, transposed), {}) if _captured is not None: return _captured return _C.quantized_conv2d_prepack(weight, weight_scales, weight_zero_points, bias, transposed) [docs] def quantized_conv2d_unpack(weight_packed, bias_packed, weight_sizes, transposed=False, depthwise=False): if _capturing(): _captured = _capture_call(quantized_conv2d_unpack, (weight_packed, bias_packed, weight_sizes, transposed, depthwise), {}) if _captured is not None: return _captured if isinstance(weight_sizes, int) and not isinstance(weight_sizes, bool): weight_sizes = [weight_sizes] return _C.quantized_conv2d_unpack(weight_packed, bias_packed, weight_sizes, transposed, depthwise) [docs] def quantized_conv2d_run(input, weight_packed, bias_packed, weight_sizes, input_scale, input_zero_point, out_scale, out_zero_point, stride=1, padding=0, dilation=1, output_padding=0, groups=1, transposed=False, output_min=None, output_max=None): if _capturing(): _captured = _capture_call(quantized_conv2d_run, (input, weight_packed, bias_packed, weight_sizes, input_scale, input_zero_point, out_scale, out_zero_point, stride, padding, dilation, output_padding, groups, transposed, output_min, output_max), {}) if _captured is not None: return _captured if isinstance(weight_sizes, int) and not isinstance(weight_sizes, bool): weight_sizes = [weight_sizes] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if output_min is not None and not isinstance(output_min, (tensorplay.Scalar, tensorplay.Tensor)): output_min = tensorplay.Scalar(output_min) if output_max is not None and not isinstance(output_max, (tensorplay.Scalar, tensorplay.Tensor)): output_max = tensorplay.Scalar(output_max) return _C.quantized_conv2d_run(input, weight_packed, bias_packed, weight_sizes, input_scale, input_zero_point, out_scale, out_zero_point, stride, padding, dilation, output_padding, groups, transposed, output_min, output_max) [docs] def quantized_conv2d(input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride=1, padding=0, dilation=1, groups=1): if _capturing(): _captured = _capture_call(quantized_conv2d, (input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.quantized_conv2d(input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride, padding, dilation, groups) def quantized_relu(input): if _capturing(): _captured = _capture_call(quantized_relu, (input,), {}) if _captured is not None: return _captured return _C.quantized_relu(input) def quantized_relu6(input): if _capturing(): _captured = _capture_call(quantized_relu6, (input,), {}) if _captured is not None: return _captured return _C.quantized_relu6(input) def quantized_leaky_relu(input, negative_slope, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_leaky_relu, (input, negative_slope, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_leaky_relu(input, negative_slope, output_scale, output_zero_point) def quantized_elu(input, output_scale, output_zero_point, alpha=1.0, scale=1.0, input_scale=1.0): if _capturing(): _captured = _capture_call(quantized_elu, (input, output_scale, output_zero_point, alpha, scale, input_scale), {}) if _captured is not None: return _captured return _C.quantized_elu(input, output_scale, output_zero_point, alpha, scale, input_scale) def quantized_hardswish(input, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_hardswish, (input, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_hardswish(input, output_scale, output_zero_point) def quantized_hardsigmoid(input, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_hardsigmoid, (input, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_hardsigmoid(input, output_scale, output_zero_point) def quantized_sigmoid(input, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_sigmoid, (input, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_sigmoid(input, output_scale, output_zero_point) def quantized_tanh(input, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_tanh, (input, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_tanh(input, output_scale, output_zero_point) def quantized_cat(tensors, dim=0, scale=None, zero_point=None): if _capturing(): _captured = _capture_call(quantized_cat, (tensors, dim, scale, zero_point), {}) if _captured is not None: return _captured return _C.quantized_cat(tensors, dim, scale, zero_point) def quantized_cat_relu(tensors, dim=0, scale=None, zero_point=None): if _capturing(): _captured = _capture_call(quantized_cat_relu, (tensors, dim, scale, zero_point), {}) if _captured is not None: return _captured return _C.quantized_cat_relu(tensors, dim, scale, zero_point) def quantized_conv1d(input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride=1, padding=0, dilation=1, groups=1): if _capturing(): _captured = _capture_call(quantized_conv1d, (input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.quantized_conv1d(input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride, padding, dilation, groups) def quantized_conv3d(input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride=1, padding=0, dilation=1, groups=1): if _capturing(): _captured = _capture_call(quantized_conv3d, (input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.quantized_conv3d(input, weight, bias, input_scale, input_zero_point, weight_scale, weight_zero_point, out_scale, out_zero_point, stride, padding, dilation, groups) [docs] def forward_neg(a, da): if _capturing(): _captured = _capture_call(forward_neg, (a, da), {}) if _captured is not None: return _captured return _C.forward_neg(a, da) [docs] def forward_exp(a, da): if _capturing(): _captured = _capture_call(forward_exp, (a, da), {}) if _captured is not None: return _captured return _C.forward_exp(a, da) [docs] def forward_log(a, da): if _capturing(): _captured = _capture_call(forward_log, (a, da), {}) if _captured is not None: return _captured return _C.forward_log(a, da) [docs] def forward_sin(a, da): if _capturing(): _captured = _capture_call(forward_sin, (a, da), {}) if _captured is not None: return _captured return _C.forward_sin(a, da) [docs] def forward_cos(a, da): if _capturing(): _captured = _capture_call(forward_cos, (a, da), {}) if _captured is not None: return _captured return _C.forward_cos(a, da) [docs] def forward_sqrt(a, da): if _capturing(): _captured = _capture_call(forward_sqrt, (a, da), {}) if _captured is not None: return _captured return _C.forward_sqrt(a, da) [docs] def forward_tanh(a, da): if _capturing(): _captured = _capture_call(forward_tanh, (a, da), {}) if _captured is not None: return _captured return _C.forward_tanh(a, da) [docs] def forward_sigmoid(a, da): if _capturing(): _captured = _capture_call(forward_sigmoid, (a, da), {}) if _captured is not None: return _captured return _C.forward_sigmoid(a, da) [docs] def forward_relu(a, da): if _capturing(): _captured = _capture_call(forward_relu, (a, da), {}) if _captured is not None: return _captured return _C.forward_relu(a, da) [docs] def forward_add(a, da, b, db): if _capturing(): _captured = _capture_call(forward_add, (a, da, b, db), {}) if _captured is not None: return _captured return _C.forward_add(a, da, b, db) [docs] def forward_sub(a, da, b, db): if _capturing(): _captured = _capture_call(forward_sub, (a, da, b, db), {}) if _captured is not None: return _captured return _C.forward_sub(a, da, b, db) [docs] def forward_mul(a, da, b, db): if _capturing(): _captured = _capture_call(forward_mul, (a, da, b, db), {}) if _captured is not None: return _captured return _C.forward_mul(a, da, b, db) [docs] def forward_div(a, da, b, db): if _capturing(): _captured = _capture_call(forward_div, (a, da, b, db), {}) if _captured is not None: return _captured return _C.forward_div(a, da, b, db) [docs] def forward_pow(a, da, b, db): if _capturing(): _captured = _capture_call(forward_pow, (a, da, b, db), {}) if _captured is not None: return _captured return _C.forward_pow(a, da, b, db) [docs] def forward_mm(a, da, b, db): if _capturing(): _captured = _capture_call(forward_mm, (a, da, b, db), {}) if _captured is not None: return _captured return _C.forward_mm(a, da, b, db) [docs] def expand(input, size, implicit=False): if _capturing(): _captured = _capture_call(expand, (input, size, implicit), {}) if _captured is not None: return _captured return input.expand(size=size, implicit=implicit) [docs] def expand_as(input, other): if _capturing(): _captured = _capture_call(expand_as, (input, other), {}) if _captured is not None: return _captured return input.expand_as(other=other) [docs] def broadcast_to(input, size): if _capturing(): _captured = _capture_call(broadcast_to, (input, size), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C.broadcast_to(input, size) [docs] def repeat(input, repeats): if _capturing(): _captured = _capture_call(repeat, (input, repeats), {}) if _captured is not None: return _captured return input.repeat(repeats=repeats) [docs] def tile(input, dims): if _capturing(): _captured = _capture_call(tile, (input, dims), {}) if _captured is not None: return _captured if isinstance(dims, int) and not isinstance(dims, bool): dims = [dims] return _C.tile(input, dims) [docs] def hstack(*args): if _capturing(): _captured = _capture_call(hstack, (*args,), {}) if _captured is not None: return _captured return _C.hstack(*args) [docs] def vstack(*args): if _capturing(): _captured = _capture_call(vstack, (*args,), {}) if _captured is not None: return _captured return _C.vstack(*args) [docs] def dstack(*args): if _capturing(): _captured = _capture_call(dstack, (*args,), {}) if _captured is not None: return _captured return _C.dstack(*args) [docs] def row_stack(*args): if _capturing(): _captured = _capture_call(row_stack, (*args,), {}) if _captured is not None: return _captured return _C.row_stack(*args) [docs] def column_stack(*args): if _capturing(): _captured = _capture_call(column_stack, (*args,), {}) if _captured is not None: return _captured return _C.column_stack(*args) [docs] def tensor_split(input, sections, dim=0): if _capturing(): _captured = _capture_call(tensor_split, (input, sections, dim), {}) if _captured is not None: return _captured return _C.tensor_split(input, sections, dim) [docs] def hsplit(input, sections): if _capturing(): _captured = _capture_call(hsplit, (input, sections), {}) if _captured is not None: return _captured return _C.hsplit(input, sections) [docs] def vsplit(input, sections): if _capturing(): _captured = _capture_call(vsplit, (input, sections), {}) if _captured is not None: return _captured return _C.vsplit(input, sections) [docs] def dsplit(input, sections): if _capturing(): _captured = _capture_call(dsplit, (input, sections), {}) if _captured is not None: return _captured return _C.dsplit(input, sections) [docs] def atleast_1d(*args): if _capturing(): _captured = _capture_call(atleast_1d, (*args,), {}) if _captured is not None: return _captured if len(args) == 1: return _C.atleast_1d(args[0]) return _C.atleast_1d(list(args)) [docs] def atleast_2d(*args): if _capturing(): _captured = _capture_call(atleast_2d, (*args,), {}) if _captured is not None: return _captured if len(args) == 1: return _C.atleast_2d(args[0]) return _C.atleast_2d(list(args)) [docs] def atleast_3d(*args): if _capturing(): _captured = _capture_call(atleast_3d, (*args,), {}) if _captured is not None: return _captured if len(args) == 1: return _C.atleast_3d(args[0]) return _C.atleast_3d(list(args)) [docs] def flatten(input, start_dim=0, end_dim=-1): if _capturing(): _captured = _capture_call(flatten, (input, start_dim, end_dim), {}) if _captured is not None: return _captured return _C.flatten(input, start_dim, end_dim) [docs] def unflatten(input, dim, sizes): if _capturing(): _captured = _capture_call(unflatten, (input, dim, sizes), {}) if _captured is not None: return _captured if isinstance(sizes, int) and not isinstance(sizes, bool): sizes = [sizes] return _C.unflatten(input, dim, sizes) [docs] def ravel(input): if _capturing(): _captured = _capture_call(ravel, (input,), {}) if _captured is not None: return _captured return _C.ravel(input) [docs] def moveaxis(input, source, destination): if _capturing(): _captured = _capture_call(moveaxis, (input, source, destination), {}) if _captured is not None: return _captured if isinstance(source, int) and not isinstance(source, bool): source = [source] if isinstance(destination, int) and not isinstance(destination, bool): destination = [destination] return _C.moveaxis(input, source, destination) [docs] def swapaxes(input, axis0, axis1): if _capturing(): _captured = _capture_call(swapaxes, (input, axis0, axis1), {}) if _captured is not None: return _captured return _C.swapaxes(input, axis0, axis1) [docs] def swapdims(input, dim0, dim1): if _capturing(): _captured = _capture_call(swapdims, (input, dim0, dim1), {}) if _captured is not None: return _captured return _C.swapdims(input, dim0, dim1) [docs] def argwhere(input): if _capturing(): _captured = _capture_call(argwhere, (input,), {}) if _captured is not None: return _captured return _C.argwhere(input) [docs] def fill(input, value): if _capturing(): _captured = _capture_call(fill, (input, value), {}) if _captured is not None: return _captured if not isinstance(value, (tensorplay.Scalar, tensorplay.Tensor)): value = tensorplay.Scalar(value) return _C.fill(input, value) [docs] def equal(input, other): if _capturing(): _captured = _capture_call(equal, (input, other), {}) if _captured is not None: return _captured if _traced_values(): if (input.shape != other.shape or input.dtype != other.dtype or input.device != other.device): return tensorplay.zeros((), dtype=tensorplay.bool) return (input == other).all() return _C.equal(input, other) [docs] def allclose(input, other, rtol=1e-05, atol=1e-08, equal_nan=False): if _capturing(): _captured = _capture_call(allclose, (input, other, rtol, atol, equal_nan), {}) if _captured is not None: return _captured if _traced_values(): return isclose(input, other, rtol, atol, equal_nan).all() return _C.allclose(input, other, rtol, atol, equal_nan) [docs] def scatter_reduce(input, dim, index, src, reduce, *, include_self=True, out=None): if out is not None: if _capturing(): _captured = _capture_call(scatter_reduce, (input, dim, index, src, reduce), {'include_self': include_self, 'out': out}) if _captured is not None: return _captured return _C.scatter_reduce(input, dim, index, src, reduce, include_self=include_self, out=out) if _capturing(): _captured = _capture_call(scatter_reduce, (input, dim, index, src, reduce), {'include_self': include_self}) if _captured is not None: return _captured return _C.scatter_reduce(input, dim, index, src, reduce, include_self=include_self) [docs] def index_reduce(input, dim, index, source, reduce, *, include_self=True, out=None): if out is not None: if _capturing(): _captured = _capture_call(index_reduce, (input, dim, index, source, reduce), {'include_self': include_self, 'out': out}) if _captured is not None: return _captured return _C.index_reduce(self=input, dim=dim, index=index, source=source, reduce=reduce, include_self=include_self, out=out) if _capturing(): _captured = _capture_call(index_reduce, (input, dim, index, source, reduce), {'include_self': include_self}) if _captured is not None: return _captured return _C.index_reduce(self=input, dim=dim, index=index, source=source, reduce=reduce, include_self=include_self) def _scatter_reduce_backward_self(grad, input, dim, index, src, reduce, include_self): if _capturing(): _captured = _capture_call(_scatter_reduce_backward_self, (grad, input, dim, index, src, reduce, include_self), {}) if _captured is not None: return _captured return _C._scatter_reduce_backward_self(grad, input, dim, index, src, reduce, include_self) def _scatter_reduce_backward_src(grad, input, dim, index, src, reduce, include_self): if _capturing(): _captured = _capture_call(_scatter_reduce_backward_src, (grad, input, dim, index, src, reduce, include_self), {}) if _captured is not None: return _captured return _C._scatter_reduce_backward_src(grad, input, dim, index, src, reduce, include_self) def _index_reduce_backward_self(grad, input, dim, index, source, reduce, include_self): if _capturing(): _captured = _capture_call(_index_reduce_backward_self, (grad, input, dim, index, source, reduce, include_self), {}) if _captured is not None: return _captured return _C._index_reduce_backward_self(grad, input, dim, index, source, reduce, include_self) def _index_reduce_backward_src(grad, input, dim, index, source, reduce, include_self): if _capturing(): _captured = _capture_call(_index_reduce_backward_src, (grad, input, dim, index, source, reduce, include_self), {}) if _captured is not None: return _captured return _C._index_reduce_backward_src(grad, input, dim, index, source, reduce, include_self) [docs] def grouped_mm(input, mat2, offs): if _capturing(): _captured = _capture_call(grouped_mm, (input, mat2, offs), {}) if _captured is not None: return _captured return _C.grouped_mm(input, mat2, offs) [docs] def rms_norm(input, normalized_shape, weight=None, eps=None): if _capturing(): _captured = _capture_call(rms_norm, (input, normalized_shape, weight, eps), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C.rms_norm(input, normalized_shape, weight, eps) [docs] def linear(input, weight, bias=None): if _capturing(): _captured = _capture_call(linear, (input, weight, bias), {}) if _captured is not None: return _captured return _C.linear(input, weight, bias) [docs] def absolute(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(absolute, (input,), {'out': out}) if _captured is not None: return _captured return _C.absolute(self=input, out=out) if _capturing(): _captured = _capture_call(absolute, (input,), {}) if _captured is not None: return _captured return _C.absolute(self=input) [docs] def absolute_(input): return input.absolute_() [docs] def arccos(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(arccos, (input,), {'out': out}) if _captured is not None: return _captured return _C.arccos(self=input, out=out) if _capturing(): _captured = _capture_call(arccos, (input,), {}) if _captured is not None: return _captured return _C.arccos(self=input) [docs] def arccos_(input): if _capturing(): _captured = _capture_call(arccos_, (input,), {}) if _captured is not None: return _captured return _C.arccos_(input) [docs] def arccosh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(arccosh, (input,), {'out': out}) if _captured is not None: return _captured return _C.arccosh(self=input, out=out) if _capturing(): _captured = _capture_call(arccosh, (input,), {}) if _captured is not None: return _captured return _C.arccosh(self=input) [docs] def arccosh_(input): if _capturing(): _captured = _capture_call(arccosh_, (input,), {}) if _captured is not None: return _captured return _C.arccosh_(input) [docs] def arcsin(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(arcsin, (input,), {'out': out}) if _captured is not None: return _captured return _C.arcsin(self=input, out=out) if _capturing(): _captured = _capture_call(arcsin, (input,), {}) if _captured is not None: return _captured return _C.arcsin(self=input) [docs] def arcsin_(input): if _capturing(): _captured = _capture_call(arcsin_, (input,), {}) if _captured is not None: return _captured return _C.arcsin_(input) [docs] def arcsinh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(arcsinh, (input,), {'out': out}) if _captured is not None: return _captured return _C.arcsinh(self=input, out=out) if _capturing(): _captured = _capture_call(arcsinh, (input,), {}) if _captured is not None: return _captured return _C.arcsinh(self=input) [docs] def arcsinh_(input): if _capturing(): _captured = _capture_call(arcsinh_, (input,), {}) if _captured is not None: return _captured return _C.arcsinh_(input) [docs] def arctan(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(arctan, (input,), {'out': out}) if _captured is not None: return _captured return _C.arctan(self=input, out=out) if _capturing(): _captured = _capture_call(arctan, (input,), {}) if _captured is not None: return _captured return _C.arctan(self=input) [docs] def arctan_(input): if _capturing(): _captured = _capture_call(arctan_, (input,), {}) if _captured is not None: return _captured return _C.arctan_(input) [docs] def arctanh(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(arctanh, (input,), {'out': out}) if _captured is not None: return _captured return _C.arctanh(self=input, out=out) if _capturing(): _captured = _capture_call(arctanh, (input,), {}) if _captured is not None: return _captured return _C.arctanh(self=input) [docs] def arctanh_(input): if _capturing(): _captured = _capture_call(arctanh_, (input,), {}) if _captured is not None: return _captured return _C.arctanh_(input) [docs] def avg_pool1d(input, kernel_size, stride=[], padding=0, ceil_mode=False, count_include_pad=True): if _capturing(): _captured = _capture_call(avg_pool1d, (input, kernel_size, stride, padding, ceil_mode, count_include_pad), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] return _C.avg_pool1d(input, kernel_size, stride, padding, ceil_mode, count_include_pad) [docs] def adaptive_avg_pool1d(input, output_size): if _capturing(): _captured = _capture_call(adaptive_avg_pool1d, (input, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.adaptive_avg_pool1d(input, output_size) [docs] def adaptive_max_pool1d(input, output_size): if _capturing(): _captured = _capture_call(adaptive_max_pool1d, (input, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.adaptive_max_pool1d(input, output_size) [docs] def max_pool1d_with_indices(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(max_pool1d_with_indices, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.max_pool1d_with_indices(input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def max_pool1d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(max_pool1d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.max_pool1d(input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def concat(tensors, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(concat, (tensors, dim), {'out': out}) if _captured is not None: return _captured return _C.concat(tensors=tensors, dim=dim, out=out) if _capturing(): _captured = _capture_call(concat, (tensors, dim), {}) if _captured is not None: return _captured return _C.concat(tensors=tensors, dim=dim) [docs] def concatenate(tensors, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(concatenate, (tensors, dim), {'out': out}) if _captured is not None: return _captured return _C.concatenate(tensors=tensors, dim=dim, out=out) if _capturing(): _captured = _capture_call(concatenate, (tensors, dim), {}) if _captured is not None: return _captured return _C.concatenate(tensors=tensors, dim=dim) [docs] def diagflat(input, offset=0): if _capturing(): _captured = _capture_call(diagflat, (input, offset), {}) if _captured is not None: return _captured return _C.diagflat(input, offset) [docs] def ger(input, vec2, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(ger, (input, vec2), {'out': out}) if _captured is not None: return _captured return _C.ger(self=input, vec2=vec2, out=out) if _capturing(): _captured = _capture_call(ger, (input, vec2), {}) if _captured is not None: return _captured return _C.ger(self=input, vec2=vec2) [docs] def kron(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(kron, (input, other), {'out': out}) if _captured is not None: return _captured return _C.kron(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(kron, (input, other), {}) if _captured is not None: return _captured return _C.kron(self=input, other=other) [docs] def matrix_power(input, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(matrix_power, (input, n), {'out': out}) if _captured is not None: return _captured return _C.matrix_power(self=input, n=n, out=out) if _capturing(): _captured = _capture_call(matrix_power, (input, n), {}) if _captured is not None: return _captured return _C.matrix_power(self=input, n=n) [docs] def vander(x, N=None, increasing=False): if _capturing(): _captured = _capture_call(vander, (x, N, increasing), {}) if _captured is not None: return _captured return _C.vander(x, N, increasing) [docs] def cartesian_prod(*args): if _capturing(): _captured = _capture_call(cartesian_prod, (*args,), {}) if _captured is not None: return _captured return _C.cartesian_prod(list(args)) [docs] def silu_mul(gate, up): if _capturing(): _captured = _capture_call(silu_mul, (gate, up), {}) if _captured is not None: return _captured return _C.silu_mul(gate, up) [docs] def fused_swiglu(gate, up): if _capturing(): _captured = _capture_call(fused_swiglu, (gate, up), {}) if _captured is not None: return _captured return _C.fused_swiglu(gate, up) [docs] def silu_and_mul(input): if _capturing(): _captured = _capture_call(silu_and_mul, (input,), {}) if _captured is not None: return _captured return _C.silu_and_mul(input) [docs] def rotary_embedding(input, cos, sin, position_offset=0): if _capturing(): _captured = _capture_call(rotary_embedding, (input, cos, sin, position_offset), {}) if _captured is not None: return _captured return _C.rotary_embedding(input, cos, sin, position_offset) [docs] def fused_rope(query, key, cos, sin, position_offset=0): if _capturing(): _captured = _capture_call(fused_rope, (query, key, cos, sin, position_offset), {}) if _captured is not None: return _captured return _C.fused_rope(query, key, cos, sin, position_offset) [docs] def acos_(input): if _capturing(): _captured = _capture_call(acos_, (input,), {}) if _captured is not None: return _captured return _C.acos_(input) [docs] def acosh_(input): if _capturing(): _captured = _capture_call(acosh_, (input,), {}) if _captured is not None: return _captured return _C.acosh_(input) [docs] def addbmm_(input, batch1, batch2, beta=1, alpha=1): if _capturing(): _captured = _capture_call(addbmm_, (input, batch1, batch2, beta, alpha), {}) if _captured is not None: return _captured if not isinstance(beta, (tensorplay.Scalar, tensorplay.Tensor)): beta = tensorplay.Scalar(beta) if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C.addbmm_(input, batch1, batch2, beta=beta, alpha=alpha) [docs] def addmm_(input, mat1, mat2, beta=1, alpha=1): if _capturing(): _captured = _capture_call(addmm_, (input, mat1, mat2, beta, alpha), {}) if _captured is not None: return _captured if not isinstance(beta, (tensorplay.Scalar, tensorplay.Tensor)): beta = tensorplay.Scalar(beta) if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C.addmm_(input, mat1, mat2, beta=beta, alpha=alpha) [docs] def addmv_(input, mat, vec, beta=1, alpha=1): if _capturing(): _captured = _capture_call(addmv_, (input, mat, vec, beta, alpha), {}) if _captured is not None: return _captured if not isinstance(beta, (tensorplay.Scalar, tensorplay.Tensor)): beta = tensorplay.Scalar(beta) if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C.addmv_(input, mat, vec, beta=beta, alpha=alpha) [docs] def addr_(input, vec1, vec2, beta=1, alpha=1): if _capturing(): _captured = _capture_call(addr_, (input, vec1, vec2, beta, alpha), {}) if _captured is not None: return _captured if not isinstance(beta, (tensorplay.Scalar, tensorplay.Tensor)): beta = tensorplay.Scalar(beta) if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C.addr_(input, vec1, vec2, beta=beta, alpha=alpha) [docs] def asin_(input): if _capturing(): _captured = _capture_call(asin_, (input,), {}) if _captured is not None: return _captured return _C.asin_(input) [docs] def asinh_(input): if _capturing(): _captured = _capture_call(asinh_, (input,), {}) if _captured is not None: return _captured return _C.asinh_(input) [docs] def atan2_(input, other): if _capturing(): _captured = _capture_call(atan2_, (input, other), {}) if _captured is not None: return _captured return _C.atan2_(input, other) [docs] def atan_(input): if _capturing(): _captured = _capture_call(atan_, (input,), {}) if _captured is not None: return _captured return _C.atan_(input) [docs] def atanh_(input): if _capturing(): _captured = _capture_call(atanh_, (input,), {}) if _captured is not None: return _captured return _C.atanh_(input) [docs] def bitwise_not_(input): if _capturing(): _captured = _capture_call(bitwise_not_, (input,), {}) if _captured is not None: return _captured return _C.bitwise_not_(input) [docs] def ceil_(input): if _capturing(): _captured = _capture_call(ceil_, (input,), {}) if _captured is not None: return _captured return _C.ceil_(input) [docs] def celu_(input, alpha=1.0): if _capturing(): _captured = _capture_call(celu_, (input, alpha), {}) if _captured is not None: return _captured if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C.celu_(input, alpha) [docs] def clip_(input, min=None, max=None): if _capturing(): _captured = _capture_call(clip_, (input, min, max), {}) if _captured is not None: return _captured if min is not None and not isinstance(min, (tensorplay.Scalar, tensorplay.Tensor)): min = tensorplay.Scalar(min) if max is not None and not isinstance(max, (tensorplay.Scalar, tensorplay.Tensor)): max = tensorplay.Scalar(max) return _C.clip_(input, min, max) [docs] def cos_(input): if _capturing(): _captured = _capture_call(cos_, (input,), {}) if _captured is not None: return _captured return _C.cos_(input) [docs] def cosh_(input): if _capturing(): _captured = _capture_call(cosh_, (input,), {}) if _captured is not None: return _captured return _C.cosh_(input) [docs] def cumprod_(input, dim, dtype=None): if _capturing(): _captured = _capture_call(cumprod_, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.cumprod_(input, dim, dtype) [docs] def cumsum_(input, dim=0, dtype=None): if _capturing(): _captured = _capture_call(cumsum_, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.cumsum_(input, dim, dtype) [docs] def deg2rad_(input): if _capturing(): _captured = _capture_call(deg2rad_, (input,), {}) if _captured is not None: return _captured return _C.deg2rad_(input) [docs] def elu_(input, alpha=1, scale=1, input_scale=1): if _capturing(): _captured = _capture_call(elu_, (input, alpha, scale, input_scale), {}) if _captured is not None: return _captured if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) if not isinstance(scale, (tensorplay.Scalar, tensorplay.Tensor)): scale = tensorplay.Scalar(scale) if not isinstance(input_scale, (tensorplay.Scalar, tensorplay.Tensor)): input_scale = tensorplay.Scalar(input_scale) return _C.elu_(input, alpha, scale, input_scale) [docs] def erf_(input): if _capturing(): _captured = _capture_call(erf_, (input,), {}) if _captured is not None: return _captured return _C.erf_(input) [docs] def erfc_(input): if _capturing(): _captured = _capture_call(erfc_, (input,), {}) if _captured is not None: return _captured return _C.erfc_(input) [docs] def erfinv_(input): if _capturing(): _captured = _capture_call(erfinv_, (input,), {}) if _captured is not None: return _captured return _C.erfinv_(input) [docs] def exp2_(input): if _capturing(): _captured = _capture_call(exp2_, (input,), {}) if _captured is not None: return _captured return _C.exp2_(input) [docs] def exp_(input): if _capturing(): _captured = _capture_call(exp_, (input,), {}) if _captured is not None: return _captured return _C.exp_(input) [docs] def expm1_(input): if _capturing(): _captured = _capture_call(expm1_, (input,), {}) if _captured is not None: return _captured return _C.expm1_(input) [docs] def floor_(input): if _capturing(): _captured = _capture_call(floor_, (input,), {}) if _captured is not None: return _captured return _C.floor_(input) [docs] def frac_(input): if _capturing(): _captured = _capture_call(frac_, (input,), {}) if _captured is not None: return _captured return _C.frac_(input) [docs] def gcd_(input, other): if _capturing(): _captured = _capture_call(gcd_, (input, other), {}) if _captured is not None: return _captured return _C.gcd_(input, other) [docs] def gelu_(input, approximate='none'): if _capturing(): _captured = _capture_call(gelu_, (input, approximate), {}) if _captured is not None: return _captured return _C.gelu_(input, approximate) [docs] def hardsigmoid_(input): if _capturing(): _captured = _capture_call(hardsigmoid_, (input,), {}) if _captured is not None: return _captured return _C.hardsigmoid_(input) [docs] def hardswish_(input): if _capturing(): _captured = _capture_call(hardswish_, (input,), {}) if _captured is not None: return _captured return _C.hardswish_(input) [docs] def hardtanh_(input, min_val=-1, max_val=1): if _capturing(): _captured = _capture_call(hardtanh_, (input, min_val, max_val), {}) if _captured is not None: return _captured if not isinstance(min_val, (tensorplay.Scalar, tensorplay.Tensor)): min_val = tensorplay.Scalar(min_val) if not isinstance(max_val, (tensorplay.Scalar, tensorplay.Tensor)): max_val = tensorplay.Scalar(max_val) return _C.hardtanh_(input, min_val, max_val) [docs] def heaviside_(input, values): if _capturing(): _captured = _capture_call(heaviside_, (input, values), {}) if _captured is not None: return _captured return _C.heaviside_(input, values) [docs] def hypot_(input, other): if _capturing(): _captured = _capture_call(hypot_, (input, other), {}) if _captured is not None: return _captured return _C.hypot_(input, other) [docs] def index_add_(input, dim, index, source): if _capturing(): _captured = _capture_call(index_add_, (input, dim, index, source), {}) if _captured is not None: return _captured return _C.index_add_(input, dim, index, source) [docs] def index_copy_(input, dim, index, source): if _capturing(): _captured = _capture_call(index_copy_, (input, dim, index, source), {}) if _captured is not None: return _captured return _C.index_copy_(input, dim, index, source) [docs] def index_reduce_(input, dim, index, source, reduce, include_self=True): if _capturing(): _captured = _capture_call(index_reduce_, (input, dim, index, source, reduce, include_self), {}) if _captured is not None: return _captured return _C.index_reduce_(input, dim, index, source, reduce, include_self=include_self) [docs] def lcm_(input, other): if _capturing(): _captured = _capture_call(lcm_, (input, other), {}) if _captured is not None: return _captured return _C.lcm_(input, other) [docs] def leaky_relu_(input, negative_slope=0.01): if _capturing(): _captured = _capture_call(leaky_relu_, (input, negative_slope), {}) if _captured is not None: return _captured if not isinstance(negative_slope, (tensorplay.Scalar, tensorplay.Tensor)): negative_slope = tensorplay.Scalar(negative_slope) return _C.leaky_relu_(input, negative_slope) [docs] def lgamma_(input): if _capturing(): _captured = _capture_call(lgamma_, (input,), {}) if _captured is not None: return _captured return _C.lgamma_(input) [docs] def log10_(input): if _capturing(): _captured = _capture_call(log10_, (input,), {}) if _captured is not None: return _captured return _C.log10_(input) [docs] def log1p_(input): if _capturing(): _captured = _capture_call(log1p_, (input,), {}) if _captured is not None: return _captured return _C.log1p_(input) [docs] def log2_(input): if _capturing(): _captured = _capture_call(log2_, (input,), {}) if _captured is not None: return _captured return _C.log2_(input) [docs] def log_(input): if _capturing(): _captured = _capture_call(log_, (input,), {}) if _captured is not None: return _captured return _C.log_(input) [docs] def logical_and_(input, other): if _capturing(): _captured = _capture_call(logical_and_, (input, other), {}) if _captured is not None: return _captured return _C.logical_and_(input, other) [docs] def logical_not_(input): if _capturing(): _captured = _capture_call(logical_not_, (input,), {}) if _captured is not None: return _captured return _C.logical_not_(input) [docs] def logical_or_(input, other): if _capturing(): _captured = _capture_call(logical_or_, (input, other), {}) if _captured is not None: return _captured return _C.logical_or_(input, other) [docs] def logical_xor_(input, other): if _capturing(): _captured = _capture_call(logical_xor_, (input, other), {}) if _captured is not None: return _captured return _C.logical_xor_(input, other) [docs] def logit_(input, eps=None): if _capturing(): _captured = _capture_call(logit_, (input, eps), {}) if _captured is not None: return _captured if eps is not None and not isinstance(eps, (tensorplay.Scalar, tensorplay.Tensor)): eps = tensorplay.Scalar(eps) return _C.logit_(input, eps) [docs] def masked_scatter_(input, mask, source): if _capturing(): _captured = _capture_call(masked_scatter_, (input, mask, source), {}) if _captured is not None: return _captured return _C.masked_scatter_(input, mask, source) [docs] def mish_(input): if _capturing(): _captured = _capture_call(mish_, (input,), {}) if _captured is not None: return _captured return _C.mish_(input) [docs] def nan_to_num_(input, nan=0.0, posinf=None, neginf=None): if _capturing(): _captured = _capture_call(nan_to_num_, (input, nan, posinf, neginf), {}) if _captured is not None: return _captured if not isinstance(nan, (tensorplay.Scalar, tensorplay.Tensor)): nan = tensorplay.Scalar(nan) if posinf is not None and not isinstance(posinf, (tensorplay.Scalar, tensorplay.Tensor)): posinf = tensorplay.Scalar(posinf) if neginf is not None and not isinstance(neginf, (tensorplay.Scalar, tensorplay.Tensor)): neginf = tensorplay.Scalar(neginf) return _C.nan_to_num_(input, nan, posinf, neginf) [docs] def nextafter_(input, other): if _capturing(): _captured = _capture_call(nextafter_, (input, other), {}) if _captured is not None: return _captured return _C.nextafter_(input, other) [docs] def rad2deg_(input): if _capturing(): _captured = _capture_call(rad2deg_, (input,), {}) if _captured is not None: return _captured return _C.rad2deg_(input) [docs] def reciprocal_(input): if _capturing(): _captured = _capture_call(reciprocal_, (input,), {}) if _captured is not None: return _captured return _C.reciprocal_(input) [docs] def relu6_(input): if _capturing(): _captured = _capture_call(relu6_, (input,), {}) if _captured is not None: return _captured return _C.relu6_(input) [docs] def renorm_(input, p, dim, maxnorm): if _capturing(): _captured = _capture_call(renorm_, (input, p, dim, maxnorm), {}) if _captured is not None: return _captured if not isinstance(p, (tensorplay.Scalar, tensorplay.Tensor)): p = tensorplay.Scalar(p) if not isinstance(maxnorm, (tensorplay.Scalar, tensorplay.Tensor)): maxnorm = tensorplay.Scalar(maxnorm) return _C.renorm_(input, p, dim, maxnorm) [docs] def round_(input): if _capturing(): _captured = _capture_call(round_, (input,), {}) if _captured is not None: return _captured return _C.round_(input) [docs] def selu_(input): if _capturing(): _captured = _capture_call(selu_, (input,), {}) if _captured is not None: return _captured return _C.selu_(input) [docs] def sgn_(input): if _capturing(): _captured = _capture_call(sgn_, (input,), {}) if _captured is not None: return _captured return _C.sgn_(input) [docs] def sigmoid_(input): if _capturing(): _captured = _capture_call(sigmoid_, (input,), {}) if _captured is not None: return _captured return _C.sigmoid_(input) [docs] def sign_(input): if _capturing(): _captured = _capture_call(sign_, (input,), {}) if _captured is not None: return _captured return _C.sign_(input) [docs] def silu_(input): if _capturing(): _captured = _capture_call(silu_, (input,), {}) if _captured is not None: return _captured return _C.silu_(input) [docs] def sin_(input): if _capturing(): _captured = _capture_call(sin_, (input,), {}) if _captured is not None: return _captured return _C.sin_(input) [docs] def sinc_(input): if _capturing(): _captured = _capture_call(sinc_, (input,), {}) if _captured is not None: return _captured return _C.sinc_(input) [docs] def sinh_(input): if _capturing(): _captured = _capture_call(sinh_, (input,), {}) if _captured is not None: return _captured return _C.sinh_(input) [docs] def square_(input): if _capturing(): _captured = _capture_call(square_, (input,), {}) if _captured is not None: return _captured return _C.square_(input) [docs] def tan_(input): if _capturing(): _captured = _capture_call(tan_, (input,), {}) if _captured is not None: return _captured return _C.tan_(input) [docs] def tanh_(input): if _capturing(): _captured = _capture_call(tanh_, (input,), {}) if _captured is not None: return _captured return _C.tanh_(input) [docs] def tril_(input, diagonal=0): if _capturing(): _captured = _capture_call(tril_, (input, diagonal), {}) if _captured is not None: return _captured return _C.tril_(input, diagonal) [docs] def triu_(input, diagonal=0): if _capturing(): _captured = _capture_call(triu_, (input, diagonal), {}) if _captured is not None: return _captured return _C.triu_(input, diagonal) [docs] def trunc_(input): if _capturing(): _captured = _capture_call(trunc_, (input,), {}) if _captured is not None: return _captured return _C.trunc_(input) [docs] def threshold_(input, threshold, value): if _capturing(): _captured = _capture_call(threshold_, (input, threshold, value), {}) if _captured is not None: return _captured if not isinstance(threshold, (tensorplay.Scalar, tensorplay.Tensor)): threshold = tensorplay.Scalar(threshold) if not isinstance(value, (tensorplay.Scalar, tensorplay.Tensor)): value = tensorplay.Scalar(value) return _C.threshold_(input, threshold, value) [docs] def i0_(input): if _capturing(): _captured = _capture_call(i0_, (input,), {}) if _captured is not None: return _captured return _C.i0_(input) [docs] def chain_matmul(*args, out=None): if _capturing(): _captured = _capture_call(chain_matmul, (*args,), {'out': out}) if _captured is not None: return _captured if out is None: return _C.chain_matmul(list(args)) return _C.chain_matmul(list(args), out=out) [docs] def tril_indices(row, col, offset=0, dtype=DType.int64, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(tril_indices, (row, col, offset, dtype, device, pin_memory), {}) if _captured is not None: return _captured return _C.tril_indices(row, col, offset, dtype=dtype, device=_ensure_device(device), pin_memory=pin_memory) [docs] def triu_indices(row, col, offset=0, dtype=DType.int64, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(triu_indices, (row, col, offset, dtype, device, pin_memory), {}) if _captured is not None: return _captured return _C.triu_indices(row, col, offset, dtype=dtype, device=_ensure_device(device), pin_memory=pin_memory) [docs] def combinations(input, r=2, with_replacement=False): if _capturing(): _captured = _capture_call(combinations, (input, r, with_replacement), {}) if _captured is not None: return _captured return _C.combinations(input, r, with_replacement) [docs] def trapz(y, x=None, dx=None, dim=-1): if _capturing(): _captured = _capture_call(trapz, (y, x, dx, dim), {}) if _captured is not None: return _captured if x is not None: return _C.trapz(y, x, dim=dim) if dx is None: dx = 1.0 return _C.trapz(y, dx=dx, dim=dim) [docs] def histc(input, bins=100, min=0, max=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(histc, (input, bins, min, max), {'out': out}) if _captured is not None: return _captured return _C.histc(self=input, bins=bins, min=min, max=max, out=out) if _capturing(): _captured = _capture_call(histc, (input, bins, min, max), {}) if _captured is not None: return _captured return _C.histc(self=input, bins=bins, min=min, max=max) [docs] def isin(elements, test_elements, *, assume_unique=False, invert=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(isin, (elements, test_elements), {'assume_unique': assume_unique, 'invert': invert, 'out': out}) if _captured is not None: return _captured return _C.isin(elements, test_elements, assume_unique=assume_unique, invert=invert, out=out) if _capturing(): _captured = _capture_call(isin, (elements, test_elements), {'assume_unique': assume_unique, 'invert': invert}) if _captured is not None: return _captured return _C.isin(elements, test_elements, assume_unique=assume_unique, invert=invert) [docs] def unique_consecutive(input, return_inverse=False, return_counts=False, dim=None): if _capturing(): _captured = _capture_call(unique_consecutive, (input, return_inverse, return_counts, dim), {}) if _captured is not None: return _captured _result = _C.unique_consecutive(input, return_inverse, return_counts, dim) if not return_inverse and not return_counts: return _result[0] if not return_inverse: return _result[0], _result[2] if not return_counts: return _result[0], _result[1] return _result [docs] def scalar_tensor(s, dtype=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(scalar_tensor, (s, dtype, device, pin_memory), {}) if _captured is not None: return _captured if not isinstance(s, (tensorplay.Scalar, tensorplay.Tensor)): s = tensorplay.Scalar(s) if dtype is None: dtype = DType.undefined return _C.scalar_tensor(s, dtype=dtype, device=_ensure_device(device), pin_memory=pin_memory) [docs] def is_conj(input): if _capturing(): _captured = _capture_call(is_conj, (input,), {}) if _captured is not None: return _captured return _C.is_conj(input) [docs] def is_neg(input): if _capturing(): _captured = _capture_call(is_neg, (input,), {}) if _captured is not None: return _captured return _C.is_neg(input) [docs] def is_nonzero(input): if _capturing(): _captured = _capture_call(is_nonzero, (input,), {}) if _captured is not None: return _captured return _C.is_nonzero(input) [docs] def is_same_size(input, other): if _capturing(): _captured = _capture_call(is_same_size, (input, other), {}) if _captured is not None: return _captured return _C.is_same_size(input, other) [docs] def get_device(input): if _capturing(): _captured = _capture_call(get_device, (input,), {}) if _captured is not None: return _captured return _C.get_device(input) [docs] def can_cast(from_, to): if _capturing(): _captured = _capture_call(can_cast, (from_, to), {}) if _captured is not None: return _captured return _C.can_cast(from_, to) [docs] def promote_types(type1, type2): if _capturing(): _captured = _capture_call(promote_types, (type1, type2), {}) if _captured is not None: return _captured return _C.promote_types(type1, type2) [docs] def result_type(tensor, other): if _capturing(): _captured = _capture_call(result_type, (tensor, other), {}) if _captured is not None: return _captured return _C.result_type(tensor, other) [docs] def put(input, index, source, accumulate=False): if _capturing(): _captured = _capture_call(put, (input, index, source, accumulate), {}) if _captured is not None: return _captured return _C.put(input, index, source, accumulate) [docs] def resolve_conj(input): if _capturing(): _captured = _capture_call(resolve_conj, (input,), {}) if _captured is not None: return _captured return _C.resolve_conj(input) [docs] def resolve_neg(input): if _capturing(): _captured = _capture_call(resolve_neg, (input,), {}) if _captured is not None: return _captured return _C.resolve_neg(input) [docs] def alias_copy(input): if _capturing(): _captured = _capture_call(alias_copy, (input,), {}) if _captured is not None: return _captured return _C.alias_copy(input) [docs] def t_copy(input): if _capturing(): _captured = _capture_call(t_copy, (input,), {}) if _captured is not None: return _captured return _C.t_copy(input) [docs] def permute_copy(input, dims): if _capturing(): _captured = _capture_call(permute_copy, (input, dims), {}) if _captured is not None: return _captured if isinstance(dims, int) and not isinstance(dims, bool): dims = [dims] return _C.permute_copy(input, dims) [docs] def transpose_copy(input, dim0, dim1): if _capturing(): _captured = _capture_call(transpose_copy, (input, dim0, dim1), {}) if _captured is not None: return _captured return _C.transpose_copy(input, dim0, dim1) [docs] def squeeze_copy(input, dim=None): if _capturing(): _captured = _capture_call(squeeze_copy, (input, dim), {}) if _captured is not None: return _captured if dim is None: return _C.squeeze_copy(input) if isinstance(dim, (list, tuple)): return _C.squeeze_copy(input, list(dim)) return _C.squeeze_copy(input, dim) [docs] def unsqueeze_copy(input, dim): if _capturing(): _captured = _capture_call(unsqueeze_copy, (input, dim), {}) if _captured is not None: return _captured return _C.unsqueeze_copy(input, dim) [docs] def select_copy(input, dim, index): if _capturing(): _captured = _capture_call(select_copy, (input, dim, index), {}) if _captured is not None: return _captured return _C.select_copy(input, dim, index) [docs] def slice_copy(input, dim=0, start=None, end=None, step=1): if _capturing(): _captured = _capture_call(slice_copy, (input, dim, start, end, step), {}) if _captured is not None: return _captured return _C.slice_copy(input, dim, start, end, step) [docs] def narrow_copy(input, dim, start, length, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(narrow_copy, (input, dim, start, length), {'out': out}) if _captured is not None: return _captured return _C.narrow_copy(self=input, dim=dim, start=start, length=length, out=out) if _capturing(): _captured = _capture_call(narrow_copy, (input, dim, start, length), {}) if _captured is not None: return _captured return _C.narrow_copy(self=input, dim=dim, start=start, length=length) [docs] def diagonal_copy(input, offset=0, dim1=0, dim2=1): if _capturing(): _captured = _capture_call(diagonal_copy, (input, offset, dim1, dim2), {}) if _captured is not None: return _captured return _C.diagonal_copy(input, offset, dim1, dim2) [docs] def unbind_copy(input, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(unbind_copy, (input, dim), {'out': out}) if _captured is not None: return _captured return _C.unbind_copy(self=input, dim=dim, out=out) if _capturing(): _captured = _capture_call(unbind_copy, (input, dim), {}) if _captured is not None: return _captured return _C.unbind_copy(self=input, dim=dim) [docs] def split_copy(input, split_size, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(split_copy, (input, split_size, dim), {'out': out}) if _captured is not None: return _captured return _C.split_copy(input, split_size, dim, out=out) if _capturing(): _captured = _capture_call(split_copy, (input, split_size, dim), {}) if _captured is not None: return _captured return _C.split_copy(input, split_size, dim) [docs] def view_copy(input, size): if _capturing(): _captured = _capture_call(view_copy, (input, size), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C.view_copy(input, size) [docs] def unfold_copy(input, dimension, size, step): if _capturing(): _captured = _capture_call(unfold_copy, (input, dimension, size, step), {}) if _captured is not None: return _captured return _C.unfold_copy(input, dimension, size, step) [docs] def expand_copy(input, size, implicit=False): if _capturing(): _captured = _capture_call(expand_copy, (input, size, implicit), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C.expand_copy(input, size, implicit=implicit) [docs] def reshape_as(input, other): if _capturing(): _captured = _capture_call(reshape_as, (input, other), {}) if _captured is not None: return _captured return _C.reshape_as(input, other) [docs] def unsafe_chunk(input, chunks, dim=0): if _capturing(): _captured = _capture_call(unsafe_chunk, (input, chunks, dim), {}) if _captured is not None: return _captured return _C.unsafe_chunk(input, chunks, dim) [docs] def unsafe_split(input, split_size, dim=0): if _capturing(): _captured = _capture_call(unsafe_split, (input, split_size, dim), {}) if _captured is not None: return _captured return _C.unsafe_split(input, split_size, dim) [docs] def cosine_similarity(x1, x2, dim=1, eps=1e-8): if _capturing(): _captured = _capture_call(cosine_similarity, (x1, x2, dim, eps), {}) if _captured is not None: return _captured return _C.cosine_similarity(x1, x2, dim, eps) [docs] def dropout(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(dropout, (input, p, train), {}) if _captured is not None: return _captured return _C.dropout(input, p, train) [docs] def dropout_(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(dropout_, (input, p, train), {}) if _captured is not None: return _captured return _C.dropout_(input, p, train) [docs] def alpha_dropout(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(alpha_dropout, (input, p, train), {}) if _captured is not None: return _captured return _C.alpha_dropout(input, p, train) [docs] def alpha_dropout_(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(alpha_dropout_, (input, p, train), {}) if _captured is not None: return _captured return _C.alpha_dropout_(input, p, train) [docs] def feature_dropout(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(feature_dropout, (input, p, train), {}) if _captured is not None: return _captured return _C.feature_dropout(input, p, train) [docs] def feature_dropout_(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(feature_dropout_, (input, p, train), {}) if _captured is not None: return _captured return _C.feature_dropout_(input, p, train) [docs] def feature_alpha_dropout(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(feature_alpha_dropout, (input, p, train), {}) if _captured is not None: return _captured return _C.feature_alpha_dropout(input, p, train) [docs] def feature_alpha_dropout_(input, p=0.5, train=True): if _capturing(): _captured = _capture_call(feature_alpha_dropout_, (input, p, train), {}) if _captured is not None: return _captured return _C.feature_alpha_dropout_(input, p, train) [docs] def rrelu(input, lower=0.125, upper=0.3333333333333333, training=False, generator=None): if _capturing(): _captured = _capture_call(rrelu, (input, lower, upper, training, generator), {}) if _captured is not None: return _captured if not isinstance(lower, (tensorplay.Scalar, tensorplay.Tensor)): lower = tensorplay.Scalar(lower) if not isinstance(upper, (tensorplay.Scalar, tensorplay.Tensor)): upper = tensorplay.Scalar(upper) return _C.rrelu(input, lower, upper, training, generator) [docs] def rrelu_(input, lower=0.125, upper=0.3333333333333333, training=False, generator=None): if _capturing(): _captured = _capture_call(rrelu_, (input, lower, upper, training, generator), {}) if _captured is not None: return _captured if not isinstance(lower, (tensorplay.Scalar, tensorplay.Tensor)): lower = tensorplay.Scalar(lower) if not isinstance(upper, (tensorplay.Scalar, tensorplay.Tensor)): upper = tensorplay.Scalar(upper) return _C.rrelu_(input, lower, upper, training, generator) [docs] def bilinear(input1, input2, weight, bias=None): if _capturing(): _captured = _capture_call(bilinear, (input1, input2, weight, bias), {}) if _captured is not None: return _captured return _C.bilinear(input1, input2, weight, bias) [docs] def conv_tbc(input, weight, bias, pad=0): if _capturing(): _captured = _capture_call(conv_tbc, (input, weight, bias, pad), {}) if _captured is not None: return _captured return _C.conv_tbc(input, weight, bias, pad) [docs] def lstm_cell(input, hx, cx, w_ih, w_hh, b_ih=None, b_hh=None): if _capturing(): _captured = _capture_call(lstm_cell, (input, hx, cx, w_ih, w_hh, b_ih, b_hh), {}) if _captured is not None: return _captured return _C.lstm_cell(input, hx, cx, w_ih, w_hh, b_ih, b_hh) [docs] def rnn_relu_cell(input, hx, w_ih, w_hh, b_ih=None, b_hh=None): if _capturing(): _captured = _capture_call(rnn_relu_cell, (input, hx, w_ih, w_hh, b_ih, b_hh), {}) if _captured is not None: return _captured return _C.rnn_relu_cell(input, hx, w_ih, w_hh, b_ih, b_hh) [docs] def rnn_tanh_cell(input, hx, w_ih, w_hh, b_ih=None, b_hh=None): if _capturing(): _captured = _capture_call(rnn_tanh_cell, (input, hx, w_ih, w_hh, b_ih, b_hh), {}) if _captured is not None: return _captured return _C.rnn_tanh_cell(input, hx, w_ih, w_hh, b_ih, b_hh) [docs] def native_channel_shuffle(input, groups): if _capturing(): _captured = _capture_call(native_channel_shuffle, (input, groups), {}) if _captured is not None: return _captured return _C.native_channel_shuffle(input, groups) [docs] def kaiser_window(window_length, periodic=True, beta=12.0, *, dtype=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(kaiser_window, (window_length, periodic, beta), {'dtype': dtype, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured if dtype is None: dtype = DType.undefined return _C.kaiser_window(window_length, periodic, beta, dtype=dtype, device=_ensure_device(device), pin_memory=pin_memory) [docs] def fliplr(input): if _capturing(): _captured = _capture_call(fliplr, (input,), {}) if _captured is not None: return _captured return _C.fliplr(input) [docs] def flipud(input): if _capturing(): _captured = _capture_call(flipud, (input,), {}) if _captured is not None: return _captured return _C.flipud(input) [docs] def split_with_sizes_copy(input, split_sizes, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(split_with_sizes_copy, (input, split_sizes, dim), {'out': out}) if _captured is not None: return _captured return _C.split_with_sizes_copy(self=input, split_sizes=split_sizes, dim=dim, out=out) if _capturing(): _captured = _capture_call(split_with_sizes_copy, (input, split_sizes, dim), {}) if _captured is not None: return _captured return _C.split_with_sizes_copy(self=input, split_sizes=split_sizes, dim=dim) [docs] def unsafe_split_with_sizes(input, split_sizes, dim=0): if _capturing(): _captured = _capture_call(unsafe_split_with_sizes, (input, split_sizes, dim), {}) if _captured is not None: return _captured if isinstance(split_sizes, int) and not isinstance(split_sizes, bool): split_sizes = [split_sizes] return _C.unsafe_split_with_sizes(input, split_sizes, dim) [docs] def detach_copy(input): if _capturing(): _captured = _capture_call(detach_copy, (input,), {}) if _captured is not None: return _captured return _C.detach_copy(input) [docs] def detach_(input): if _capturing(): _captured = _capture_call(detach_, (input,), {}) if _captured is not None: return _captured return _C.detach_(input) [docs] def resize_as_(input, other, memory_format=None): if _capturing(): _captured = _capture_call(resize_as_, (input, other, memory_format), {}) if _captured is not None: return _captured return _C.resize_as_(input, other, memory_format=memory_format) [docs] def gru_cell(input, hx, w_ih, w_hh, b_ih=None, b_hh=None): if _capturing(): _captured = _capture_call(gru_cell, (input, hx, w_ih, w_hh, b_ih, b_hh), {}) if _captured is not None: return _captured return _C.gru_cell(input, hx, w_ih, w_hh, b_ih, b_hh) [docs] def cdist(x1, x2, p=2, compute_mode=None): if _capturing(): _captured = _capture_call(cdist, (x1, x2, p, compute_mode), {}) if _captured is not None: return _captured return _C.cdist(x1, x2, p, compute_mode=compute_mode) [docs] def xlogy(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(xlogy, (input, other), {'out': out}) if _captured is not None: return _captured return _C.xlogy(input, other, out=out) if _capturing(): _captured = _capture_call(xlogy, (input, other), {}) if _captured is not None: return _captured return _C.xlogy(input, other) [docs] def xlogy_(input, other): if _capturing(): _captured = _capture_call(xlogy_, (input, other), {}) if _captured is not None: return _captured return _C.xlogy_(input, other) [docs] def xlog1py(input, other): if _capturing(): _captured = _capture_call(xlog1py, (input, other), {}) if _captured is not None: return _captured return _C.xlog1py(input, other) [docs] def xlog1py_(input, other): if _capturing(): _captured = _capture_call(xlog1py_, (input, other), {}) if _captured is not None: return _captured return _C.xlog1py_(input, other) [docs] def ldexp(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(ldexp, (input, other), {'out': out}) if _captured is not None: return _captured return _C.ldexp(input, other, out=out) if _capturing(): _captured = _capture_call(ldexp, (input, other), {}) if _captured is not None: return _captured return _C.ldexp(input, other) [docs] def ldexp_(input, other): if _capturing(): _captured = _capture_call(ldexp_, (input, other), {}) if _captured is not None: return _captured return _C.ldexp_(input, other) [docs] def fmax(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fmax, (input, other), {'out': out}) if _captured is not None: return _captured return _C.fmax(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(fmax, (input, other), {}) if _captured is not None: return _captured return _C.fmax(self=input, other=other) [docs] def fmin(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fmin, (input, other), {'out': out}) if _captured is not None: return _captured return _C.fmin(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(fmin, (input, other), {}) if _captured is not None: return _captured return _C.fmin(self=input, other=other) [docs] def float_power(input, exponent, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(float_power, (input, exponent), {'out': out}) if _captured is not None: return _captured return _C.float_power(input, exponent, out=out) if _capturing(): _captured = _capture_call(float_power, (input, exponent), {}) if _captured is not None: return _captured return _C.float_power(input, exponent) [docs] def mvlgamma(input, p, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(mvlgamma, (input, p), {'out': out}) if _captured is not None: return _captured return _C.mvlgamma(self=input, p=p, out=out) if _capturing(): _captured = _capture_call(mvlgamma, (input, p), {}) if _captured is not None: return _captured return _C.mvlgamma(self=input, p=p) [docs] def conj_physical(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(conj_physical, (input,), {'out': out}) if _captured is not None: return _captured return _C.conj_physical(self=input, out=out) if _capturing(): _captured = _capture_call(conj_physical, (input,), {}) if _captured is not None: return _captured return _C.conj_physical(self=input) [docs] def conj_physical_(input): if _capturing(): _captured = _capture_call(conj_physical_, (input,), {}) if _captured is not None: return _captured return _C.conj_physical_(input) [docs] def negative_(input): if _capturing(): _captured = _capture_call(negative_, (input,), {}) if _captured is not None: return _captured return _C.negative_(input) [docs] def range(start, end, step=1, *, dtype=None, device=None, out=None): if out is not None: if _capturing(): _captured = _capture_call(range, (start, end, step), {'dtype': dtype, 'device': device, 'out': out}) if _captured is not None: return _captured return _C.range(start, end, step, dtype=dtype, device=device, out=out) if _capturing(): _captured = _capture_call(range, (start, end, step), {'dtype': dtype, 'device': device}) if _captured is not None: return _captured return _C.range(start, end, step, dtype=dtype, device=device) [docs] def is_signed(input): if _capturing(): _captured = _capture_call(is_signed, (input,), {}) if _captured is not None: return _captured return _C.is_signed(input) [docs] def nonzero_static(input, *, size, fill_value=-1, out=None): if out is not None: if _capturing(): _captured = _capture_call(nonzero_static, (input,), {'size': size, 'fill_value': fill_value, 'out': out}) if _captured is not None: return _captured return _C.nonzero_static(self=input, size=size, fill_value=fill_value, out=out) if _capturing(): _captured = _capture_call(nonzero_static, (input,), {'size': size, 'fill_value': fill_value}) if _captured is not None: return _captured return _C.nonzero_static(self=input, size=size, fill_value=fill_value) [docs] def frexp(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(frexp, (input,), {'out': out}) if _captured is not None: return _captured return _C.frexp(input, out=out) if _capturing(): _captured = _capture_call(frexp, (input,), {}) if _captured is not None: return _captured return _C.frexp(input) [docs] def igamma(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(igamma, (input, other), {'out': out}) if _captured is not None: return _captured return _C.igamma(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(igamma, (input, other), {}) if _captured is not None: return _captured return _C.igamma(self=input, other=other) [docs] def igammac(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(igammac, (input, other), {'out': out}) if _captured is not None: return _captured return _C.igammac(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(igammac, (input, other), {}) if _captured is not None: return _captured return _C.igammac(self=input, other=other) [docs] def empty_strided(size, stride, dtype=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(empty_strided, (size, stride, dtype, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if dtype is None: dtype = DType.undefined return _C.empty_strided(size, stride, dtype=dtype, device=_ensure_device(device), pin_memory=pin_memory) def _cast_Byte(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Byte, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Byte(input, non_blocking) def _cast_Char(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Char, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Char(input, non_blocking) def _cast_Double(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Double, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Double(input, non_blocking) def _cast_Float(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Float, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Float(input, non_blocking) def _cast_Int(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Int, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Int(input, non_blocking) def _cast_Long(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Long, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Long(input, non_blocking) def _cast_Short(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Short, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Short(input, non_blocking) def _cast_Half(input, non_blocking=False): if _capturing(): _captured = _capture_call(_cast_Half, (input, non_blocking), {}) if _captured is not None: return _captured return _C._cast_Half(input, non_blocking) def _backward(input, inputs, gradient=None, retain_graph=None, create_graph=False): if _capturing(): _captured = _capture_call(_backward, (input, inputs, gradient, retain_graph, create_graph), {}) if _captured is not None: return _captured return input._backward(inputs=inputs, gradient=gradient, retain_graph=retain_graph, create_graph=create_graph) [docs] def set_data(input, new_data): if _capturing(): _captured = _capture_call(set_data, (input, new_data), {}) if _captured is not None: return _captured return input.set_data(new_data=new_data) def shallow_copy_data(input, new_data): if _capturing(): _captured = _capture_call(shallow_copy_data, (input, new_data), {}) if _captured is not None: return _captured return input.shallow_copy_data(new_data=new_data) [docs] def data(input): if _capturing(): _captured = _capture_call(data, (input,), {}) if _captured is not None: return _captured return input.data() [docs] def is_leaf(input): if _capturing(): _captured = _capture_call(is_leaf, (input,), {}) if _captured is not None: return _captured return input.is_leaf() [docs] def output_nr(input): if _capturing(): _captured = _capture_call(output_nr, (input,), {}) if _captured is not None: return _captured return input.output_nr() def _version(input): if _capturing(): _captured = _capture_call(_version, (input,), {}) if _captured is not None: return _captured return input._version() [docs] def requires_grad_(input, requires_grad=True): return input.requires_grad_(requires_grad=requires_grad) [docs] def retain_grad(input): if _capturing(): _captured = _capture_call(retain_grad, (input,), {}) if _captured is not None: return _captured return input.retain_grad() [docs] def retains_grad(input): if _capturing(): _captured = _capture_call(retains_grad, (input,), {}) if _captured is not None: return _captured return input.retains_grad() def _fw_primal(input, level): if _capturing(): _captured = _capture_call(_fw_primal, (input, level), {}) if _captured is not None: return _captured return input._fw_primal(level=level) def _make_dual(primal, tangent, level): if _capturing(): _captured = _capture_call(_make_dual, (primal, tangent, level), {}) if _captured is not None: return _captured return _C._make_dual(primal, tangent, level) def _unpack_dual(dual, level): if _capturing(): _captured = _capture_call(_unpack_dual, (dual, level), {}) if _captured is not None: return _captured return _C._unpack_dual(dual, level) def _new_zeros_with_same_feature_meta(input, other, self_num_batch_dims=0): if _capturing(): _captured = _capture_call(_new_zeros_with_same_feature_meta, (input, other, self_num_batch_dims), {}) if _captured is not None: return _captured return _C._new_zeros_with_same_feature_meta(input, other, self_num_batch_dims=self_num_batch_dims) def _has_same_storage_numel(input, other): if _capturing(): _captured = _capture_call(_has_same_storage_numel, (input, other), {}) if _captured is not None: return _captured return _C._has_same_storage_numel(input, other) def _assert_async(input): if _capturing(): _captured = _capture_call(_assert_async, (input,), {}) if _captured is not None: return _captured return _C._assert_async(input) def _assert_scalar(input, assert_msg): if _capturing(): _captured = _capture_call(_assert_scalar, (input, assert_msg), {}) if _captured is not None: return _captured if not isinstance(input, (tensorplay.Scalar, tensorplay.Tensor)): input = tensorplay.Scalar(input) return _C._assert_scalar(input, assert_msg) def _functional_assert_scalar(input, assert_msg, dep_token): if _capturing(): _captured = _capture_call(_functional_assert_scalar, (input, assert_msg, dep_token), {}) if _captured is not None: return _captured if not isinstance(input, (tensorplay.Scalar, tensorplay.Tensor)): input = tensorplay.Scalar(input) return _C._functional_assert_scalar(input, assert_msg, dep_token) def _functional_assert_async(input, assert_msg, dep_token): if _capturing(): _captured = _capture_call(_functional_assert_async, (input, assert_msg, dep_token), {}) if _captured is not None: return _captured return _C._functional_assert_async(input, assert_msg, dep_token) def _assert_tensor_metadata(a, size=None, stride=None, dtype=None, device=None, layout=None): if _capturing(): _captured = _capture_call(_assert_tensor_metadata, (a, size, stride, dtype, device, layout), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C._assert_tensor_metadata(a, size, stride, dtype, device=_ensure_device(device), layout=layout) def _print(s): if _capturing(): _captured = _capture_call(_print, (s,), {}) if _captured is not None: return _captured return _C._print(s) [docs] def sym_constrain_range(size, min=None, max=None): if _capturing(): _captured = _capture_call(sym_constrain_range, (size, min, max), {}) if _captured is not None: return _captured if not isinstance(size, (tensorplay.Scalar, tensorplay.Tensor)): size = tensorplay.Scalar(size) return _C.sym_constrain_range(size, min=min, max=max) [docs] def sym_constrain_range_for_size(size, min=None, max=None): if _capturing(): _captured = _capture_call(sym_constrain_range_for_size, (size, min, max), {}) if _captured is not None: return _captured if not isinstance(size, (tensorplay.Scalar, tensorplay.Tensor)): size = tensorplay.Scalar(size) return _C.sym_constrain_range_for_size(size, min=min, max=max) def _functional_sym_constrain_range(size, min, max, dep_token): if _capturing(): _captured = _capture_call(_functional_sym_constrain_range, (size, min, max, dep_token), {}) if _captured is not None: return _captured if not isinstance(size, (tensorplay.Scalar, tensorplay.Tensor)): size = tensorplay.Scalar(size) return _C._functional_sym_constrain_range(size, min, max, dep_token) def _functional_sym_constrain_range_for_size(size, min, max, dep_token): if _capturing(): _captured = _capture_call(_functional_sym_constrain_range_for_size, (size, min, max, dep_token), {}) if _captured is not None: return _captured if not isinstance(size, (tensorplay.Scalar, tensorplay.Tensor)): size = tensorplay.Scalar(size) return _C._functional_sym_constrain_range_for_size(size, min, max, dep_token) def _make_dep_token(dtype=None, layout=None, device=None, pin_memory=None, memory_format=None): if _capturing(): _captured = _capture_call(_make_dep_token, (dtype, layout, device, pin_memory, memory_format), {}) if _captured is not None: return _captured if dtype is None: dtype = DType.undefined return _C._make_dep_token(dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, memory_format=memory_format) def _use_cudnn_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank): if _capturing(): _captured = _capture_call(_use_cudnn_ctc_loss, (log_probs, targets, input_lengths, target_lengths, blank), {}) if _captured is not None: return _captured if isinstance(input_lengths, int) and not isinstance(input_lengths, bool): input_lengths = [input_lengths] if isinstance(target_lengths, int) and not isinstance(target_lengths, bool): target_lengths = [target_lengths] return _C._use_cudnn_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank) def _cudnn_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, deterministic, zero_infinity): if _capturing(): _captured = _capture_call(_cudnn_ctc_loss, (log_probs, targets, input_lengths, target_lengths, blank, deterministic, zero_infinity), {}) if _captured is not None: return _captured if isinstance(input_lengths, int) and not isinstance(input_lengths, bool): input_lengths = [input_lengths] if isinstance(target_lengths, int) and not isinstance(target_lengths, bool): target_lengths = [target_lengths] return _C._cudnn_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, deterministic, zero_infinity) def _use_cudnn_rnn_flatten_weight(): if _capturing(): _captured = _capture_call(_use_cudnn_rnn_flatten_weight, (), {}) if _captured is not None: return _captured return _C._use_cudnn_rnn_flatten_weight() def _cudnn_rnn_flatten_weight(weight_arr, weight_stride0, input_size, mode, hidden_size, proj_size, num_layers, batch_first, bidirectional): if _capturing(): _captured = _capture_call(_cudnn_rnn_flatten_weight, (weight_arr, weight_stride0, input_size, mode, hidden_size, proj_size, num_layers, batch_first, bidirectional), {}) if _captured is not None: return _captured return _C._cudnn_rnn_flatten_weight(weight_arr, weight_stride0, input_size, mode, hidden_size, proj_size, num_layers, batch_first, bidirectional) def _cudnn_rnn(input, weight, weight_stride0, weight_buf, hx, cx, mode, hidden_size, proj_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state): if _capturing(): _captured = _capture_call(_cudnn_rnn, (input, weight, weight_stride0, weight_buf, hx, cx, mode, hidden_size, proj_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state), {}) if _captured is not None: return _captured if isinstance(batch_sizes, int) and not isinstance(batch_sizes, bool): batch_sizes = [batch_sizes] return _C._cudnn_rnn(input, weight, weight_stride0, weight_buf, hx, cx, mode, hidden_size, proj_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state) def _cudnn_rnn_backward(input, weight, weight_stride0, weight_buf, hx, cx, output, grad_output, grad_hy, grad_cy, mode, hidden_size, proj_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state, reserve, output_mask): if _capturing(): _captured = _capture_call(_cudnn_rnn_backward, (input, weight, weight_stride0, weight_buf, hx, cx, output, grad_output, grad_hy, grad_cy, mode, hidden_size, proj_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state, reserve, output_mask), {}) if _captured is not None: return _captured if isinstance(batch_sizes, int) and not isinstance(batch_sizes, bool): batch_sizes = [batch_sizes] return _C._cudnn_rnn_backward(input, weight, weight_stride0, weight_buf, hx, cx, output, grad_output, grad_hy, grad_cy, mode, hidden_size, proj_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state, reserve, output_mask) def _cudnn_init_dropout_state(dropout, train, dropout_seed, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(_cudnn_init_dropout_state, (dropout, train, dropout_seed, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if dtype is None: dtype = DType.undefined return _C._cudnn_init_dropout_state(dropout, train, dropout_seed, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _debug_has_internal_overlap(input): if _capturing(): _captured = _capture_call(_debug_has_internal_overlap, (input,), {}) if _captured is not None: return _captured return _C._debug_has_internal_overlap(input) def _fused_dropout(input, p, generator=None): if _capturing(): _captured = _capture_call(_fused_dropout, (input, p, generator), {}) if _captured is not None: return _captured return _C._fused_dropout(input, p, generator) def _masked_scale(input, mask, scale): if _capturing(): _captured = _capture_call(_masked_scale, (input, mask, scale), {}) if _captured is not None: return _captured return _C._masked_scale(input, mask, scale) def _sobol_engine_draw(quasi, n, sobolstate, dimension, num_generated, dtype): if _capturing(): _captured = _capture_call(_sobol_engine_draw, (quasi, n, sobolstate, dimension, num_generated, dtype), {}) if _captured is not None: return _captured return _C._sobol_engine_draw(quasi, n, sobolstate, dimension, num_generated, dtype) def _sobol_engine_ff_(input, n, sobolstate, dimension, num_generated): if _capturing(): _captured = _capture_call(_sobol_engine_ff_, (input, n, sobolstate, dimension, num_generated), {}) if _captured is not None: return _captured return _C._sobol_engine_ff_(input, n, sobolstate, dimension, num_generated) def _sobol_engine_scramble_(input, ltm, dimension): if _capturing(): _captured = _capture_call(_sobol_engine_scramble_, (input, ltm, dimension), {}) if _captured is not None: return _captured return _C._sobol_engine_scramble_(input, ltm, dimension) def _sobol_engine_initialize_state_(input, dimension): if _capturing(): _captured = _capture_call(_sobol_engine_initialize_state_, (input, dimension), {}) if _captured is not None: return _captured return _C._sobol_engine_initialize_state_(input, dimension) def _reshape_from_tensor(input, shape): if _capturing(): _captured = _capture_call(_reshape_from_tensor, (input, shape), {}) if _captured is not None: return _captured return _C._reshape_from_tensor(input, shape) def _shape_as_tensor(input): if _capturing(): _captured = _capture_call(_shape_as_tensor, (input,), {}) if _captured is not None: return _captured return _C._shape_as_tensor(input) def chalf(input, memory_format=None): if _capturing(): _captured = _capture_call(chalf, (input, memory_format), {}) if _captured is not None: return _captured return input.chalf(memory_format=memory_format) def _conj(input): if _capturing(): _captured = _capture_call(_conj, (input,), {}) if _captured is not None: return _captured return _C._conj(input) def _conj_physical(input): if _capturing(): _captured = _capture_call(_conj_physical, (input,), {}) if _captured is not None: return _captured return _C._conj_physical(input) def _neg_view(input): if _capturing(): _captured = _capture_call(_neg_view, (input,), {}) if _captured is not None: return _captured return _C._neg_view(input) def _add_relu(input, other, *, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(_add_relu, (input, other), {'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C._add_relu(input, other, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(_add_relu, (input, other), {'alpha': alpha}) if _captured is not None: return _captured return _C._add_relu(input, other, alpha=alpha) def _add_relu_(input, other, alpha=1): if _capturing(): _captured = _capture_call(_add_relu_, (input, other, alpha), {}) if _captured is not None: return _captured if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C._add_relu_(input, other, alpha=alpha) [docs] def affine_grid_generator(theta, size, align_corners): if _capturing(): _captured = _capture_call(affine_grid_generator, (theta, size, align_corners), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C.affine_grid_generator(theta, size, align_corners) def affine_grid_generator_backward(grad, size, align_corners): if _capturing(): _captured = _capture_call(affine_grid_generator_backward, (grad, size, align_corners), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C.affine_grid_generator_backward(grad, size, align_corners) def _is_all_true(input): if _capturing(): _captured = _capture_call(_is_all_true, (input,), {}) if _captured is not None: return _captured return _C._is_all_true(input) def _is_any_true(input): if _capturing(): _captured = _capture_call(_is_any_true, (input,), {}) if _captured is not None: return _captured return _C._is_any_true(input) def _test_check_tensor(input): if _capturing(): _captured = _capture_call(_test_check_tensor, (input,), {}) if _captured is not None: return _captured return _C._test_check_tensor(input) def _test_functorch_fallback(input, other): if _capturing(): _captured = _capture_call(_test_functorch_fallback, (input, other), {}) if _captured is not None: return _captured return _C._test_functorch_fallback(input, other) def _dim_arange(like, dim): if _capturing(): _captured = _capture_call(_dim_arange, (like, dim), {}) if _captured is not None: return _captured return _C._dim_arange(like, dim) [docs] def as_strided(input, size, stride, storage_offset=None): if _capturing(): _captured = _capture_call(as_strided, (input, size, stride, storage_offset), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C.as_strided(input, size, stride, storage_offset) [docs] def as_strided_(input, size, stride, storage_offset=None): if _capturing(): _captured = _capture_call(as_strided_, (input, size, stride, storage_offset), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C.as_strided_(input, size, stride, storage_offset) [docs] def baddbmm_(input, batch1, batch2, beta=1, alpha=1): return input.baddbmm_(batch1=batch1, batch2=batch2, beta=beta, alpha=alpha) [docs] def quantized_batch_norm(input, weight, bias, mean, var, eps, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_batch_norm, (input, weight, bias, mean, var, eps, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_batch_norm(input, weight, bias, mean, var, eps, output_scale, output_zero_point) def quantized_layer_norm(input, normalized_shape, weight, bias, eps, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_layer_norm, (input, normalized_shape, weight, bias, eps, output_scale, output_zero_point), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C.quantized_layer_norm(input, normalized_shape, weight, bias, eps, output_scale, output_zero_point) def quantized_group_norm(input, num_groups, weight, bias, eps, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_group_norm, (input, num_groups, weight, bias, eps, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_group_norm(input, num_groups, weight, bias, eps, output_scale, output_zero_point) def quantized_instance_norm(input, weight, bias, eps, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_instance_norm, (input, weight, bias, eps, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_instance_norm(input, weight, bias, eps, output_scale, output_zero_point) def _batch_norm_impl_index(input, weight, bias, running_mean, running_var, training, momentum, eps, cudnn_enabled): if _capturing(): _captured = _capture_call(_batch_norm_impl_index, (input, weight, bias, running_mean, running_var, training, momentum, eps, cudnn_enabled), {}) if _captured is not None: return _captured return _C._batch_norm_impl_index(input, weight, bias, running_mean, running_var, training, momentum, eps, cudnn_enabled) def _batch_norm_impl_index_backward(impl_index, input, grad_output, weight, running_mean, running_var, save_mean, save_var_transform, train, eps, output_mask, reservedSpace): if _capturing(): _captured = _capture_call(_batch_norm_impl_index_backward, (impl_index, input, grad_output, weight, running_mean, running_var, save_mean, save_var_transform, train, eps, output_mask, reservedSpace), {}) if _captured is not None: return _captured return _C._batch_norm_impl_index_backward(impl_index, input, grad_output, weight, running_mean, running_var, save_mean, save_var_transform, train, eps, output_mask, reservedSpace) [docs] def copysign_(input, other): return input.copysign_(other=other) def _lazy_clone(input): if _capturing(): _captured = _capture_call(_lazy_clone, (input,), {}) if _captured is not None: return _captured return _C._lazy_clone(input) def _sparse_broadcast_to(input, size): if _capturing(): _captured = _capture_call(_sparse_broadcast_to, (input, size), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_broadcast_to(input, size) [docs] def cudnn_is_acceptable(input): if _capturing(): _captured = _capture_call(cudnn_is_acceptable, (input,), {}) if _captured is not None: return _captured return _C.cudnn_is_acceptable(input) def _convolution(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups, benchmark, deterministic, cudnn_enabled, allow_tf32): if _capturing(): _captured = _capture_call(_convolution, (input, weight, bias, stride, padding, dilation, transposed, output_padding, groups, benchmark, deterministic, cudnn_enabled, allow_tf32), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] return _C._convolution(input, weight, bias, stride, padding, dilation, transposed, output_padding, groups, benchmark, deterministic, cudnn_enabled, allow_tf32) def _convolution_mode(input, weight, bias, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(_convolution_mode, (input, weight, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C._convolution_mode(input, weight, bias, stride, padding, dilation, groups) def _convolution_double_backward(ggI, ggW, ggb, gO, weight, input, stride, padding, dilation, transposed, output_padding, groups, output_mask): if _capturing(): _captured = _capture_call(_convolution_double_backward, (ggI, ggW, ggb, gO, weight, input, stride, padding, dilation, transposed, output_padding, groups, output_mask), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] return _C._convolution_double_backward(ggI, ggW, ggb, gO, weight, input, stride, padding, dilation, transposed, output_padding, groups, output_mask) def conv_tbc_backward(input, input1, weight, bias, pad): if _capturing(): _captured = _capture_call(conv_tbc_backward, (input, input1, weight, bias, pad), {}) if _captured is not None: return _captured return _C.conv_tbc_backward(input, input1, weight, bias, pad) [docs] def copy(input, src, non_blocking=False): if _capturing(): _captured = _capture_call(copy, (input, src, non_blocking), {}) if _captured is not None: return _captured return _C.copy(input, src, non_blocking) def _copy_from(input, dst, non_blocking=False): if _capturing(): _captured = _capture_call(_copy_from, (input, dst, non_blocking), {}) if _captured is not None: return _captured return _C._copy_from(input, dst, non_blocking) def _copy_from_and_resize(input, dst): if _capturing(): _captured = _capture_call(_copy_from_and_resize, (input, dst), {}) if _captured is not None: return _captured return _C._copy_from_and_resize(input, dst) [docs] def cudnn_affine_grid_generator(theta, N, C, H, W): if _capturing(): _captured = _capture_call(cudnn_affine_grid_generator, (theta, N, C, H, W), {}) if _captured is not None: return _captured return _C.cudnn_affine_grid_generator(theta, N, C, H, W) def cudnn_affine_grid_generator_backward(grad, N, C, H, W): if _capturing(): _captured = _capture_call(cudnn_affine_grid_generator_backward, (grad, N, C, H, W), {}) if _captured is not None: return _captured return _C.cudnn_affine_grid_generator_backward(grad, N, C, H, W) [docs] def cudnn_batch_norm(input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cudnn_batch_norm, (input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon), {'out': out}) if _captured is not None: return _captured return _C.cudnn_batch_norm(input=input, weight=weight, bias=bias, running_mean=running_mean, running_var=running_var, training=training, exponential_average_factor=exponential_average_factor, epsilon=epsilon, out=out) if _capturing(): _captured = _capture_call(cudnn_batch_norm, (input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon), {}) if _captured is not None: return _captured return _C.cudnn_batch_norm(input=input, weight=weight, bias=bias, running_mean=running_mean, running_var=running_var, training=training, exponential_average_factor=exponential_average_factor, epsilon=epsilon) def cudnn_batch_norm_backward(input, grad_output, weight, running_mean, running_var, save_mean, save_var, epsilon, reserveSpace): if _capturing(): _captured = _capture_call(cudnn_batch_norm_backward, (input, grad_output, weight, running_mean, running_var, save_mean, save_var, epsilon, reserveSpace), {}) if _captured is not None: return _captured return _C.cudnn_batch_norm_backward(input, grad_output, weight, running_mean, running_var, save_mean, save_var, epsilon, reserveSpace) [docs] def cudnn_convolution(input, weight, padding, stride, dilation, groups, benchmark, deterministic, allow_tf32, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(cudnn_convolution, (input, weight, padding, stride, dilation, groups, benchmark, deterministic, allow_tf32), {'out': out}) if _captured is not None: return _captured return _C.cudnn_convolution(self=input, weight=weight, padding=padding, stride=stride, dilation=dilation, groups=groups, benchmark=benchmark, deterministic=deterministic, allow_tf32=allow_tf32, out=out) if _capturing(): _captured = _capture_call(cudnn_convolution, (input, weight, padding, stride, dilation, groups, benchmark, deterministic, allow_tf32), {}) if _captured is not None: return _captured return _C.cudnn_convolution(self=input, weight=weight, padding=padding, stride=stride, dilation=dilation, groups=groups, benchmark=benchmark, deterministic=deterministic, allow_tf32=allow_tf32) [docs] def cudnn_convolution_transpose(input, weight, padding, output_padding, stride, dilation, groups, benchmark, deterministic, allow_tf32): if _capturing(): _captured = _capture_call(cudnn_convolution_transpose, (input, weight, padding, output_padding, stride, dilation, groups, benchmark, deterministic, allow_tf32), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.cudnn_convolution_transpose(input, weight, padding, output_padding, stride, dilation, groups, benchmark, deterministic, allow_tf32) def _mps_convolution_transpose(input, weight, padding, output_padding, stride, dilation, groups): if _capturing(): _captured = _capture_call(_mps_convolution_transpose, (input, weight, padding, output_padding, stride, dilation, groups), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C._mps_convolution_transpose(input, weight, padding, output_padding, stride, dilation, groups) def mps_convolution_transpose_backward(input, grad_output, weight, padding, output_padding, stride, dilation, groups, output_mask): if _capturing(): _captured = _capture_call(mps_convolution_transpose_backward, (input, grad_output, weight, padding, output_padding, stride, dilation, groups, output_mask), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.mps_convolution_transpose_backward(input, grad_output, weight, padding, output_padding, stride, dilation, groups, output_mask) [docs] def cudnn_convolution_relu(input, weight, bias, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(cudnn_convolution_relu, (input, weight, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.cudnn_convolution_relu(input, weight, bias, stride, padding, dilation, groups) [docs] def cudnn_convolution_add_relu(input, weight, z, alpha, bias, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(cudnn_convolution_add_relu, (input, weight, z, alpha, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if alpha is not None and not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.cudnn_convolution_add_relu(input, weight, z, alpha, bias, stride, padding, dilation, groups) [docs] def cudnn_grid_sampler(input, grid): if _capturing(): _captured = _capture_call(cudnn_grid_sampler, (input, grid), {}) if _captured is not None: return _captured return _C.cudnn_grid_sampler(input, grid) def cudnn_grid_sampler_backward(input, grid, grad_output): if _capturing(): _captured = _capture_call(cudnn_grid_sampler_backward, (input, grid, grad_output), {}) if _captured is not None: return _captured return _C.cudnn_grid_sampler_backward(input, grid, grad_output) def _cummax_helper(input, values, indices, dim): if _capturing(): _captured = _capture_call(_cummax_helper, (input, values, indices, dim), {}) if _captured is not None: return _captured return _C._cummax_helper(input, values, indices, dim) def _cummin_helper(input, values, indices, dim): if _capturing(): _captured = _capture_call(_cummin_helper, (input, values, indices, dim), {}) if _captured is not None: return _captured return _C._cummin_helper(input, values, indices, dim) def cummaxmin_backward(grad, input, indices, dim): if _capturing(): _captured = _capture_call(cummaxmin_backward, (grad, input, indices, dim), {}) if _captured is not None: return _captured return _C.cummaxmin_backward(grad, input, indices, dim) def cumprod_backward(grad, input, dim, output): if _capturing(): _captured = _capture_call(cumprod_backward, (grad, input, dim, output), {}) if _captured is not None: return _captured return _C.cumprod_backward(grad, input, dim, output) [docs] def ctc_loss(log_probs, targets, input_lengths, target_lengths, blank=0, reduction=1, zero_infinity=False): if _capturing(): _captured = _capture_call(ctc_loss, (log_probs, targets, input_lengths, target_lengths, blank, reduction, zero_infinity), {}) if _captured is not None: return _captured if isinstance(input_lengths, int) and not isinstance(input_lengths, bool): input_lengths = [input_lengths] if isinstance(target_lengths, int) and not isinstance(target_lengths, bool): target_lengths = [target_lengths] return _C.ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, reduction, zero_infinity) [docs] def fill_diagonal_(input, fill_value, wrap=False): return input.fill_diagonal_(fill_value=fill_value, wrap=wrap) [docs] def divide_(input, other, rounding_mode=None): if _capturing(): _captured = _capture_call(divide_, (input, other), {'rounding_mode': rounding_mode}) if _captured is not None: return _captured if not isinstance(input, tensorplay.Tensor): input = _as_left_operand(input, other) if rounding_mode is None: return input.divide_(other=other) return input.divide_(other=other, rounding_mode=rounding_mode) [docs] def true_divide_(input, other): return input.true_divide_(other=other) def embedding_backward(grad, indices, num_weights, padding_idx, scale_grad_by_freq, sparse): if _capturing(): _captured = _capture_call(embedding_backward, (grad, indices, num_weights, padding_idx, scale_grad_by_freq, sparse), {}) if _captured is not None: return _captured return _C.embedding_backward(grad, indices, num_weights, padding_idx, scale_grad_by_freq, sparse) [docs] def embedding_renorm_(input, indices, max_norm, norm_type): if _capturing(): _captured = _capture_call(embedding_renorm_, (input, indices, max_norm, norm_type), {}) if _captured is not None: return _captured return _C.embedding_renorm_(input, indices, max_norm, norm_type) def embedding_sparse_backward(grad, indices, num_weights, padding_idx, scale_grad_by_freq): if _capturing(): _captured = _capture_call(embedding_sparse_backward, (grad, indices, num_weights, padding_idx, scale_grad_by_freq), {}) if _captured is not None: return _captured return _C.embedding_sparse_backward(grad, indices, num_weights, padding_idx, scale_grad_by_freq) def _rowwise_prune(weight, mask, compressed_indices_dtype): if _capturing(): _captured = _capture_call(_rowwise_prune, (weight, mask, compressed_indices_dtype), {}) if _captured is not None: return _captured return _C._rowwise_prune(weight, mask, compressed_indices_dtype) [docs] def embedding_bag(input, indices=None, offsets=None, scale_grad_by_freq=False, mode=0, sparse=False, per_sample_weights=None, include_last_offset=False, padding_idx=None): if _capturing(): _captured = _capture_call(embedding_bag, (input, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights, include_last_offset, padding_idx), {}) if _captured is not None: return _captured if padding_idx is None: return _C.embedding_bag(input, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights, include_last_offset) return _C.embedding_bag(input, indices, offsets, scale_grad_by_freq, mode, sparse, per_sample_weights, include_last_offset, padding_idx) def _embedding_bag_backward(grad, indices, offsets, offset2bag, bag_size, maximum_indices, num_weights, scale_grad_by_freq, mode, sparse, per_sample_weights, padding_idx=-1): if _capturing(): _captured = _capture_call(_embedding_bag_backward, (grad, indices, offsets, offset2bag, bag_size, maximum_indices, num_weights, scale_grad_by_freq, mode, sparse, per_sample_weights, padding_idx), {}) if _captured is not None: return _captured return _C._embedding_bag_backward(grad, indices, offsets, offset2bag, bag_size, maximum_indices, num_weights, scale_grad_by_freq, mode, sparse, per_sample_weights, padding_idx) def _embedding_bag_sparse_backward(grad, indices, offsets, offset2bag, bag_size, num_weights, scale_grad_by_freq, mode, per_sample_weights, padding_idx=-1): if _capturing(): _captured = _capture_call(_embedding_bag_sparse_backward, (grad, indices, offsets, offset2bag, bag_size, num_weights, scale_grad_by_freq, mode, per_sample_weights, padding_idx), {}) if _captured is not None: return _captured return _C._embedding_bag_sparse_backward(grad, indices, offsets, offset2bag, bag_size, num_weights, scale_grad_by_freq, mode, per_sample_weights, padding_idx) [docs] def empty_permuted(size, physical_layout, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(empty_permuted, (size, physical_layout, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(physical_layout, int) and not isinstance(physical_layout, bool): physical_layout = [physical_layout] if dtype is None: dtype = DType.undefined return _C.empty_permuted(size, physical_layout, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) [docs] def new_empty(input, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(new_empty, (input, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured return input.new_empty(size=size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory) [docs] def new_empty_strided(input, size, stride, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(new_empty_strided, (input, size, stride, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured return input.new_empty_strided(size=size, stride=stride, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory) [docs] def new_full(input, size, fill_value, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(new_full, (input, size, fill_value, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured return input.new_full(size=size, fill_value=fill_value, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory) [docs] def new_zeros(input, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(new_zeros, (input, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured return input.new_zeros(size=size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory) [docs] def new_ones(input, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(new_ones, (input, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured return input.new_ones(size=size, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory) def _empty_affine_quantized(size, dtype=None, layout=None, device=None, pin_memory=None, scale=1, zero_point=0, memory_format=tensorplay.contiguous_format): if _capturing(): _captured = _capture_call(_empty_affine_quantized, (size, dtype, layout, device, pin_memory, scale, zero_point, memory_format), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if dtype is None: dtype = DType.undefined return _C._empty_affine_quantized(size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, scale=scale, zero_point=zero_point, memory_format=memory_format) def _empty_per_channel_affine_quantized(size, scales, zero_points, axis, dtype=None, layout=None, device=None, pin_memory=None, memory_format=tensorplay.contiguous_format): if _capturing(): _captured = _capture_call(_empty_per_channel_affine_quantized, (size, scales, zero_points, axis, dtype, layout, device, pin_memory, memory_format), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if dtype is None: dtype = DType.undefined return _C._empty_per_channel_affine_quantized(size, scales=scales, zero_points=zero_points, axis=axis, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, memory_format=memory_format) def _resize_output_(input, size, device): if _capturing(): _captured = _capture_call(_resize_output_, (input, size, device), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._resize_output_(input, size, _ensure_device(device)) [docs] def empty_quantized(size, qtensor, dtype=None, layout=None, device=None, pin_memory=None, memory_format=None): if _capturing(): _captured = _capture_call(empty_quantized, (size, qtensor, dtype, layout, device, pin_memory, memory_format), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if dtype is None: dtype = DType.undefined return _C.empty_quantized(size, qtensor, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, memory_format=memory_format) [docs] def floor_divide_(input, other): return input.floor_divide_(other=other) [docs] def from_file(filename, shared=None, size=0, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(from_file, (filename, shared, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if dtype is None: dtype = DType.undefined return _C.from_file(filename, shared, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) [docs] def grid_sampler(input, grid, interpolation_mode, padding_mode, align_corners): if _capturing(): _captured = _capture_call(grid_sampler, (input, grid, interpolation_mode, padding_mode, align_corners), {}) if _captured is not None: return _captured return _C.grid_sampler(input, grid, interpolation_mode, padding_mode, align_corners) def _grid_sampler_2d_cpu_fallback(input, grid, interpolation_mode, padding_mode, align_corners): if _capturing(): _captured = _capture_call(_grid_sampler_2d_cpu_fallback, (input, grid, interpolation_mode, padding_mode, align_corners), {}) if _captured is not None: return _captured return _C._grid_sampler_2d_cpu_fallback(input, grid, interpolation_mode, padding_mode, align_corners) def _grid_sampler_2d_cpu_fallback_backward(grad_output, input, grid, interpolation_mode, padding_mode, align_corners): if _capturing(): _captured = _capture_call(_grid_sampler_2d_cpu_fallback_backward, (grad_output, input, grid, interpolation_mode, padding_mode, align_corners), {}) if _captured is not None: return _captured return _C._grid_sampler_2d_cpu_fallback_backward(grad_output, input, grid, interpolation_mode, padding_mode, align_corners) [docs] def native_group_norm(input, weight, bias, N, C, HxW, group, eps): if _capturing(): _captured = _capture_call(native_group_norm, (input, weight, bias, N, C, HxW, group, eps), {}) if _captured is not None: return _captured return _C.native_group_norm(input, weight, bias, N, C, HxW, group, eps) def native_group_norm_backward(grad_out, input, mean, rstd, weight, N, C, HxW, group, output_mask): if _capturing(): _captured = _capture_call(native_group_norm_backward, (grad_out, input, mean, rstd, weight, N, C, HxW, group, output_mask), {}) if _captured is not None: return _captured return _C.native_group_norm_backward(grad_out, input, mean, rstd, weight, N, C, HxW, group, output_mask) def _fft_r2c(input, dim, normalization, onesided, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_fft_r2c, (input, dim, normalization, onesided), {'out': out}) if _captured is not None: return _captured return _C._fft_r2c(self=input, dim=dim, normalization=normalization, onesided=onesided, out=out) if _capturing(): _captured = _capture_call(_fft_r2c, (input, dim, normalization, onesided), {}) if _captured is not None: return _captured return _C._fft_r2c(self=input, dim=dim, normalization=normalization, onesided=onesided) def _fft_c2r(input, dim, normalization, last_dim_size, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_fft_c2r, (input, dim, normalization, last_dim_size), {'out': out}) if _captured is not None: return _captured return _C._fft_c2r(self=input, dim=dim, normalization=normalization, last_dim_size=last_dim_size, out=out) if _capturing(): _captured = _capture_call(_fft_c2r, (input, dim, normalization, last_dim_size), {}) if _captured is not None: return _captured return _C._fft_c2r(self=input, dim=dim, normalization=normalization, last_dim_size=last_dim_size) def _fft_c2c(input, dim, normalization, forward, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_fft_c2c, (input, dim, normalization, forward), {'out': out}) if _captured is not None: return _captured return _C._fft_c2c(self=input, dim=dim, normalization=normalization, forward=forward, out=out) if _capturing(): _captured = _capture_call(_fft_c2c, (input, dim, normalization, forward), {}) if _captured is not None: return _captured return _C._fft_c2c(self=input, dim=dim, normalization=normalization, forward=forward) def _validate_compressed_sparse_indices(is_crow, compressed_idx, plain_idx, cdim, dim, nnz): if _capturing(): _captured = _capture_call(_validate_compressed_sparse_indices, (is_crow, compressed_idx, plain_idx, cdim, dim, nnz), {}) if _captured is not None: return _captured return _C._validate_compressed_sparse_indices(is_crow, compressed_idx, plain_idx, cdim, dim, nnz) [docs] def index(input, indices, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(index, (input, indices), {'out': out}) if _captured is not None: return _captured return _C.index(self=input, indices=indices, out=out) if _capturing(): _captured = _capture_call(index, (input, indices), {}) if _captured is not None: return _captured return _C.index(self=input, indices=indices) def _unsafe_index(input, indices): if _capturing(): _captured = _capture_call(_unsafe_index, (input, indices), {}) if _captured is not None: return _captured return _C._unsafe_index(input, indices) def _unsafe_masked_index(input, mask, indices, fill): if _capturing(): _captured = _capture_call(_unsafe_masked_index, (input, mask, indices, fill), {}) if _captured is not None: return _captured if not isinstance(fill, (tensorplay.Scalar, tensorplay.Tensor)): fill = tensorplay.Scalar(fill) return _C._unsafe_masked_index(input, mask, indices, fill) def _unsafe_masked_index_put_accumulate(input, mask, indices, values): if _capturing(): _captured = _capture_call(_unsafe_masked_index_put_accumulate, (input, mask, indices, values), {}) if _captured is not None: return _captured return _C._unsafe_masked_index_put_accumulate(input, mask, indices, values) def _unsafe_index_put(input, indices, values, accumulate=False): if _capturing(): _captured = _capture_call(_unsafe_index_put, (input, indices, values, accumulate), {}) if _captured is not None: return _captured return _C._unsafe_index_put(input, indices, values, accumulate) def _index_put_impl_(input, indices, values, accumulate=False, unsafe=False): if _capturing(): _captured = _capture_call(_index_put_impl_, (input, indices, values, accumulate, unsafe), {}) if _captured is not None: return _captured return _C._index_put_impl_(input, indices, values, accumulate, unsafe) [docs] def is_distributed(input): if _capturing(): _captured = _capture_call(is_distributed, (input,), {}) if _captured is not None: return _captured return _C.is_distributed(input) [docs] def is_floating_point(input): if _capturing(): _captured = _capture_call(is_floating_point, (input,), {}) if _captured is not None: return _captured return _C.is_floating_point(input) def _is_zerotensor(input): if _capturing(): _captured = _capture_call(_is_zerotensor, (input,), {}) if _captured is not None: return _captured return _C._is_zerotensor(input) [docs] def is_inference(input): if _capturing(): _captured = _capture_call(is_inference, (input,), {}) if _captured is not None: return _captured return _C.is_inference(input) [docs] def numel(input): if _capturing(): _captured = _capture_call(numel, (input,), {}) if _captured is not None: return _captured return input.numel() [docs] def dim(input): if _capturing(): _captured = _capture_call(dim, (input,), {}) if _captured is not None: return _captured return input.dim() [docs] def storage_offset(input): if _capturing(): _captured = _capture_call(storage_offset, (input,), {}) if _captured is not None: return _captured return input.storage_offset() [docs] def is_contiguous(input): if _capturing(): _captured = _capture_call(is_contiguous, (input,), {}) if _captured is not None: return _captured return input.is_contiguous() [docs] def native_layer_norm(input, normalized_shape, weight, bias, eps): if _capturing(): _captured = _capture_call(native_layer_norm, (input, normalized_shape, weight, bias, eps), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C.native_layer_norm(input, normalized_shape, weight, bias, eps) def native_layer_norm_backward(grad_out, input, normalized_shape, mean, rstd, weight, bias, output_mask): if _capturing(): _captured = _capture_call(native_layer_norm_backward, (grad_out, input, normalized_shape, mean, rstd, weight, bias, output_mask), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C.native_layer_norm_backward(grad_out, input, normalized_shape, mean, rstd, weight, bias, output_mask) def _fused_rms_norm(input, normalized_shape, weight, eps): if _capturing(): _captured = _capture_call(_fused_rms_norm, (input, normalized_shape, weight, eps), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C._fused_rms_norm(input, normalized_shape, weight, eps) def _fused_rms_norm_backward(grad_out, input, normalized_shape, rstd, weight, output_mask): if _capturing(): _captured = _capture_call(_fused_rms_norm_backward, (grad_out, input, normalized_shape, rstd, weight, output_mask), {}) if _captured is not None: return _captured if isinstance(normalized_shape, int) and not isinstance(normalized_shape, bool): normalized_shape = [normalized_shape] return _C._fused_rms_norm_backward(grad_out, input, normalized_shape, rstd, weight, output_mask) def linear_backward(input, grad_output, weight, output_mask): if _capturing(): _captured = _capture_call(linear_backward, (input, grad_output, weight, output_mask), {}) if _captured is not None: return _captured return _C.linear_backward(input, grad_output, weight, output_mask) [docs] def mkldnn_linear(input, weight, bias=None): if _capturing(): _captured = _capture_call(mkldnn_linear, (input, weight, bias), {}) if _captured is not None: return _captured return _C.mkldnn_linear(input, weight, bias) [docs] def mkldnn_linear_backward_input(input_size, grad_output, weight): if _capturing(): _captured = _capture_call(mkldnn_linear_backward_input, (input_size, grad_output, weight), {}) if _captured is not None: return _captured if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] return _C.mkldnn_linear_backward_input(input_size, grad_output, weight) [docs] def mkldnn_linear_backward_weights(grad_output, input, weight, bias_defined): if _capturing(): _captured = _capture_call(mkldnn_linear_backward_weights, (grad_output, input, weight, bias_defined), {}) if _captured is not None: return _captured return _C.mkldnn_linear_backward_weights(grad_output, input, weight, bias_defined) def mkldnn_linear_backward(input, grad_output, weight, output_mask): if _capturing(): _captured = _capture_call(mkldnn_linear_backward, (input, grad_output, weight, output_mask), {}) if _captured is not None: return _captured return _C.mkldnn_linear_backward(input, grad_output, weight, output_mask) def _cslt_compress(input): if _capturing(): _captured = _capture_call(_cslt_compress, (input,), {}) if _captured is not None: return _captured return _C._cslt_compress(input) def _cslt_sparse_mm(compressed_A, dense_B, bias=None, alpha=None, out_dtype=None, transpose_result=False, alg_id=0, split_k=1, split_k_mode=-1): if _capturing(): _captured = _capture_call(_cslt_sparse_mm, (compressed_A, dense_B, bias, alpha, out_dtype, transpose_result, alg_id, split_k, split_k_mode), {}) if _captured is not None: return _captured return _C._cslt_sparse_mm(compressed_A, dense_B, bias, alpha, out_dtype, transpose_result, alg_id, split_k, split_k_mode) def _cslt_sparse_mm_search(compressed_A, dense_B, bias=None, alpha=None, out_dtype=None, transpose_result=False): if _capturing(): _captured = _capture_call(_cslt_sparse_mm_search, (compressed_A, dense_B, bias, alpha, out_dtype, transpose_result), {}) if _captured is not None: return _captured return _C._cslt_sparse_mm_search(compressed_A, dense_B, bias, alpha, out_dtype, transpose_result) def _sparse_semi_structured_tile(input, algorithm='', use_cutlass=True): if _capturing(): _captured = _capture_call(_sparse_semi_structured_tile, (input, algorithm, use_cutlass), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_tile(input, algorithm, use_cutlass) def _sparse_semi_structured_apply(input, thread_masks): if _capturing(): _captured = _capture_call(_sparse_semi_structured_apply, (input, thread_masks), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_apply(input, thread_masks) def _sparse_semi_structured_apply_dense(input, thread_masks): if _capturing(): _captured = _capture_call(_sparse_semi_structured_apply_dense, (input, thread_masks), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_apply_dense(input, thread_masks) def _sparse_semi_structured_linear(input, weight, meta, bias=None, activation=None, out_dtype=None): if _capturing(): _captured = _capture_call(_sparse_semi_structured_linear, (input, weight, meta, bias, activation, out_dtype), {}) if _captured is not None: return _captured return _C._sparse_semi_structured_linear(input, weight, meta, bias=bias, activation=activation, out_dtype=out_dtype) def _mixed_dtypes_linear(input, weight, scale, bias=None, activation=None): if _capturing(): _captured = _capture_call(_mixed_dtypes_linear, (input, weight, scale, bias, activation), {}) if _captured is not None: return _captured return _C._mixed_dtypes_linear(input, weight, scale, bias=bias, activation=activation) [docs] def fbgemm_linear_int8_weight_fp32_activation(input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias): if _capturing(): _captured = _capture_call(fbgemm_linear_int8_weight_fp32_activation, (input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias), {}) if _captured is not None: return _captured if not isinstance(weight_scale, (tensorplay.Scalar, tensorplay.Tensor)): weight_scale = tensorplay.Scalar(weight_scale) if not isinstance(weight_zero_point, (tensorplay.Scalar, tensorplay.Tensor)): weight_zero_point = tensorplay.Scalar(weight_zero_point) return _C.fbgemm_linear_int8_weight_fp32_activation(input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias) [docs] def fbgemm_linear_int8_weight(input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias): if _capturing(): _captured = _capture_call(fbgemm_linear_int8_weight, (input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias), {}) if _captured is not None: return _captured if not isinstance(weight_scale, (tensorplay.Scalar, tensorplay.Tensor)): weight_scale = tensorplay.Scalar(weight_scale) if not isinstance(weight_zero_point, (tensorplay.Scalar, tensorplay.Tensor)): weight_zero_point = tensorplay.Scalar(weight_zero_point) return _C.fbgemm_linear_int8_weight(input, weight, packed, col_offsets, weight_scale, weight_zero_point, bias) [docs] def fbgemm_linear_quantize_weight(input): if _capturing(): _captured = _capture_call(fbgemm_linear_quantize_weight, (input,), {}) if _captured is not None: return _captured return _C.fbgemm_linear_quantize_weight(input) [docs] def fbgemm_pack_gemm_matrix_fp16(input): if _capturing(): _captured = _capture_call(fbgemm_pack_gemm_matrix_fp16, (input,), {}) if _captured is not None: return _captured return _C.fbgemm_pack_gemm_matrix_fp16(input) def _wrapped_linear_prepack(weight, weight_scale, weight_zero_point, bias): if _capturing(): _captured = _capture_call(_wrapped_linear_prepack, (weight, weight_scale, weight_zero_point, bias), {}) if _captured is not None: return _captured return _C._wrapped_linear_prepack(weight, weight_scale, weight_zero_point, bias) def _wrapped_quantized_linear_prepacked(input, input_scale, input_zero_point, packed_weight, output_scale, output_zero_point, out_channel): if _capturing(): _captured = _capture_call(_wrapped_quantized_linear_prepacked, (input, input_scale, input_zero_point, packed_weight, output_scale, output_zero_point, out_channel), {}) if _captured is not None: return _captured return _C._wrapped_quantized_linear_prepacked(input, input_scale, input_zero_point, packed_weight, output_scale, output_zero_point, out_channel) [docs] def fbgemm_linear_fp16_weight_fp32_activation(input, packed_weight, bias, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fbgemm_linear_fp16_weight_fp32_activation, (input, packed_weight, bias), {'out': out}) if _captured is not None: return _captured return _C.fbgemm_linear_fp16_weight_fp32_activation(input=input, packed_weight=packed_weight, bias=bias, out=out) if _capturing(): _captured = _capture_call(fbgemm_linear_fp16_weight_fp32_activation, (input, packed_weight, bias), {}) if _captured is not None: return _captured return _C.fbgemm_linear_fp16_weight_fp32_activation(input=input, packed_weight=packed_weight, bias=bias) [docs] def fbgemm_linear_fp16_weight(input, packed_weight, bias, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fbgemm_linear_fp16_weight, (input, packed_weight, bias), {'out': out}) if _captured is not None: return _captured return _C.fbgemm_linear_fp16_weight(input=input, packed_weight=packed_weight, bias=bias, out=out) if _capturing(): _captured = _capture_call(fbgemm_linear_fp16_weight, (input, packed_weight, bias), {}) if _captured is not None: return _captured return _C.fbgemm_linear_fp16_weight(input=input, packed_weight=packed_weight, bias=bias) [docs] def fbgemm_pack_quantized_matrix(input, K=None, N=None): if _capturing(): _captured = _capture_call(fbgemm_pack_quantized_matrix, (input, K, N), {}) if _captured is not None: return _captured if K is None: return _C.fbgemm_pack_quantized_matrix(input) return _C.fbgemm_pack_quantized_matrix(input, K, N) def _log_softmax(input, dim, half_to_float, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_log_softmax, (input, dim, half_to_float), {'out': out}) if _captured is not None: return _captured return _C._log_softmax(self=input, dim=dim, half_to_float=half_to_float, out=out) if _capturing(): _captured = _capture_call(_log_softmax, (input, dim, half_to_float), {}) if _captured is not None: return _captured return _C._log_softmax(self=input, dim=dim, half_to_float=half_to_float) def _log_softmax_backward_data(grad_output, output, dim, input_dtype, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_log_softmax_backward_data, (grad_output, output, dim, input_dtype), {'out': out}) if _captured is not None: return _captured return _C._log_softmax_backward_data(grad_output=grad_output, output=output, dim=dim, input_dtype=input_dtype, out=out) if _capturing(): _captured = _capture_call(_log_softmax_backward_data, (grad_output, output, dim, input_dtype), {}) if _captured is not None: return _captured return _C._log_softmax_backward_data(grad_output=grad_output, output=output, dim=dim, input_dtype=input_dtype) def _logcumsumexp(input, dim, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_logcumsumexp, (input, dim), {'out': out}) if _captured is not None: return _captured return _C._logcumsumexp(self=input, dim=dim, out=out) if _capturing(): _captured = _capture_call(_logcumsumexp, (input, dim), {}) if _captured is not None: return _captured return _C._logcumsumexp(self=input, dim=dim) def matmul_backward(grad, input, other, mask): if _capturing(): _captured = _capture_call(matmul_backward, (grad, input, other, mask), {}) if _captured is not None: return _captured return _C.matmul_backward(grad, input, other, mask) [docs] def matrix_exp(input): if _capturing(): _captured = _capture_call(matrix_exp, (input,), {}) if _captured is not None: return _captured return _C.matrix_exp(input) def matrix_exp_backward(input, grad): if _capturing(): _captured = _capture_call(matrix_exp_backward, (input, grad), {}) if _captured is not None: return _captured return _C.matrix_exp_backward(input, grad) def _aminmax(input, dim=None, keepdim=False): if _capturing(): _captured = _capture_call(_aminmax, (input, dim, keepdim), {}) if _captured is not None: return _captured if dim is None: return _C._aminmax(input) return _C._aminmax(input, dim, keepdim) def _compute_linear_combination(input, coefficients, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_compute_linear_combination, (input, coefficients), {'out': out}) if _captured is not None: return _captured return _C._compute_linear_combination(input=input, coefficients=coefficients, out=out) if _capturing(): _captured = _capture_call(_compute_linear_combination, (input, coefficients), {}) if _captured is not None: return _captured return _C._compute_linear_combination(input=input, coefficients=coefficients) def value_selecting_reduction_backward(grad, dim, indices, sizes, keepdim): if _capturing(): _captured = _capture_call(value_selecting_reduction_backward, (grad, dim, indices, sizes, keepdim), {}) if _captured is not None: return _captured if isinstance(sizes, int) and not isinstance(sizes, bool): sizes = [sizes] return _C.value_selecting_reduction_backward(grad, dim, indices, sizes, keepdim) [docs] def mkldnn_max_pool2d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(mkldnn_max_pool2d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.mkldnn_max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode) def mkldnn_max_pool2d_backward(grad_output, output, input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(mkldnn_max_pool2d_backward, (grad_output, output, input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.mkldnn_max_pool2d_backward(grad_output, output, input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def mkldnn_max_pool3d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(mkldnn_max_pool3d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.mkldnn_max_pool3d(input, kernel_size, stride, padding, dilation, ceil_mode) def mkldnn_max_pool3d_backward(grad_output, output, input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(mkldnn_max_pool3d_backward, (grad_output, output, input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.mkldnn_max_pool3d_backward(grad_output, output, input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def quantized_max_pool1d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(quantized_max_pool1d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.quantized_max_pool1d(input, kernel_size, stride, padding, dilation, ceil_mode) [docs] def quantized_max_pool3d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False): if _capturing(): _captured = _capture_call(quantized_max_pool3d, (input, kernel_size, stride, padding, dilation, ceil_mode), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.quantized_max_pool3d(input, kernel_size, stride, padding, dilation, ceil_mode) def _mps_convolution(input, weight, bias, padding, stride, dilation, groups): if _capturing(): _captured = _capture_call(_mps_convolution, (input, weight, bias, padding, stride, dilation, groups), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C._mps_convolution(input, weight, bias, padding, stride, dilation, groups) def mps_convolution_backward(input, grad_output, weight, padding, stride, dilation, groups, output_mask): if _capturing(): _captured = _capture_call(mps_convolution_backward, (input, grad_output, weight, padding, stride, dilation, groups, output_mask), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.mps_convolution_backward(input, grad_output, weight, padding, stride, dilation, groups, output_mask) [docs] def mkldnn_convolution(input, weight, bias, padding, stride, dilation, groups): if _capturing(): _captured = _capture_call(mkldnn_convolution, (input, weight, bias, padding, stride, dilation, groups), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.mkldnn_convolution(input, weight, bias, padding, stride, dilation, groups) [docs] def mkldnn_rnn_layer(input, weight0, weight1, weight2, weight3, hx_, cx_, reverse, batch_sizes, mode, hidden_size, num_layers, has_biases, bidirectional, batch_first, train): if _capturing(): _captured = _capture_call(mkldnn_rnn_layer, (input, weight0, weight1, weight2, weight3, hx_, cx_, reverse, batch_sizes, mode, hidden_size, num_layers, has_biases, bidirectional, batch_first, train), {}) if _captured is not None: return _captured if isinstance(batch_sizes, int) and not isinstance(batch_sizes, bool): batch_sizes = [batch_sizes] return _C.mkldnn_rnn_layer(input, weight0, weight1, weight2, weight3, hx_, cx_, reverse, batch_sizes, mode, hidden_size, num_layers, has_biases, bidirectional, batch_first, train) def mkldnn_rnn_layer_backward(input, weight1, weight2, weight3, weight4, hx_, cx_tmp, output, hy_, cy_, grad_output, grad_hy, grad_cy, reverse, mode, hidden_size, num_layers, has_biases, train, bidirectional, batch_sizes, batch_first, workspace): if _capturing(): _captured = _capture_call(mkldnn_rnn_layer_backward, (input, weight1, weight2, weight3, weight4, hx_, cx_tmp, output, hy_, cy_, grad_output, grad_hy, grad_cy, reverse, mode, hidden_size, num_layers, has_biases, train, bidirectional, batch_sizes, batch_first, workspace), {}) if _captured is not None: return _captured if isinstance(batch_sizes, int) and not isinstance(batch_sizes, bool): batch_sizes = [batch_sizes] return _C.mkldnn_rnn_layer_backward(input, weight1, weight2, weight3, weight4, hx_, cx_tmp, output, hy_, cy_, grad_output, grad_hy, grad_cy, reverse, mode, hidden_size, num_layers, has_biases, train, bidirectional, batch_sizes, batch_first, workspace) [docs] def miopen_batch_norm(input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon): if _capturing(): _captured = _capture_call(miopen_batch_norm, (input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon), {}) if _captured is not None: return _captured return _C.miopen_batch_norm(input, weight, bias, running_mean, running_var, training, exponential_average_factor, epsilon) def miopen_batch_norm_backward(input, grad_output, weight, running_mean, running_var, save_mean, save_var, epsilon): if _capturing(): _captured = _capture_call(miopen_batch_norm_backward, (input, grad_output, weight, running_mean, running_var, save_mean, save_var, epsilon), {}) if _captured is not None: return _captured return _C.miopen_batch_norm_backward(input, grad_output, weight, running_mean, running_var, save_mean, save_var, epsilon) [docs] def miopen_convolution(input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic): if _capturing(): _captured = _capture_call(miopen_convolution, (input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.miopen_convolution(input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic) [docs] def miopen_convolution_transpose(input, weight, bias, padding, output_padding, stride, dilation, groups, benchmark, deterministic): if _capturing(): _captured = _capture_call(miopen_convolution_transpose, (input, weight, bias, padding, output_padding, stride, dilation, groups, benchmark, deterministic), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.miopen_convolution_transpose(input, weight, bias, padding, output_padding, stride, dilation, groups, benchmark, deterministic) [docs] def miopen_depthwise_convolution(input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic): if _capturing(): _captured = _capture_call(miopen_depthwise_convolution, (input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.miopen_depthwise_convolution(input, weight, bias, padding, stride, dilation, groups, benchmark, deterministic) [docs] def miopen_convolution_relu(input, weight, bias, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(miopen_convolution_relu, (input, weight, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.miopen_convolution_relu(input, weight, bias, stride, padding, dilation, groups) [docs] def miopen_convolution_add_relu(input, weight, z, alpha, bias, stride, padding, dilation, groups): if _capturing(): _captured = _capture_call(miopen_convolution_add_relu, (input, weight, z, alpha, bias, stride, padding, dilation, groups), {}) if _captured is not None: return _captured if alpha is not None and not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.miopen_convolution_add_relu(input, weight, z, alpha, bias, stride, padding, dilation, groups) [docs] def miopen_rnn(input, weight, weight_stride0, hx, cx, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state): if _capturing(): _captured = _capture_call(miopen_rnn, (input, weight, weight_stride0, hx, cx, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state), {}) if _captured is not None: return _captured if isinstance(batch_sizes, int) and not isinstance(batch_sizes, bool): batch_sizes = [batch_sizes] return _C.miopen_rnn(input, weight, weight_stride0, hx, cx, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state) def miopen_rnn_backward(input, weight, weight_stride0, weight_buf, hx, cx, output, grad_output, grad_hy, grad_cy, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state, reserve, output_mask): if _capturing(): _captured = _capture_call(miopen_rnn_backward, (input, weight, weight_stride0, weight_buf, hx, cx, output, grad_output, grad_hy, grad_cy, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state, reserve, output_mask), {}) if _captured is not None: return _captured if isinstance(batch_sizes, int) and not isinstance(batch_sizes, bool): batch_sizes = [batch_sizes] return _C.miopen_rnn_backward(input, weight, weight_stride0, weight_buf, hx, cx, output, grad_output, grad_hy, grad_cy, mode, hidden_size, num_layers, batch_first, dropout, train, bidirectional, batch_sizes, dropout_state, reserve, output_mask) def _use_miopen_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank): if _capturing(): _captured = _capture_call(_use_miopen_ctc_loss, (log_probs, targets, input_lengths, target_lengths, blank), {}) if _captured is not None: return _captured if isinstance(input_lengths, int) and not isinstance(input_lengths, bool): input_lengths = [input_lengths] if isinstance(target_lengths, int) and not isinstance(target_lengths, bool): target_lengths = [target_lengths] return _C._use_miopen_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank) [docs] def miopen_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, deterministic, zero_infinity): if _capturing(): _captured = _capture_call(miopen_ctc_loss, (log_probs, targets, input_lengths, target_lengths, blank, deterministic, zero_infinity), {}) if _captured is not None: return _captured if isinstance(input_lengths, int) and not isinstance(input_lengths, bool): input_lengths = [input_lengths] if isinstance(target_lengths, int) and not isinstance(target_lengths, bool): target_lengths = [target_lengths] return _C.miopen_ctc_loss(log_probs, targets, input_lengths, target_lengths, blank, deterministic, zero_infinity) def _int_mm(input, mat2, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_int_mm, (input, mat2), {'out': out}) if _captured is not None: return _captured return _C._int_mm(self=input, mat2=mat2, out=out) if _capturing(): _captured = _capture_call(_int_mm, (input, mat2), {}) if _captured is not None: return _captured return _C._int_mm(self=input, mat2=mat2) def _convert_weight_to_int4pack(input, innerKTiles): if _capturing(): _captured = _capture_call(_convert_weight_to_int4pack, (input, innerKTiles), {}) if _captured is not None: return _captured return _C._convert_weight_to_int4pack(input, innerKTiles) def _weight_int4pack_mm(input, mat2, qGroupSize, qScaleAndZeros): if _capturing(): _captured = _capture_call(_weight_int4pack_mm, (input, mat2, qGroupSize, qScaleAndZeros), {}) if _captured is not None: return _captured return _C._weight_int4pack_mm(input, mat2, qGroupSize, qScaleAndZeros) def _weight_int4pack_mm_with_scales_and_zeros(input, mat2, qGroupSize, qScale, qZeros): if _capturing(): _captured = _capture_call(_weight_int4pack_mm_with_scales_and_zeros, (input, mat2, qGroupSize, qScale, qZeros), {}) if _captured is not None: return _captured return _C._weight_int4pack_mm_with_scales_and_zeros(input, mat2, qGroupSize, qScale, qZeros) def _convert_weight_to_int4pack_for_cpu(input, innerKTiles): if _capturing(): _captured = _capture_call(_convert_weight_to_int4pack_for_cpu, (input, innerKTiles), {}) if _captured is not None: return _captured return _C._convert_weight_to_int4pack_for_cpu(input, innerKTiles) def _weight_int4pack_mm_for_cpu(input, mat2, qGroupSize, qScaleAndZeros): if _capturing(): _captured = _capture_call(_weight_int4pack_mm_for_cpu, (input, mat2, qGroupSize, qScaleAndZeros), {}) if _captured is not None: return _captured return _C._weight_int4pack_mm_for_cpu(input, mat2, qGroupSize, qScaleAndZeros) def _dyn_quant_pack_4bit_weight(weights, scales_zeros, bias, block_size, in_features, out_features): if _capturing(): _captured = _capture_call(_dyn_quant_pack_4bit_weight, (weights, scales_zeros, bias, block_size, in_features, out_features), {}) if _captured is not None: return _captured return _C._dyn_quant_pack_4bit_weight(weights, scales_zeros, bias, block_size, in_features, out_features) def _dyn_quant_matmul_4bit(inp, packed_weights, block_size, in_features, out_features): if _capturing(): _captured = _capture_call(_dyn_quant_matmul_4bit, (inp, packed_weights, block_size, in_features, out_features), {}) if _captured is not None: return _captured return _C._dyn_quant_matmul_4bit(inp, packed_weights, block_size, in_features, out_features) def _weight_int8pack_mm(input, mat2, scales): if _capturing(): _captured = _capture_call(_weight_int8pack_mm, (input, mat2, scales), {}) if _captured is not None: return _captured return _C._weight_int8pack_mm(input, mat2, scales) def _sparse_mm(sparse, dense): if _capturing(): _captured = _capture_call(_sparse_mm, (sparse, dense), {}) if _captured is not None: return _captured return _C._sparse_mm(sparse, dense) def _sparse_sparse_matmul(input, other): if _capturing(): _captured = _capture_call(_sparse_sparse_matmul, (input, other), {}) if _captured is not None: return _captured return _C._sparse_sparse_matmul(input, other) [docs] def multiply_(input, other): return input.multiply_(other=other) [docs] def mvlgamma_(input, p): return input.mvlgamma_(p=p) [docs] def native_batch_norm(input, weight, bias, running_mean, running_var, training, momentum, eps, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(native_batch_norm, (input, weight, bias, running_mean, running_var, training, momentum, eps), {'out': out}) if _captured is not None: return _captured return _C.native_batch_norm(input=input, weight=weight, bias=bias, running_mean=running_mean, running_var=running_var, training=training, momentum=momentum, eps=eps, out=out) if _capturing(): _captured = _capture_call(native_batch_norm, (input, weight, bias, running_mean, running_var, training, momentum, eps), {}) if _captured is not None: return _captured return _C.native_batch_norm(input=input, weight=weight, bias=bias, running_mean=running_mean, running_var=running_var, training=training, momentum=momentum, eps=eps) def _native_batch_norm_legit(input, weight, bias, running_mean, running_var, training, momentum, eps, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_native_batch_norm_legit, (input, weight, bias, running_mean, running_var, training, momentum, eps), {'out': out}) if _captured is not None: return _captured return _C._native_batch_norm_legit(input, weight, bias, running_mean, running_var, training, momentum, eps, out=out) if _capturing(): _captured = _capture_call(_native_batch_norm_legit, (input, weight, bias, running_mean, running_var, training, momentum, eps), {}) if _captured is not None: return _captured return _C._native_batch_norm_legit(input, weight, bias, running_mean, running_var, training, momentum, eps) def _native_batch_norm_legit_no_training(input, weight, bias, running_mean, running_var, momentum, eps): if _capturing(): _captured = _capture_call(_native_batch_norm_legit_no_training, (input, weight, bias, running_mean, running_var, momentum, eps), {}) if _captured is not None: return _captured return _C._native_batch_norm_legit_no_training(input, weight, bias, running_mean, running_var, momentum, eps) [docs] def batch_norm_stats(input, eps): if _capturing(): _captured = _capture_call(batch_norm_stats, (input, eps), {}) if _captured is not None: return _captured return _C.batch_norm_stats(input, eps) [docs] def batch_norm_elemt(input, weight, bias, mean, invstd, eps, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(batch_norm_elemt, (input, weight, bias, mean, invstd, eps), {'out': out}) if _captured is not None: return _captured return _C.batch_norm_elemt(input=input, weight=weight, bias=bias, mean=mean, invstd=invstd, eps=eps, out=out) if _capturing(): _captured = _capture_call(batch_norm_elemt, (input, weight, bias, mean, invstd, eps), {}) if _captured is not None: return _captured return _C.batch_norm_elemt(input=input, weight=weight, bias=bias, mean=mean, invstd=invstd, eps=eps) [docs] def batch_norm_gather_stats(input, mean, invstd, running_mean, running_var, momentum, eps, count): if _capturing(): _captured = _capture_call(batch_norm_gather_stats, (input, mean, invstd, running_mean, running_var, momentum, eps, count), {}) if _captured is not None: return _captured return _C.batch_norm_gather_stats(input, mean, invstd, running_mean, running_var, momentum, eps, count) [docs] def batch_norm_gather_stats_with_counts(input, mean, invstd, running_mean, running_var, momentum, eps, counts): if _capturing(): _captured = _capture_call(batch_norm_gather_stats_with_counts, (input, mean, invstd, running_mean, running_var, momentum, eps, counts), {}) if _captured is not None: return _captured return _C.batch_norm_gather_stats_with_counts(input, mean, invstd, running_mean, running_var, momentum, eps, counts) def native_batch_norm_backward(grad_out, input, weight, running_mean, running_var, save_mean, save_invstd, train, eps, output_mask): if _capturing(): _captured = _capture_call(native_batch_norm_backward, (grad_out, input, weight, running_mean, running_var, save_mean, save_invstd, train, eps, output_mask), {}) if _captured is not None: return _captured return _C.native_batch_norm_backward(grad_out, input, weight, running_mean, running_var, save_mean, save_invstd, train, eps, output_mask) [docs] def batch_norm_backward_reduce(grad_out, input, mean, invstd, weight, input_g, weight_g, bias_g): if _capturing(): _captured = _capture_call(batch_norm_backward_reduce, (grad_out, input, mean, invstd, weight, input_g, weight_g, bias_g), {}) if _captured is not None: return _captured return _C.batch_norm_backward_reduce(grad_out, input, mean, invstd, weight, input_g, weight_g, bias_g) [docs] def batch_norm_backward_elemt(grad_out, input, mean, invstd, weight, sum_dy, sum_dy_xmu, count): if _capturing(): _captured = _capture_call(batch_norm_backward_elemt, (grad_out, input, mean, invstd, weight, sum_dy, sum_dy_xmu, count), {}) if _captured is not None: return _captured return _C.batch_norm_backward_elemt(grad_out, input, mean, invstd, weight, sum_dy, sum_dy_xmu, count) [docs] def batch_norm_update_stats(input, running_mean, running_var, momentum): if _capturing(): _captured = _capture_call(batch_norm_update_stats, (input, running_mean, running_var, momentum), {}) if _captured is not None: return _captured return _C.batch_norm_update_stats(input, running_mean, running_var, momentum) [docs] def is_vulkan_available(): if _capturing(): _captured = _capture_call(is_vulkan_available, (), {}) if _captured is not None: return _captured return _C.is_vulkan_available() def _nnpack_available(): if _capturing(): _captured = _capture_call(_nnpack_available, (), {}) if _captured is not None: return _captured return _C._nnpack_available() def _nnpack_spatial_convolution(input, weight, bias, padding, stride=1): if _capturing(): _captured = _capture_call(_nnpack_spatial_convolution, (input, weight, bias, padding, stride), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C._nnpack_spatial_convolution(input, weight, bias, padding, stride) def _euclidean_dist(x1, x2): if _capturing(): _captured = _capture_call(_euclidean_dist, (x1, x2), {}) if _captured is not None: return _captured return _C._euclidean_dist(x1, x2) def _cdist_forward(x1, x2, p, compute_mode): if _capturing(): _captured = _capture_call(_cdist_forward, (x1, x2, p, compute_mode), {}) if _captured is not None: return _captured return _C._cdist_forward(x1, x2, p, compute_mode) def _cdist_backward(grad_output, x1, x2, p, cdist): if _capturing(): _captured = _capture_call(_cdist_backward, (grad_output, x1, x2, p, cdist), {}) if _captured is not None: return _captured return _C._cdist_backward(grad_output, x1, x2, p, cdist) def _pdist_forward(input, p=2): if _capturing(): _captured = _capture_call(_pdist_forward, (input, p), {}) if _captured is not None: return _captured return _C._pdist_forward(input, p) def _pdist_backward(grad_output, input, p, pdist): if _capturing(): _captured = _capture_call(_pdist_backward, (grad_output, input, p, pdist), {}) if _captured is not None: return _captured return _C._pdist_backward(grad_output, input, p, pdist) [docs] def numpy_T(input): if _capturing(): _captured = _capture_call(numpy_T, (input,), {}) if _captured is not None: return _captured return input.numpy_T() [docs] def matrix_H(input): if _capturing(): _captured = _capture_call(matrix_H, (input,), {}) if _captured is not None: return _captured return input.matrix_H() [docs] def mT(input): if _capturing(): _captured = _capture_call(mT, (input,), {}) if _captured is not None: return _captured return input.mT() [docs] def mH(input): if _capturing(): _captured = _capture_call(mH, (input,), {}) if _captured is not None: return _captured return input.mH() [docs] def is_pinned(input, device=None): if _capturing(): _captured = _capture_call(is_pinned, (input, device), {}) if _captured is not None: return _captured return input.is_pinned(device=device) [docs] def pin_memory(input, device=None): if _capturing(): _captured = _capture_call(pin_memory, (input, device), {}) if _captured is not None: return _captured return input.pin_memory(device=device) def _pin_memory(input, device=None): if _capturing(): _captured = _capture_call(_pin_memory, (input, device), {}) if _captured is not None: return _captured return _C._pin_memory(input, _ensure_device(device)) [docs] def pinverse(input, rcond=1e-15): if _capturing(): _captured = _capture_call(pinverse, (input, rcond), {}) if _captured is not None: return _captured return _C.pinverse(input, rcond) [docs] def repeat_interleave(input, repeats=None, dim=None, *, output_size=None): if _capturing(): _captured = _capture_call(repeat_interleave, (input, repeats, dim), {'output_size': output_size}) if _captured is not None: return _captured if repeats is None: return _C.repeat_interleave(input, output_size=output_size) return _C.repeat_interleave(input, repeats, dim, output_size=output_size) def _reshape_copy(input, size): if _capturing(): _captured = _capture_call(_reshape_copy, (input, size), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._reshape_copy(input, size) def _reshape_alias(input, size, stride): if _capturing(): _captured = _capture_call(_reshape_alias, (input, size, stride), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C._reshape_alias(input, size, stride) def _mkldnn_reshape(input, shape): if _capturing(): _captured = _capture_call(_mkldnn_reshape, (input, shape), {}) if _captured is not None: return _captured if isinstance(shape, int) and not isinstance(shape, bool): shape = [shape] return _C._mkldnn_reshape(input, shape) def _prelu_kernel(input, weight): if _capturing(): _captured = _capture_call(_prelu_kernel, (input, weight), {}) if _captured is not None: return _captured return _C._prelu_kernel(input, weight) def _prelu_kernel_backward(grad_output, input, weight): if _capturing(): _captured = _capture_call(_prelu_kernel_backward, (grad_output, input, weight), {}) if _captured is not None: return _captured return _C._prelu_kernel_backward(grad_output, input, weight) def infinitely_differentiable_gelu_backward(grad, input): if _capturing(): _captured = _capture_call(infinitely_differentiable_gelu_backward, (grad, input), {}) if _captured is not None: return _captured return _C.infinitely_differentiable_gelu_backward(grad, input) [docs] def select(input, dim, index): if _capturing(): _captured = _capture_call(select, (input, dim, index), {}) if _captured is not None: return _captured return _C.select(input, dim, index) def _nested_select_backward(grad_output, input, dim, index): if _capturing(): _captured = _capture_call(_nested_select_backward, (grad_output, input, dim, index), {}) if _captured is not None: return _captured return _C._nested_select_backward(grad_output, input, dim, index) [docs] def detach(input): if _capturing(): _captured = _capture_call(detach, (input,), {}) if _captured is not None: return _captured return _C.detach(input) [docs] def size(input): if _capturing(): _captured = _capture_call(size, (input,), {}) if _captured is not None: return _captured return input.size() [docs] def sym_size(input, dim): if _capturing(): _captured = _capture_call(sym_size, (input, dim), {}) if _captured is not None: return _captured return _C.sym_size(input, dim) [docs] def sym_is_contiguous(input, memory_format=tensorplay.contiguous_format): if _capturing(): _captured = _capture_call(sym_is_contiguous, (input, memory_format), {}) if _captured is not None: return _captured return _C.sym_is_contiguous(input, memory_format) [docs] def sym_numel(input): if _capturing(): _captured = _capture_call(sym_numel, (input,), {}) if _captured is not None: return _captured return _C.sym_numel(input) [docs] def sym_storage_offset(input): if _capturing(): _captured = _capture_call(sym_storage_offset, (input,), {}) if _captured is not None: return _captured return _C.sym_storage_offset(input) [docs] def slice(input, dim=0, start=None, end=None, step=1): if _capturing(): _captured = _capture_call(slice, (input, dim, start, end, step), {}) if _captured is not None: return _captured return _C.slice(input, dim, start, end, step) [docs] def slice_inverse(input, src, dim=0, start=None, end=None, step=1): if _capturing(): _captured = _capture_call(slice_inverse, (input, src, dim, start, end, step), {}) if _captured is not None: return _captured return _C.slice_inverse(input, src, dim, start, end, step) [docs] def as_strided_scatter(input, src, size, stride, storage_offset=None): if _capturing(): _captured = _capture_call(as_strided_scatter, (input, src, size, stride, storage_offset), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C.as_strided_scatter(input, src, size, stride, storage_offset) [docs] def smm(input, mat2): if _capturing(): _captured = _capture_call(smm, (input, mat2), {}) if _captured is not None: return _captured return _C.smm(input, mat2) def _softmax(input, dim, half_to_float, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_softmax, (input, dim, half_to_float), {'out': out}) if _captured is not None: return _captured return _C._softmax(self=input, dim=dim, half_to_float=half_to_float, out=out) if _capturing(): _captured = _capture_call(_softmax, (input, dim, half_to_float), {}) if _captured is not None: return _captured return _C._softmax(self=input, dim=dim, half_to_float=half_to_float) def _softmax_backward_data(grad_output, output, dim, input_dtype, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_softmax_backward_data, (grad_output, output, dim, input_dtype), {'out': out}) if _captured is not None: return _captured return _C._softmax_backward_data(grad_output=grad_output, output=output, dim=dim, input_dtype=input_dtype, out=out) if _capturing(): _captured = _capture_call(_softmax_backward_data, (grad_output, output, dim, input_dtype), {}) if _captured is not None: return _captured return _C._softmax_backward_data(grad_output=grad_output, output=output, dim=dim, input_dtype=input_dtype) [docs] def squeeze_(input): return input.squeeze_() [docs] def sspaddmm(input, mat1, mat2, *, beta=1, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(sspaddmm, (input, mat1, mat2), {'beta': beta, 'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C.sspaddmm(self=input, mat1=mat1, mat2=mat2, beta=beta, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(sspaddmm, (input, mat1, mat2), {'beta': beta, 'alpha': alpha}) if _captured is not None: return _captured return _C.sspaddmm(self=input, mat1=mat1, mat2=mat2, beta=beta, alpha=alpha) def _chunk_cat(tensors, dim, num_chunks, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_chunk_cat, (tensors, dim, num_chunks), {'out': out}) if _captured is not None: return _captured return _C._chunk_cat(tensors=tensors, dim=dim, num_chunks=num_chunks, out=out) if _capturing(): _captured = _capture_call(_chunk_cat, (tensors, dim, num_chunks), {}) if _captured is not None: return _captured return _C._chunk_cat(tensors=tensors, dim=dim, num_chunks=num_chunks) def _stack(tensors, dim=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_stack, (tensors, dim), {'out': out}) if _captured is not None: return _captured return _C._stack(tensors=tensors, dim=dim, out=out) if _capturing(): _captured = _capture_call(_stack, (tensors, dim), {}) if _captured is not None: return _captured return _C._stack(tensors=tensors, dim=dim) [docs] def stride(input): if _capturing(): _captured = _capture_call(stride, (input,), {}) if _captured is not None: return _captured return input.stride() [docs] def sym_stride(input, dim): if _capturing(): _captured = _capture_call(sym_stride, (input, dim), {}) if _captured is not None: return _captured return _C.sym_stride(input, dim) def _nested_sum_backward(grad, input, dim, keepdim=False): if _capturing(): _captured = _capture_call(_nested_sum_backward, (grad, input, dim, keepdim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C._nested_sum_backward(grad, input, dim, keepdim) [docs] def hash_tensor(input, dim=[], *, keepdim=False, mode=0, out=None): if out is not None: if _capturing(): _captured = _capture_call(hash_tensor, (input, dim), {'keepdim': keepdim, 'mode': mode, 'out': out}) if _captured is not None: return _captured return _C.hash_tensor(self=input, dim=dim, keepdim=keepdim, mode=mode, out=out) if _capturing(): _captured = _capture_call(hash_tensor, (input, dim), {'keepdim': keepdim, 'mode': mode}) if _captured is not None: return _captured return _C.hash_tensor(self=input, dim=dim, keepdim=keepdim, mode=mode) [docs] def sum_to_size(input, size): if _capturing(): _captured = _capture_call(sum_to_size, (input, size), {}) if _captured is not None: return _captured return input.sum_to_size(size=size) [docs] def t_(input): return input.t_() def tensordot(input, other, dims_self, dims_other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(tensordot, (input, other, dims_self, dims_other), {'out': out}) if _captured is not None: return _captured return _C.tensordot(self=input, other=other, dims_self=dims_self, dims_other=dims_other, out=out) if _capturing(): _captured = _capture_call(tensordot, (input, other, dims_self, dims_other), {}) if _captured is not None: return _captured return _C.tensordot(self=input, other=other, dims_self=dims_self, dims_other=dims_other) def _mkldnn_transpose(input, dim0, dim1): if _capturing(): _captured = _capture_call(_mkldnn_transpose, (input, dim0, dim1), {}) if _captured is not None: return _captured return _C._mkldnn_transpose(input, dim0, dim1) [docs] def transpose_(input, dim0, dim1): return input.transpose_(dim0=dim0, dim1=dim1) def _mkldnn_transpose_(input, dim0, dim1): if _capturing(): _captured = _capture_call(_mkldnn_transpose_, (input, dim0, dim1), {}) if _captured is not None: return _captured return _C._mkldnn_transpose_(input, dim0, dim1) def _transform_bias_rescale_qkv(qkv, qkv_bias, num_heads): if _capturing(): _captured = _capture_call(_transform_bias_rescale_qkv, (qkv, qkv_bias, num_heads), {}) if _captured is not None: return _captured return _C._transform_bias_rescale_qkv(qkv, qkv_bias, num_heads) def _nested_tensor_from_mask(t, mask, mask_check=True): if _capturing(): _captured = _capture_call(_nested_tensor_from_mask, (t, mask, mask_check), {}) if _captured is not None: return _captured return _C._nested_tensor_from_mask(t, mask, mask_check) def _nested_tensor_from_mask_left_aligned(t, mask): if _capturing(): _captured = _capture_call(_nested_tensor_from_mask_left_aligned, (t, mask), {}) if _captured is not None: return _captured return _C._nested_tensor_from_mask_left_aligned(t, mask) def _nested_from_padded(padded, cpu_nested_shape_example, fuse_transform_0213=False): if _capturing(): _captured = _capture_call(_nested_from_padded, (padded, cpu_nested_shape_example, fuse_transform_0213), {}) if _captured is not None: return _captured return _C._nested_from_padded(padded, cpu_nested_shape_example, fuse_transform_0213) def _nested_tensor_size(input): if _capturing(): _captured = _capture_call(_nested_tensor_size, (input,), {}) if _captured is not None: return _captured return input._nested_tensor_size() def _nested_tensor_strides(input): if _capturing(): _captured = _capture_call(_nested_tensor_strides, (input,), {}) if _captured is not None: return _captured return input._nested_tensor_strides() def _nested_tensor_storage_offsets(input): if _capturing(): _captured = _capture_call(_nested_tensor_storage_offsets, (input,), {}) if _captured is not None: return _captured return input._nested_tensor_storage_offsets() def _nested_from_padded_and_nested_example(padded, nt_example): if _capturing(): _captured = _capture_call(_nested_from_padded_and_nested_example, (padded, nt_example), {}) if _captured is not None: return _captured return _C._nested_from_padded_and_nested_example(padded, nt_example) def _nested_view_from_buffer(input, nested_size, nested_strides, offsets): if _capturing(): _captured = _capture_call(_nested_view_from_buffer, (input, nested_size, nested_strides, offsets), {}) if _captured is not None: return _captured return _C._nested_view_from_buffer(input, nested_size, nested_strides, offsets) def _nested_view_from_buffer_copy(input, nested_size, nested_strides, offsets): if _capturing(): _captured = _capture_call(_nested_view_from_buffer_copy, (input, nested_size, nested_strides, offsets), {}) if _captured is not None: return _captured return _C._nested_view_from_buffer_copy(input, nested_size, nested_strides, offsets) def _nested_view_from_jagged(input, offsets, dummy, lengths=None, ragged_idx=1, min_seqlen=None, max_seqlen=None): if _capturing(): _captured = _capture_call(_nested_view_from_jagged, (input, offsets, dummy, lengths, ragged_idx, min_seqlen, max_seqlen), {}) if _captured is not None: return _captured return _C._nested_view_from_jagged(input, offsets, dummy, lengths, ragged_idx, min_seqlen, max_seqlen) def _nested_view_from_jagged_copy(input, offsets, dummy, lengths=None, ragged_idx=1, min_seqlen=None, max_seqlen=None): if _capturing(): _captured = _capture_call(_nested_view_from_jagged_copy, (input, offsets, dummy, lengths, ragged_idx, min_seqlen, max_seqlen), {}) if _captured is not None: return _captured return _C._nested_view_from_jagged_copy(input, offsets, dummy, lengths, ragged_idx, min_seqlen, max_seqlen) def _nested_get_values(input): if _capturing(): _captured = _capture_call(_nested_get_values, (input,), {}) if _captured is not None: return _captured return _C._nested_get_values(input) def _nested_get_values_copy(input): if _capturing(): _captured = _capture_call(_nested_get_values_copy, (input,), {}) if _captured is not None: return _captured return _C._nested_get_values_copy(input) def _nested_get_offsets(input): if _capturing(): _captured = _capture_call(_nested_get_offsets, (input,), {}) if _captured is not None: return _captured return _C._nested_get_offsets(input) def _nested_get_lengths(input): if _capturing(): _captured = _capture_call(_nested_get_lengths, (input,), {}) if _captured is not None: return _captured return _C._nested_get_lengths(input) def _nested_get_ragged_idx(input): if _capturing(): _captured = _capture_call(_nested_get_ragged_idx, (input,), {}) if _captured is not None: return _captured return _C._nested_get_ragged_idx(input) def _nested_get_min_seqlen(input): if _capturing(): _captured = _capture_call(_nested_get_min_seqlen, (input,), {}) if _captured is not None: return _captured return _C._nested_get_min_seqlen(input) def _nested_get_max_seqlen(input): if _capturing(): _captured = _capture_call(_nested_get_max_seqlen, (input,), {}) if _captured is not None: return _captured return _C._nested_get_max_seqlen(input) def _nested_get_jagged_dummy(any): if _capturing(): _captured = _capture_call(_nested_get_jagged_dummy, (any,), {}) if _captured is not None: return _captured return _C._nested_get_jagged_dummy(any) def _nested_compute_contiguous_strides_offsets(nested_size): if _capturing(): _captured = _capture_call(_nested_compute_contiguous_strides_offsets, (nested_size,), {}) if _captured is not None: return _captured return _C._nested_compute_contiguous_strides_offsets(nested_size) def _trilinear(i1, i2, i3, expand1, expand2, expand3, sumdim, unroll_dim=1): if _capturing(): _captured = _capture_call(_trilinear, (i1, i2, i3, expand1, expand2, expand3, sumdim, unroll_dim), {}) if _captured is not None: return _captured if isinstance(expand1, int) and not isinstance(expand1, bool): expand1 = [expand1] if isinstance(expand2, int) and not isinstance(expand2, bool): expand2 = [expand2] if isinstance(expand3, int) and not isinstance(expand3, bool): expand3 = [expand3] if isinstance(sumdim, int) and not isinstance(sumdim, bool): sumdim = [sumdim] return _C._trilinear(i1, i2, i3, expand1, expand2, expand3, sumdim, unroll_dim) [docs] def fix_(input): if _capturing(): _captured = _capture_call(fix_, (input,), {}) if _captured is not None: return _captured return _C.fix_(input) [docs] def type_as(input, other): if _capturing(): _captured = _capture_call(type_as, (input, other), {}) if _captured is not None: return _captured return input.type_as(other=other) def _has_compatible_shallow_copy_type(input, from_): if _capturing(): _captured = _capture_call(_has_compatible_shallow_copy_type, (input, from_), {}) if _captured is not None: return _captured return _C._has_compatible_shallow_copy_type(input, from_) def _unique(input, sorted=True, return_inverse=False): if _capturing(): _captured = _capture_call(_unique, (input, sorted, return_inverse), {}) if _captured is not None: return _captured return _C._unique(input, sorted, return_inverse) [docs] def unique_dim(input, dim, sorted=True, return_inverse=False, return_counts=False): if _capturing(): _captured = _capture_call(unique_dim, (input, dim, sorted, return_inverse, return_counts), {}) if _captured is not None: return _captured return _C.unique_dim(input, dim, sorted, return_inverse, return_counts) [docs] def unique_dim_consecutive(input, dim, return_inverse=False, return_counts=False): if _capturing(): _captured = _capture_call(unique_dim_consecutive, (input, dim, return_inverse, return_counts), {}) if _captured is not None: return _captured return _C.unique_dim_consecutive(input, dim, return_inverse, return_counts) def _unique2(input, sorted=True, return_inverse=False, return_counts=False): if _capturing(): _captured = _capture_call(_unique2, (input, sorted, return_inverse, return_counts), {}) if _captured is not None: return _captured return _C._unique2(input, sorted, return_inverse, return_counts) def _unsafe_view(input, size): if _capturing(): _captured = _capture_call(_unsafe_view, (input, size), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._unsafe_view(input, size) [docs] def unsqueeze_(input, dim): return input.unsqueeze_(dim=dim) [docs] def view_as(input, other): if _capturing(): _captured = _capture_call(view_as, (input, other), {}) if _captured is not None: return _captured return input.view_as(other=other) [docs] def norm_except_dim(v, pow=2, dim=0): if _capturing(): _captured = _capture_call(norm_except_dim, (v, pow, dim), {}) if _captured is not None: return _captured return _C.norm_except_dim(v, pow, dim) def _weight_norm(v, g, dim=0): if _capturing(): _captured = _capture_call(_weight_norm, (v, g, dim), {}) if _captured is not None: return _captured return _C._weight_norm(v, g, dim) def _weight_norm_interface(v, g, dim=0): if _capturing(): _captured = _capture_call(_weight_norm_interface, (v, g, dim), {}) if _captured is not None: return _captured return _C._weight_norm_interface(v, g, dim) def _weight_norm_interface_backward(grad_w, saved_v, saved_g, saved_norms, dim): if _capturing(): _captured = _capture_call(_weight_norm_interface_backward, (grad_w, saved_v, saved_g, saved_norms, dim), {}) if _captured is not None: return _captured return _C._weight_norm_interface_backward(grad_w, saved_v, saved_g, saved_norms, dim) def _weight_norm_differentiable_backward(grad_w, saved_v, saved_g, saved_norms, dim): if _capturing(): _captured = _capture_call(_weight_norm_differentiable_backward, (grad_w, saved_v, saved_g, saved_norms, dim), {}) if _captured is not None: return _captured return _C._weight_norm_differentiable_backward(grad_w, saved_v, saved_g, saved_norms, dim) def _efficientzerotensor(size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(_efficientzerotensor, (size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if dtype is None: dtype = DType.undefined return _C._efficientzerotensor(size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _standard_gamma_grad(input, output): if _capturing(): _captured = _capture_call(_standard_gamma_grad, (input, output), {}) if _captured is not None: return _captured return _C._standard_gamma_grad(input, output) def _standard_gamma(input, generator=None): if _capturing(): _captured = _capture_call(_standard_gamma, (input, generator), {}) if _captured is not None: return _captured return _C._standard_gamma(input, generator) def _philox_key_split(key, num_splits): if _capturing(): _captured = _capture_call(_philox_key_split, (key, num_splits), {}) if _captured is not None: return _captured return _C._philox_key_split(key, num_splits) def _philox_key_fold_in(key, data): if _capturing(): _captured = _capture_call(_philox_key_fold_in, (key, data), {}) if _captured is not None: return _captured return _C._philox_key_fold_in(key, data) def _philox_normal_(input, key, mean=0, std=1): if _capturing(): _captured = _capture_call(_philox_normal_, (input, key, mean, std), {}) if _captured is not None: return _captured return _C._philox_normal_(input, key, mean, std) def _philox_uniform_(input, key, low=0, high=1): if _capturing(): _captured = _capture_call(_philox_uniform_, (input, key, low, high), {}) if _captured is not None: return _captured return _C._philox_uniform_(input, key, low, high) def _dirichlet_grad(x, alpha, total): if _capturing(): _captured = _capture_call(_dirichlet_grad, (x, alpha, total), {}) if _captured is not None: return _captured return _C._dirichlet_grad(x, alpha, total) def _sample_dirichlet(input, generator=None): if _capturing(): _captured = _capture_call(_sample_dirichlet, (input, generator), {}) if _captured is not None: return _captured return _C._sample_dirichlet(input, generator) [docs] def binomial(count, prob, generator=None): if _capturing(): _captured = _capture_call(binomial, (count, prob, generator), {}) if _captured is not None: return _captured return _C.binomial(count, prob, generator) [docs] def native_norm(input, p=2): if _capturing(): _captured = _capture_call(native_norm, (input, p), {}) if _captured is not None: return _captured if not isinstance(p, (tensorplay.Scalar, tensorplay.Tensor)): p = tensorplay.Scalar(p) return _C.native_norm(input, p) def _batch_norm_with_update(input, weight, bias, running_mean, running_var, momentum, eps, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_batch_norm_with_update, (input, weight, bias, running_mean, running_var, momentum, eps), {'out': out}) if _captured is not None: return _captured return _C._batch_norm_with_update(input=input, weight=weight, bias=bias, running_mean=running_mean, running_var=running_var, momentum=momentum, eps=eps, out=out) if _capturing(): _captured = _capture_call(_batch_norm_with_update, (input, weight, bias, running_mean, running_var, momentum, eps), {}) if _captured is not None: return _captured return _C._batch_norm_with_update(input=input, weight=weight, bias=bias, running_mean=running_mean, running_var=running_var, momentum=momentum, eps=eps) def _batch_norm_no_update(input, weight, bias, running_mean, running_var, momentum, eps): if _capturing(): _captured = _capture_call(_batch_norm_no_update, (input, weight, bias, running_mean, running_var, momentum, eps), {}) if _captured is not None: return _captured return _C._batch_norm_no_update(input, weight, bias, running_mean, running_var, momentum, eps) def _sparse_sum(input, dim=None): if _capturing(): _captured = _capture_call(_sparse_sum, (input, dim), {}) if _captured is not None: return _captured if dim is None: return _C._sparse_sum(input) return _C._sparse_sum(input, dim) def _sparse_sum_backward(grad_output, input, dim): if _capturing(): _captured = _capture_call(_sparse_sum_backward, (grad_output, input, dim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C._sparse_sum_backward(grad_output, input, dim) def _sparse_csr_sum(input, dim, keepdim=False, dtype=None): if _capturing(): _captured = _capture_call(_sparse_csr_sum, (input, dim, keepdim, dtype), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C._sparse_csr_sum(input, dim, keepdim, dtype=dtype) def _sparse_csr_prod(input, dim, keepdim=False, dtype=None): if _capturing(): _captured = _capture_call(_sparse_csr_prod, (input, dim, keepdim, dtype), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C._sparse_csr_prod(input, dim, keepdim, dtype=dtype) def _sparse_softmax(input, dim, dtype=None): if _capturing(): _captured = _capture_call(_sparse_softmax, (input, dim, dtype), {}) if _captured is not None: return _captured return _C._sparse_softmax(input, dim, dtype) def _sparse_softmax_backward_data(grad_output, output, dim, input): if _capturing(): _captured = _capture_call(_sparse_softmax_backward_data, (grad_output, output, dim, input), {}) if _captured is not None: return _captured return _C._sparse_softmax_backward_data(grad_output, output, dim, input) def _sparse_log_softmax(input, dim, dtype=None): if _capturing(): _captured = _capture_call(_sparse_log_softmax, (input, dim, dtype), {}) if _captured is not None: return _captured return _C._sparse_log_softmax(input, dim, dtype) def _sparse_log_softmax_backward_data(grad_output, output, dim, input): if _capturing(): _captured = _capture_call(_sparse_log_softmax_backward_data, (grad_output, output, dim, input), {}) if _captured is not None: return _captured return _C._sparse_log_softmax_backward_data(grad_output, output, dim, input) def _spdiags(diagonals, offsets, shape, layout=None): if _capturing(): _captured = _capture_call(_spdiags, (diagonals, offsets, shape, layout), {}) if _captured is not None: return _captured if isinstance(shape, int) and not isinstance(shape, bool): shape = [shape] return _C._spdiags(diagonals, offsets, shape, layout) [docs] def frobenius_norm(input, dim, keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(frobenius_norm, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.frobenius_norm(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(frobenius_norm, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.frobenius_norm(self=input, dim=dim, keepdim=keepdim) [docs] def nuclear_norm(input, keepdim=False, dim=None): if _capturing(): _captured = _capture_call(nuclear_norm, (input, keepdim, dim), {}) if _captured is not None: return _captured if dim is None: return _C.nuclear_norm(input, keepdim) return _C.nuclear_norm(input, dim, keepdim) [docs] def resize_as_sparse_(input, the_template): if _capturing(): _captured = _capture_call(resize_as_sparse_, (input, the_template), {}) if _captured is not None: return _captured return _C.resize_as_sparse_(input, the_template) [docs] def subtract_(input, other, alpha=1): return input.subtract_(other=other, alpha=alpha) def _sparse_addmm(input, mat1, mat2, beta=1, alpha=1): if _capturing(): _captured = _capture_call(_sparse_addmm, (input, mat1, mat2, beta, alpha), {}) if _captured is not None: return _captured if not isinstance(beta, (tensorplay.Scalar, tensorplay.Tensor)): beta = tensorplay.Scalar(beta) if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C._sparse_addmm(input, mat1, mat2, beta=beta, alpha=alpha) [docs] def sparse_sampled_addmm(input, mat1, mat2, *, beta=1, alpha=1, out=None): if out is not None: if _capturing(): _captured = _capture_call(sparse_sampled_addmm, (input, mat1, mat2), {'beta': beta, 'alpha': alpha, 'out': out}) if _captured is not None: return _captured return _C.sparse_sampled_addmm(self=input, mat1=mat1, mat2=mat2, beta=beta, alpha=alpha, out=out) if _capturing(): _captured = _capture_call(sparse_sampled_addmm, (input, mat1, mat2), {'beta': beta, 'alpha': alpha}) if _captured is not None: return _captured return _C.sparse_sampled_addmm(self=input, mat1=mat1, mat2=mat2, beta=beta, alpha=alpha) def _sparse_mm_reduce_impl(input, other, reduce): if _capturing(): _captured = _capture_call(_sparse_mm_reduce_impl, (input, other, reduce), {}) if _captured is not None: return _captured return _C._sparse_mm_reduce_impl(input, other, reduce) def _sparse_mm_reduce_impl_backward(input, grad_out, weight, reduce, arg_out, output_mask): if _capturing(): _captured = _capture_call(_sparse_mm_reduce_impl_backward, (input, grad_out, weight, reduce, arg_out, output_mask), {}) if _captured is not None: return _captured return _C._sparse_mm_reduce_impl_backward(input, grad_out, weight, reduce, arg_out, output_mask) def _addmm_activation(input, mat1, mat2, *, beta=1, alpha=1, use_gelu=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(_addmm_activation, (input, mat1, mat2), {'beta': beta, 'alpha': alpha, 'use_gelu': use_gelu, 'out': out}) if _captured is not None: return _captured return _C._addmm_activation(self=input, mat1=mat1, mat2=mat2, beta=beta, alpha=alpha, use_gelu=use_gelu, out=out) if _capturing(): _captured = _capture_call(_addmm_activation, (input, mat1, mat2), {'beta': beta, 'alpha': alpha, 'use_gelu': use_gelu}) if _captured is not None: return _captured return _C._addmm_activation(self=input, mat1=mat1, mat2=mat2, beta=beta, alpha=alpha, use_gelu=use_gelu) def _scaled_mm(input, mat2, scale_a, scale_b, bias=None, scale_result=None, out_dtype=None, use_fast_accum=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_scaled_mm, (input, mat2, scale_a, scale_b, bias, scale_result, out_dtype, use_fast_accum), {'out': out}) if _captured is not None: return _captured return _C._scaled_mm(self=input, mat2=mat2, scale_a=scale_a, scale_b=scale_b, bias=bias, scale_result=scale_result, out_dtype=out_dtype, use_fast_accum=use_fast_accum, out=out) if _capturing(): _captured = _capture_call(_scaled_mm, (input, mat2, scale_a, scale_b, bias, scale_result, out_dtype, use_fast_accum), {}) if _captured is not None: return _captured return _C._scaled_mm(self=input, mat2=mat2, scale_a=scale_a, scale_b=scale_b, bias=bias, scale_result=scale_result, out_dtype=out_dtype, use_fast_accum=use_fast_accum) def _scaled_mm_v2(input, mat2, scale_a, recipe_a, swizzle_a, scale_b, recipe_b, swizzle_b, bias, out_dtype, contraction_dim=[], use_fast_accum=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_scaled_mm_v2, (input, mat2, scale_a, recipe_a, swizzle_a, scale_b, recipe_b, swizzle_b, bias, out_dtype, contraction_dim, use_fast_accum), {'out': out}) if _captured is not None: return _captured return _C._scaled_mm_v2(self=input, mat2=mat2, scale_a=scale_a, recipe_a=recipe_a, swizzle_a=swizzle_a, scale_b=scale_b, recipe_b=recipe_b, swizzle_b=swizzle_b, bias=bias, out_dtype=out_dtype, contraction_dim=contraction_dim, use_fast_accum=use_fast_accum, out=out) if _capturing(): _captured = _capture_call(_scaled_mm_v2, (input, mat2, scale_a, recipe_a, swizzle_a, scale_b, recipe_b, swizzle_b, bias, out_dtype, contraction_dim, use_fast_accum), {}) if _captured is not None: return _captured return _C._scaled_mm_v2(self=input, mat2=mat2, scale_a=scale_a, recipe_a=recipe_a, swizzle_a=swizzle_a, scale_b=scale_b, recipe_b=recipe_b, swizzle_b=swizzle_b, bias=bias, out_dtype=out_dtype, contraction_dim=contraction_dim, use_fast_accum=use_fast_accum) def _scaled_grouped_mm(input, mat2, scale_a, scale_b, offs=None, bias=None, scale_result=None, out_dtype=None, use_fast_accum=False): if _capturing(): _captured = _capture_call(_scaled_grouped_mm, (input, mat2, scale_a, scale_b, offs, bias, scale_result, out_dtype, use_fast_accum), {}) if _captured is not None: return _captured return _C._scaled_grouped_mm(input, mat2, scale_a, scale_b, offs, bias, scale_result, out_dtype, use_fast_accum) def _scaled_grouped_mm_v2(input, mat2, scale_a, recipe_a, swizzle_a, scale_b, recipe_b, swizzle_b, offs=None, bias=None, out_dtype=None, contraction_dim=[], use_fast_accum=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_scaled_grouped_mm_v2, (input, mat2, scale_a, recipe_a, swizzle_a, scale_b, recipe_b, swizzle_b, offs, bias, out_dtype, contraction_dim, use_fast_accum), {'out': out}) if _captured is not None: return _captured return _C._scaled_grouped_mm_v2(self=input, mat2=mat2, scale_a=scale_a, recipe_a=recipe_a, swizzle_a=swizzle_a, scale_b=scale_b, recipe_b=recipe_b, swizzle_b=swizzle_b, offs=offs, bias=bias, out_dtype=out_dtype, contraction_dim=contraction_dim, use_fast_accum=use_fast_accum, out=out) if _capturing(): _captured = _capture_call(_scaled_grouped_mm_v2, (input, mat2, scale_a, recipe_a, swizzle_a, scale_b, recipe_b, swizzle_b, offs, bias, out_dtype, contraction_dim, use_fast_accum), {}) if _captured is not None: return _captured return _C._scaled_grouped_mm_v2(self=input, mat2=mat2, scale_a=scale_a, recipe_a=recipe_a, swizzle_a=swizzle_a, scale_b=scale_b, recipe_b=recipe_b, swizzle_b=swizzle_b, offs=offs, bias=bias, out_dtype=out_dtype, contraction_dim=contraction_dim, use_fast_accum=use_fast_accum) def _grouped_mm(input, mat2, offs=None, bias=None, out_dtype=None): if _capturing(): _captured = _capture_call(_grouped_mm, (input, mat2, offs, bias, out_dtype), {}) if _captured is not None: return _captured return _C._grouped_mm(input, mat2, offs, bias, out_dtype) def _sparse_compressed_tensor_with_dims(nnz, dense_dim, size, blocksize, index_dtype, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(_sparse_compressed_tensor_with_dims, (nnz, dense_dim, size, blocksize, index_dtype, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(blocksize, int) and not isinstance(blocksize, bool): blocksize = [blocksize] if dtype is None: dtype = DType.undefined return _C._sparse_compressed_tensor_with_dims(nnz, dense_dim, size, blocksize, index_dtype, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) [docs] def sparse_compressed_tensor(compressed_indices, plain_indices, values, size=None, *, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(sparse_compressed_tensor, (compressed_indices, plain_indices, values, size), {'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] _device = _ensure_device(device) if size is None: return _C.sparse_compressed_tensor(compressed_indices, plain_indices, values, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) return _C.sparse_compressed_tensor(compressed_indices, plain_indices, values, size, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) [docs] def sparse_csr_tensor(crow_indices, col_indices, values, size=None, *, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(sparse_csr_tensor, (crow_indices, col_indices, values, size), {'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] _device = _ensure_device(device) if size is None: return _C.sparse_csr_tensor(crow_indices, col_indices, values, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) return _C.sparse_csr_tensor(crow_indices, col_indices, values, size, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) [docs] def sparse_csc_tensor(ccol_indices, row_indices, values, size=None, *, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(sparse_csc_tensor, (ccol_indices, row_indices, values, size), {'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] _device = _ensure_device(device) if size is None: return _C.sparse_csc_tensor(ccol_indices, row_indices, values, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) return _C.sparse_csc_tensor(ccol_indices, row_indices, values, size, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) [docs] def sparse_bsr_tensor(crow_indices, col_indices, values, size=None, *, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(sparse_bsr_tensor, (crow_indices, col_indices, values, size), {'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] _device = _ensure_device(device) if size is None: return _C.sparse_bsr_tensor(crow_indices, col_indices, values, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) return _C.sparse_bsr_tensor(crow_indices, col_indices, values, size, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) [docs] def sparse_bsc_tensor(ccol_indices, row_indices, values, size=None, *, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(sparse_bsc_tensor, (ccol_indices, row_indices, values, size), {'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] _device = _ensure_device(device) if size is None: return _C.sparse_bsc_tensor(ccol_indices, row_indices, values, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) return _C.sparse_bsc_tensor(ccol_indices, row_indices, values, size, dtype=dtype, layout=layout, device=_device, pin_memory=pin_memory) def _sparse_compressed_tensor_unsafe(compressed_indices, plain_indices, values, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(_sparse_compressed_tensor_unsafe, (compressed_indices, plain_indices, values, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_compressed_tensor_unsafe(compressed_indices, plain_indices, values, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _sparse_csr_tensor_unsafe(crow_indices, col_indices, values, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(_sparse_csr_tensor_unsafe, (crow_indices, col_indices, values, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_csr_tensor_unsafe(crow_indices, col_indices, values, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _sparse_csc_tensor_unsafe(ccol_indices, row_indices, values, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(_sparse_csc_tensor_unsafe, (ccol_indices, row_indices, values, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_csc_tensor_unsafe(ccol_indices, row_indices, values, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _sparse_bsr_tensor_unsafe(crow_indices, col_indices, values, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(_sparse_bsr_tensor_unsafe, (crow_indices, col_indices, values, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_bsr_tensor_unsafe(crow_indices, col_indices, values, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _sparse_bsc_tensor_unsafe(ccol_indices, row_indices, values, size, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(_sparse_bsc_tensor_unsafe, (ccol_indices, row_indices, values, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_bsc_tensor_unsafe(ccol_indices, row_indices, values, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _sparse_coo_tensor_unsafe(indices, values, size, dtype=None, layout=None, device=None, pin_memory=None, is_coalesced=None): if _capturing(): _captured = _capture_call(_sparse_coo_tensor_unsafe, (indices, values, size, dtype, layout, device, pin_memory, is_coalesced), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_coo_tensor_unsafe(indices, values, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, is_coalesced=is_coalesced) def _validate_sparse_coo_tensor_args(indices, values, size, is_coalesced=None, check_pinning=None): if _capturing(): _captured = _capture_call(_validate_sparse_coo_tensor_args, (indices, values, size, is_coalesced, check_pinning), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._validate_sparse_coo_tensor_args(indices, values, size, is_coalesced, check_pinning) def _validate_sparse_compressed_tensor_args(compressed_indices, plain_indices, values, size, layout, check_pinning=None): if _capturing(): _captured = _capture_call(_validate_sparse_compressed_tensor_args, (compressed_indices, plain_indices, values, size, layout, check_pinning), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._validate_sparse_compressed_tensor_args(compressed_indices, plain_indices, values, size, layout, check_pinning) def _validate_sparse_csr_tensor_args(crow_indices, col_indices, values, size, check_pinning=None): if _capturing(): _captured = _capture_call(_validate_sparse_csr_tensor_args, (crow_indices, col_indices, values, size, check_pinning), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._validate_sparse_csr_tensor_args(crow_indices, col_indices, values, size, check_pinning) def _validate_sparse_csc_tensor_args(ccol_indices, row_indices, values, size, check_pinning=None): if _capturing(): _captured = _capture_call(_validate_sparse_csc_tensor_args, (ccol_indices, row_indices, values, size, check_pinning), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._validate_sparse_csc_tensor_args(ccol_indices, row_indices, values, size, check_pinning) def _validate_sparse_bsr_tensor_args(crow_indices, col_indices, values, size, check_pinning=None): if _capturing(): _captured = _capture_call(_validate_sparse_bsr_tensor_args, (crow_indices, col_indices, values, size, check_pinning), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._validate_sparse_bsr_tensor_args(crow_indices, col_indices, values, size, check_pinning) def _validate_sparse_bsc_tensor_args(ccol_indices, row_indices, values, size, check_pinning=None): if _capturing(): _captured = _capture_call(_validate_sparse_bsc_tensor_args, (ccol_indices, row_indices, values, size, check_pinning), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._validate_sparse_bsc_tensor_args(ccol_indices, row_indices, values, size, check_pinning) def _sparse_coo_tensor_with_dims(sparse_dim, dense_dim, size, dtype=None, layout=None, device=None, pin_memory=False): if _capturing(): _captured = _capture_call(_sparse_coo_tensor_with_dims, (sparse_dim, dense_dim, size, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if dtype is None: dtype = DType.undefined return _C._sparse_coo_tensor_with_dims(sparse_dim, dense_dim, size, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory) def _sparse_coo_tensor_with_dims_and_tensors(sparse_dim, dense_dim, size, indices, values, dtype=None, layout=None, device=None, pin_memory=False, is_coalesced=None): if _capturing(): _captured = _capture_call(_sparse_coo_tensor_with_dims_and_tensors, (sparse_dim, dense_dim, size, indices, values, dtype, layout, device, pin_memory, is_coalesced), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if dtype is None: dtype = DType.undefined return _C._sparse_coo_tensor_with_dims_and_tensors(sparse_dim, dense_dim, size, indices, values, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, is_coalesced=is_coalesced) [docs] def sparse_resize_(input, size, sparse_dim, dense_dim): return input.sparse_resize_(size=size, sparse_dim=sparse_dim, dense_dim=dense_dim) [docs] def sparse_resize_and_clear_(input, size, sparse_dim, dense_dim): return input.sparse_resize_and_clear_(size=size, sparse_dim=sparse_dim, dense_dim=dense_dim) [docs] def sparse_mask(input, mask): if _capturing(): _captured = _capture_call(sparse_mask, (input, mask), {}) if _captured is not None: return _captured return input.sparse_mask(mask=mask) def _sparse_mask_projection(input, mask, accumulate_matches=False): if _capturing(): _captured = _capture_call(_sparse_mask_projection, (input, mask, accumulate_matches), {}) if _captured is not None: return _captured return input._sparse_mask_projection(mask=mask, accumulate_matches=accumulate_matches) def _to_cpu(*args): if _capturing(): _captured = _capture_call(_to_cpu, (*args,), {}) if _captured is not None: return _captured return _C._to_cpu(*args) def _to_dense(input, dtype=None, masked_grad=None): if _capturing(): _captured = _capture_call(_to_dense, (input, dtype, masked_grad), {}) if _captured is not None: return _captured return input._to_dense(dtype=dtype, masked_grad=masked_grad) def to_dense_backward(grad, input, masked_grad=None): if _capturing(): _captured = _capture_call(to_dense_backward, (grad, input, masked_grad), {}) if _captured is not None: return _captured return _C.to_dense_backward(grad, input, masked_grad) [docs] def sparse_dim(input): if _capturing(): _captured = _capture_call(sparse_dim, (input,), {}) if _captured is not None: return _captured return input.sparse_dim() def _dimI(input): if _capturing(): _captured = _capture_call(_dimI, (input,), {}) if _captured is not None: return _captured return input._dimI() [docs] def dense_dim(input): if _capturing(): _captured = _capture_call(dense_dim, (input,), {}) if _captured is not None: return _captured return input.dense_dim() def _dimV(input): if _capturing(): _captured = _capture_call(_dimV, (input,), {}) if _captured is not None: return _captured return input._dimV() [docs] def coalesce(input): if _capturing(): _captured = _capture_call(coalesce, (input,), {}) if _captured is not None: return _captured return input.coalesce() def _coalesce(input): if _capturing(): _captured = _capture_call(_coalesce, (input,), {}) if _captured is not None: return _captured return _C._coalesce(input) [docs] def is_coalesced(input): if _capturing(): _captured = _capture_call(is_coalesced, (input,), {}) if _captured is not None: return _captured return input.is_coalesced() def _indices(input): if _capturing(): _captured = _capture_call(_indices, (input,), {}) if _captured is not None: return _captured return input._indices() def _values(input): if _capturing(): _captured = _capture_call(_values, (input,), {}) if _captured is not None: return _captured return input._values() def _coalesced_(input, coalesced): return input._coalesced_(coalesced=coalesced) [docs] def indices(input): if _capturing(): _captured = _capture_call(indices, (input,), {}) if _captured is not None: return _captured return input.indices() [docs] def values(input): if _capturing(): _captured = _capture_call(values, (input,), {}) if _captured is not None: return _captured return input.values() [docs] def crow_indices(input): if _capturing(): _captured = _capture_call(crow_indices, (input,), {}) if _captured is not None: return _captured return input.crow_indices() [docs] def col_indices(input): if _capturing(): _captured = _capture_call(col_indices, (input,), {}) if _captured is not None: return _captured return input.col_indices() [docs] def ccol_indices(input): if _capturing(): _captured = _capture_call(ccol_indices, (input,), {}) if _captured is not None: return _captured return input.ccol_indices() [docs] def row_indices(input): if _capturing(): _captured = _capture_call(row_indices, (input,), {}) if _captured is not None: return _captured return input.row_indices() [docs] def hspmm(mat1, mat2, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(hspmm, (mat1, mat2), {'out': out}) if _captured is not None: return _captured return _C.hspmm(mat1=mat1, mat2=mat2, out=out) if _capturing(): _captured = _capture_call(hspmm, (mat1, mat2), {}) if _captured is not None: return _captured return _C.hspmm(mat1=mat1, mat2=mat2) [docs] def copy_sparse_to_sparse_(input, src, non_blocking=False): if _capturing(): _captured = _capture_call(copy_sparse_to_sparse_, (input, src, non_blocking), {}) if _captured is not None: return _captured return _C.copy_sparse_to_sparse_(input, src, non_blocking) def _to_sparse(input, sparse_dim): if _capturing(): _captured = _capture_call(_to_sparse, (input, sparse_dim), {}) if _captured is not None: return _captured return input._to_sparse(sparse_dim=sparse_dim) def _to_sparse_csr(input, dense_dim=None): if _capturing(): _captured = _capture_call(_to_sparse_csr, (input, dense_dim), {}) if _captured is not None: return _captured return input._to_sparse_csr(dense_dim=dense_dim) [docs] def to_sparse_csc(input, dense_dim=None): if _capturing(): _captured = _capture_call(to_sparse_csc, (input, dense_dim), {}) if _captured is not None: return _captured return input.to_sparse_csc(dense_dim=dense_dim) def _to_sparse_csc(input, dense_dim=None): if _capturing(): _captured = _capture_call(_to_sparse_csc, (input, dense_dim), {}) if _captured is not None: return _captured return input._to_sparse_csc(dense_dim=dense_dim) [docs] def to_sparse_bsr(input, blocksize, dense_dim=None): if _capturing(): _captured = _capture_call(to_sparse_bsr, (input, blocksize, dense_dim), {}) if _captured is not None: return _captured return input.to_sparse_bsr(blocksize=blocksize, dense_dim=dense_dim) def _to_sparse_bsr(input, blocksize, dense_dim=None): if _capturing(): _captured = _capture_call(_to_sparse_bsr, (input, blocksize, dense_dim), {}) if _captured is not None: return _captured return input._to_sparse_bsr(blocksize=blocksize, dense_dim=dense_dim) [docs] def to_sparse_bsc(input, blocksize, dense_dim=None): if _capturing(): _captured = _capture_call(to_sparse_bsc, (input, blocksize, dense_dim), {}) if _captured is not None: return _captured return input.to_sparse_bsc(blocksize=blocksize, dense_dim=dense_dim) def _to_sparse_bsc(input, blocksize, dense_dim=None): if _capturing(): _captured = _capture_call(_to_sparse_bsc, (input, blocksize, dense_dim), {}) if _captured is not None: return _captured return input._to_sparse_bsc(blocksize=blocksize, dense_dim=dense_dim) [docs] def to_mkldnn(input, dtype=None): if _capturing(): _captured = _capture_call(to_mkldnn, (input, dtype), {}) if _captured is not None: return _captured return input.to_mkldnn(dtype=dtype) [docs] def mkldnn_reorder_conv2d_weight(input, padding=0, stride=1, dilation=1, groups=1, input_size=None): if _capturing(): _captured = _capture_call(mkldnn_reorder_conv2d_weight, (input, padding, stride, dilation, groups, input_size), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] return _C.mkldnn_reorder_conv2d_weight(input, padding, stride, dilation, groups, input_size) [docs] def mkldnn_reorder_conv3d_weight(input, padding=0, stride=1, dilation=1, groups=1, input_size=None): if _capturing(): _captured = _capture_call(mkldnn_reorder_conv3d_weight, (input, padding, stride, dilation, groups, input_size), {}) if _captured is not None: return _captured if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] return _C.mkldnn_reorder_conv3d_weight(input, padding, stride, dilation, groups, input_size) def to_mkldnn_backward(grad, input): if _capturing(): _captured = _capture_call(to_mkldnn_backward, (grad, input), {}) if _captured is not None: return _captured return _C.to_mkldnn_backward(grad, input) [docs] def q_scale(input): if _capturing(): _captured = _capture_call(q_scale, (input,), {}) if _captured is not None: return _captured return _C.q_scale(input) [docs] def q_zero_point(input): if _capturing(): _captured = _capture_call(q_zero_point, (input,), {}) if _captured is not None: return _captured return _C.q_zero_point(input) [docs] def q_per_channel_scales(input): if _capturing(): _captured = _capture_call(q_per_channel_scales, (input,), {}) if _captured is not None: return _captured return _C.q_per_channel_scales(input) [docs] def q_per_channel_zero_points(input): if _capturing(): _captured = _capture_call(q_per_channel_zero_points, (input,), {}) if _captured is not None: return _captured return _C.q_per_channel_zero_points(input) [docs] def q_per_channel_axis(input): if _capturing(): _captured = _capture_call(q_per_channel_axis, (input,), {}) if _captured is not None: return _captured return _C.q_per_channel_axis(input) [docs] def is_quantized(input): if _capturing(): _captured = _capture_call(is_quantized, (input,), {}) if _captured is not None: return _captured return _C.is_quantized(input) def is_nested(input): if _capturing(): _captured = _capture_call(is_nested, (input,), {}) if _captured is not None: return _captured return _C.is_nested(input) [docs] def qscheme(input): if _capturing(): _captured = _capture_call(qscheme, (input,), {}) if _captured is not None: return _captured return _C.qscheme(input) [docs] def int_repr(input): if _capturing(): _captured = _capture_call(int_repr, (input,), {}) if _captured is not None: return _captured return _C.int_repr(input) def _make_per_tensor_quantized_tensor(input, scale, zero_point): if _capturing(): _captured = _capture_call(_make_per_tensor_quantized_tensor, (input, scale, zero_point), {}) if _captured is not None: return _captured return _C._make_per_tensor_quantized_tensor(input, scale, zero_point) def _make_per_channel_quantized_tensor(input, scale, zero_point, axis): if _capturing(): _captured = _capture_call(_make_per_channel_quantized_tensor, (input, scale, zero_point, axis), {}) if _captured is not None: return _captured return _C._make_per_channel_quantized_tensor(input, scale, zero_point, axis) [docs] def fake_quantize_per_tensor_affine(input, scale, zero_point, quant_min, quant_max): if _capturing(): _captured = _capture_call(fake_quantize_per_tensor_affine, (input, scale, zero_point, quant_min, quant_max), {}) if _captured is not None: return _captured return _C.fake_quantize_per_tensor_affine(input, scale, zero_point, quant_min, quant_max) [docs] def fake_quantize_per_tensor_affine_cachemask(input, scale, zero_point, quant_min, quant_max): if _capturing(): _captured = _capture_call(fake_quantize_per_tensor_affine_cachemask, (input, scale, zero_point, quant_min, quant_max), {}) if _captured is not None: return _captured return _C.fake_quantize_per_tensor_affine_cachemask(input, scale, zero_point, quant_min, quant_max) def _fake_quantize_per_tensor_affine_cachemask_tensor_qparams(input, scale, zero_point, fake_quant_enabled, quant_min, quant_max): if _capturing(): _captured = _capture_call(_fake_quantize_per_tensor_affine_cachemask_tensor_qparams, (input, scale, zero_point, fake_quant_enabled, quant_min, quant_max), {}) if _captured is not None: return _captured return _C._fake_quantize_per_tensor_affine_cachemask_tensor_qparams(input, scale, zero_point, fake_quant_enabled, quant_min, quant_max) def fake_quantize_per_tensor_affine_cachemask_backward(grad, mask): if _capturing(): _captured = _capture_call(fake_quantize_per_tensor_affine_cachemask_backward, (grad, mask), {}) if _captured is not None: return _captured return _C.fake_quantize_per_tensor_affine_cachemask_backward(grad, mask) def _fake_quantize_learnable_per_tensor_affine(input, scale, zero_point, quant_min, quant_max, grad_factor=1.0): if _capturing(): _captured = _capture_call(_fake_quantize_learnable_per_tensor_affine, (input, scale, zero_point, quant_min, quant_max, grad_factor), {}) if _captured is not None: return _captured return _C._fake_quantize_learnable_per_tensor_affine(input, scale, zero_point, quant_min, quant_max, grad_factor) def _fake_quantize_learnable_per_tensor_affine_backward(grad, input, scale, zero_point, quant_min, quant_max, grad_factor=1.0): if _capturing(): _captured = _capture_call(_fake_quantize_learnable_per_tensor_affine_backward, (grad, input, scale, zero_point, quant_min, quant_max, grad_factor), {}) if _captured is not None: return _captured return _C._fake_quantize_learnable_per_tensor_affine_backward(grad, input, scale, zero_point, quant_min, quant_max, grad_factor) [docs] def fake_quantize_per_channel_affine(input, scale, zero_point, axis, quant_min, quant_max): if _capturing(): _captured = _capture_call(fake_quantize_per_channel_affine, (input, scale, zero_point, axis, quant_min, quant_max), {}) if _captured is not None: return _captured return _C.fake_quantize_per_channel_affine(input, scale, zero_point, axis, quant_min, quant_max) [docs] def fake_quantize_per_channel_affine_cachemask(input, scale, zero_point, axis, quant_min, quant_max): if _capturing(): _captured = _capture_call(fake_quantize_per_channel_affine_cachemask, (input, scale, zero_point, axis, quant_min, quant_max), {}) if _captured is not None: return _captured return _C.fake_quantize_per_channel_affine_cachemask(input, scale, zero_point, axis, quant_min, quant_max) def fake_quantize_per_channel_affine_cachemask_backward(grad, mask): if _capturing(): _captured = _capture_call(fake_quantize_per_channel_affine_cachemask_backward, (grad, mask), {}) if _captured is not None: return _captured return _C.fake_quantize_per_channel_affine_cachemask_backward(grad, mask) def _fake_quantize_learnable_per_channel_affine(input, scale, zero_point, axis, quant_min, quant_max, grad_factor=1.0): if _capturing(): _captured = _capture_call(_fake_quantize_learnable_per_channel_affine, (input, scale, zero_point, axis, quant_min, quant_max, grad_factor), {}) if _captured is not None: return _captured return _C._fake_quantize_learnable_per_channel_affine(input, scale, zero_point, axis, quant_min, quant_max, grad_factor) def _fake_quantize_learnable_per_channel_affine_backward(grad, input, scale, zero_point, axis, quant_min, quant_max, grad_factor=1.0): if _capturing(): _captured = _capture_call(_fake_quantize_learnable_per_channel_affine_backward, (grad, input, scale, zero_point, axis, quant_min, quant_max, grad_factor), {}) if _captured is not None: return _captured return _C._fake_quantize_learnable_per_channel_affine_backward(grad, input, scale, zero_point, axis, quant_min, quant_max, grad_factor) [docs] def fused_moving_avg_obs_fake_quant(input, observer_on, fake_quant_on, running_min, running_max, scale, zero_point, averaging_const, quant_min, quant_max, ch_axis, per_row_fake_quant=False, symmetric_quant=False): if _capturing(): _captured = _capture_call(fused_moving_avg_obs_fake_quant, (input, observer_on, fake_quant_on, running_min, running_max, scale, zero_point, averaging_const, quant_min, quant_max, ch_axis, per_row_fake_quant, symmetric_quant), {}) if _captured is not None: return _captured return _C.fused_moving_avg_obs_fake_quant(input, observer_on, fake_quant_on, running_min, running_max, scale, zero_point, averaging_const, quant_min, quant_max, ch_axis, per_row_fake_quant, symmetric_quant) def _fused_moving_avg_obs_fq_helper(input, observer_on, fake_quant_on, running_min, running_max, scale, zero_point, averaging_const, quant_min, quant_max, ch_axis, per_row_fake_quant=False, symmetric_quant=False): if _capturing(): _captured = _capture_call(_fused_moving_avg_obs_fq_helper, (input, observer_on, fake_quant_on, running_min, running_max, scale, zero_point, averaging_const, quant_min, quant_max, ch_axis, per_row_fake_quant, symmetric_quant), {}) if _captured is not None: return _captured return _C._fused_moving_avg_obs_fq_helper(input, observer_on, fake_quant_on, running_min, running_max, scale, zero_point, averaging_const, quant_min, quant_max, ch_axis, per_row_fake_quant, symmetric_quant) def _choose_qparams_per_tensor(input, reduce_range=False): if _capturing(): _captured = _capture_call(_choose_qparams_per_tensor, (input, reduce_range), {}) if _captured is not None: return _captured return _C._choose_qparams_per_tensor(input, reduce_range) def _saturate_weight_to_fp16(weight): if _capturing(): _captured = _capture_call(_saturate_weight_to_fp16, (weight,), {}) if _captured is not None: return _captured return _C._saturate_weight_to_fp16(weight) [docs] def choose_qparams_optimized(input, numel, n_bins, ratio, bit_width): if _capturing(): _captured = _capture_call(choose_qparams_optimized, (input, numel, n_bins, ratio, bit_width), {}) if _captured is not None: return _captured return _C.choose_qparams_optimized(input, numel, n_bins, ratio, bit_width) def _autocast_to_reduced_precision(input, cuda_enabled, cpu_enabled, cuda_dtype, cpu_dtype): if _capturing(): _captured = _capture_call(_autocast_to_reduced_precision, (input, cuda_enabled, cpu_enabled, cuda_dtype, cpu_dtype), {}) if _captured is not None: return _captured return input._autocast_to_reduced_precision(cuda_enabled=cuda_enabled, cpu_enabled=cpu_enabled, cuda_dtype=cuda_dtype, cpu_dtype=cpu_dtype) def _autocast_to_full_precision(input, cuda_enabled, cpu_enabled): if _capturing(): _captured = _capture_call(_autocast_to_full_precision, (input, cuda_enabled, cpu_enabled), {}) if _captured is not None: return _captured return input._autocast_to_full_precision(cuda_enabled=cuda_enabled, cpu_enabled=cpu_enabled) def _to_copy(input, dtype=None, layout=None, device=None, pin_memory=None, non_blocking=False, memory_format=None): if _capturing(): _captured = _capture_call(_to_copy, (input, dtype, layout, device, pin_memory, non_blocking, memory_format), {}) if _captured is not None: return _captured return _C._to_copy(input, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, non_blocking=non_blocking, memory_format=memory_format) [docs] def to(input, dtype=None, layout=None, device=None, pin_memory=None, non_blocking=False, copy=False, memory_format=None): if _capturing(): _captured = _capture_call(to, (input, dtype, layout, device, pin_memory, non_blocking, copy, memory_format), {}) if _captured is not None: return _captured return input.to(dtype=dtype, layout=layout, device=device, pin_memory=pin_memory, non_blocking=non_blocking, copy=copy, memory_format=memory_format) def _local_scalar_dense(input): if _capturing(): _captured = _capture_call(_local_scalar_dense, (input,), {}) if _captured is not None: return _captured return _C._local_scalar_dense(input) def _lstm_mps(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first): if _capturing(): _captured = _capture_call(_lstm_mps, (input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first), {}) if _captured is not None: return _captured return _C._lstm_mps(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first) def lstm_mps_backward(grad_y, grad_hy, grad_cy, z_state, cell_state_fwd, input, layersOutputs, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first): if _capturing(): _captured = _capture_call(lstm_mps_backward, (grad_y, grad_hy, grad_cy, z_state, cell_state_fwd, input, layersOutputs, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first), {}) if _captured is not None: return _captured return _C.lstm_mps_backward(grad_y, grad_hy, grad_cy, z_state, cell_state_fwd, input, layersOutputs, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first) def _thnn_fused_lstm_cell(input_gates, hidden_gates, cx, input_bias=None, hidden_bias=None): if _capturing(): _captured = _capture_call(_thnn_fused_lstm_cell, (input_gates, hidden_gates, cx, input_bias, hidden_bias), {}) if _captured is not None: return _captured return _C._thnn_fused_lstm_cell(input_gates, hidden_gates, cx, input_bias, hidden_bias) def _thnn_fused_lstm_cell_backward_impl(grad_hy, grad_cy, cx, cy, workspace, has_bias): if _capturing(): _captured = _capture_call(_thnn_fused_lstm_cell_backward_impl, (grad_hy, grad_cy, cx, cy, workspace, has_bias), {}) if _captured is not None: return _captured return _C._thnn_fused_lstm_cell_backward_impl(grad_hy, grad_cy, cx, cy, workspace, has_bias) def _thnn_fused_lstm_cell_backward(grad_hy, grad_cy, cx, cy, workspace, has_bias): if _capturing(): _captured = _capture_call(_thnn_fused_lstm_cell_backward, (grad_hy, grad_cy, cx, cy, workspace, has_bias), {}) if _captured is not None: return _captured return _C._thnn_fused_lstm_cell_backward(grad_hy, grad_cy, cx, cy, workspace, has_bias) def _thnn_differentiable_lstm_cell_backward(grad_hy, grad_cy, input_gates, hidden_gates, input_bias, hidden_bias, cx, cy): if _capturing(): _captured = _capture_call(_thnn_differentiable_lstm_cell_backward, (grad_hy, grad_cy, input_gates, hidden_gates, input_bias, hidden_bias, cx, cy), {}) if _captured is not None: return _captured return _C._thnn_differentiable_lstm_cell_backward(grad_hy, grad_cy, input_gates, hidden_gates, input_bias, hidden_bias, cx, cy) def _thnn_fused_gru_cell(input_gates, hidden_gates, hx, input_bias=None, hidden_bias=None): if _capturing(): _captured = _capture_call(_thnn_fused_gru_cell, (input_gates, hidden_gates, hx, input_bias, hidden_bias), {}) if _captured is not None: return _captured return _C._thnn_fused_gru_cell(input_gates, hidden_gates, hx, input_bias, hidden_bias) def _thnn_fused_gru_cell_backward(grad_hy, workspace, has_bias): if _capturing(): _captured = _capture_call(_thnn_fused_gru_cell_backward, (grad_hy, workspace, has_bias), {}) if _captured is not None: return _captured return _C._thnn_fused_gru_cell_backward(grad_hy, workspace, has_bias) def _thnn_differentiable_gru_cell_backward(grad_hy, input_gates, hidden_gates, hx, input_bias, hidden_bias): if _capturing(): _captured = _capture_call(_thnn_differentiable_gru_cell_backward, (grad_hy, input_gates, hidden_gates, hx, input_bias, hidden_bias), {}) if _captured is not None: return _captured return _C._thnn_differentiable_gru_cell_backward(grad_hy, input_gates, hidden_gates, hx, input_bias, hidden_bias) [docs] def quantized_lstm_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh): if _capturing(): _captured = _capture_call(quantized_lstm_cell, (input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh), {}) if _captured is not None: return _captured if not isinstance(scale_ih, (tensorplay.Scalar, tensorplay.Tensor)): scale_ih = tensorplay.Scalar(scale_ih) if not isinstance(scale_hh, (tensorplay.Scalar, tensorplay.Tensor)): scale_hh = tensorplay.Scalar(scale_hh) if not isinstance(zero_point_ih, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_ih = tensorplay.Scalar(zero_point_ih) if not isinstance(zero_point_hh, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_hh = tensorplay.Scalar(zero_point_hh) return _C.quantized_lstm_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh) [docs] def quantized_gru_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh): if _capturing(): _captured = _capture_call(quantized_gru_cell, (input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh), {}) if _captured is not None: return _captured if not isinstance(scale_ih, (tensorplay.Scalar, tensorplay.Tensor)): scale_ih = tensorplay.Scalar(scale_ih) if not isinstance(scale_hh, (tensorplay.Scalar, tensorplay.Tensor)): scale_hh = tensorplay.Scalar(scale_hh) if not isinstance(zero_point_ih, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_ih = tensorplay.Scalar(zero_point_ih) if not isinstance(zero_point_hh, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_hh = tensorplay.Scalar(zero_point_hh) return _C.quantized_gru_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh) [docs] def quantized_rnn_relu_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh): if _capturing(): _captured = _capture_call(quantized_rnn_relu_cell, (input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh), {}) if _captured is not None: return _captured if not isinstance(scale_ih, (tensorplay.Scalar, tensorplay.Tensor)): scale_ih = tensorplay.Scalar(scale_ih) if not isinstance(scale_hh, (tensorplay.Scalar, tensorplay.Tensor)): scale_hh = tensorplay.Scalar(scale_hh) if not isinstance(zero_point_ih, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_ih = tensorplay.Scalar(zero_point_ih) if not isinstance(zero_point_hh, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_hh = tensorplay.Scalar(zero_point_hh) return _C.quantized_rnn_relu_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh) [docs] def quantized_rnn_tanh_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh): if _capturing(): _captured = _capture_call(quantized_rnn_tanh_cell, (input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh), {}) if _captured is not None: return _captured if not isinstance(scale_ih, (tensorplay.Scalar, tensorplay.Tensor)): scale_ih = tensorplay.Scalar(scale_ih) if not isinstance(scale_hh, (tensorplay.Scalar, tensorplay.Tensor)): scale_hh = tensorplay.Scalar(scale_hh) if not isinstance(zero_point_ih, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_ih = tensorplay.Scalar(zero_point_ih) if not isinstance(zero_point_hh, (tensorplay.Scalar, tensorplay.Tensor)): zero_point_hh = tensorplay.Scalar(zero_point_hh) return _C.quantized_rnn_tanh_cell(input, hx, w_ih, w_hh, b_ih, b_hh, packed_ih, packed_hh, col_offsets_ih, col_offsets_hh, scale_ih, scale_hh, zero_point_ih, zero_point_hh) def _pack_padded_sequence(input, lengths, batch_first): if _capturing(): _captured = _capture_call(_pack_padded_sequence, (input, lengths, batch_first), {}) if _captured is not None: return _captured return _C._pack_padded_sequence(input, lengths, batch_first) def _pack_padded_sequence_backward(grad, input_size, batch_sizes, batch_first): if _capturing(): _captured = _capture_call(_pack_padded_sequence_backward, (grad, input_size, batch_sizes, batch_first), {}) if _captured is not None: return _captured if isinstance(input_size, int) and not isinstance(input_size, bool): input_size = [input_size] return _C._pack_padded_sequence_backward(grad, input_size, batch_sizes, batch_first) def _pad_packed_sequence(data, batch_sizes, batch_first, padding_value, total_length): if _capturing(): _captured = _capture_call(_pad_packed_sequence, (data, batch_sizes, batch_first, padding_value, total_length), {}) if _captured is not None: return _captured if not isinstance(padding_value, (tensorplay.Scalar, tensorplay.Tensor)): padding_value = tensorplay.Scalar(padding_value) return _C._pad_packed_sequence(data, batch_sizes, batch_first, padding_value, total_length) [docs] def set_(input, source): return input.set_(source=source) [docs] def lift(input): if _capturing(): _captured = _capture_call(lift, (input,), {}) if _captured is not None: return _captured return _C.lift(input) [docs] def lift_fresh(input): if _capturing(): _captured = _capture_call(lift_fresh, (input,), {}) if _captured is not None: return _captured return _C.lift_fresh(input) [docs] def lift_fresh_copy(input): if _capturing(): _captured = _capture_call(lift_fresh_copy, (input,), {}) if _captured is not None: return _captured return _C.lift_fresh_copy(input) [docs] def is_set_to(input, tensor): if _capturing(): _captured = _capture_call(is_set_to, (input, tensor), {}) if _captured is not None: return _captured return input.is_set_to(tensor=tensor) def masked_scatter_backward(grad_output, mask, sizes): if _capturing(): _captured = _capture_call(masked_scatter_backward, (grad_output, mask, sizes), {}) if _captured is not None: return _captured if isinstance(sizes, int) and not isinstance(sizes, bool): sizes = [sizes] return _C.masked_scatter_backward(grad_output, mask, sizes) def _masked_softmax(input, mask, dim=None, mask_type=None): if _capturing(): _captured = _capture_call(_masked_softmax, (input, mask, dim, mask_type), {}) if _captured is not None: return _captured return _C._masked_softmax(input, mask, dim, mask_type) def _masked_softmax_backward(grad_output, output, mask, dim=None): if _capturing(): _captured = _capture_call(_masked_softmax_backward, (grad_output, output, mask, dim), {}) if _captured is not None: return _captured return _C._masked_softmax_backward(grad_output, output, mask, dim) [docs] def put_(input, index, source, accumulate=False): return input.put_(index=index, source=source, accumulate=accumulate) [docs] def scatter_reduce_(input, dim, index, src, reduce, include_self=True): return input.scatter_reduce_(dim=dim, index=index, src=src, reduce=reduce, include_self=include_self) [docs] def eq_(input, other): return input.eq_(other=other) [docs] def bitwise_and_(input, other): return input.bitwise_and_(other=other) def __and__(input, other): if _capturing(): _captured = _capture_call(__and__, (input, other), {}) if _captured is not None: return _captured if not isinstance(other, (tensorplay.Scalar, tensorplay.Tensor)): other = tensorplay.Scalar(other) return _C.__and__(input, other) def __iand__(input, other): return input.__iand__(other=other) [docs] def bitwise_or_(input, other): return input.bitwise_or_(other=other) def __or__(input, other): if _capturing(): _captured = _capture_call(__or__, (input, other), {}) if _captured is not None: return _captured if not isinstance(other, (tensorplay.Scalar, tensorplay.Tensor)): other = tensorplay.Scalar(other) return _C.__or__(input, other) def __ior__(input, other): return input.__ior__(other=other) [docs] def bitwise_xor_(input, other): return input.bitwise_xor_(other=other) def __xor__(input, other): if _capturing(): _captured = _capture_call(__xor__, (input, other), {}) if _captured is not None: return _captured if not isinstance(other, (tensorplay.Scalar, tensorplay.Tensor)): other = tensorplay.Scalar(other) return _C.__xor__(input, other) def __ixor__(input, other): return input.__ixor__(other=other) def __lshift__(input, other): if _capturing(): _captured = _capture_call(__lshift__, (input, other), {}) if _captured is not None: return _captured if not isinstance(other, (tensorplay.Scalar, tensorplay.Tensor)): other = tensorplay.Scalar(other) return _C.__lshift__(input, other) def __ilshift__(input, other): return input.__ilshift__(other=other) [docs] def bitwise_left_shift_(input, other): return input.bitwise_left_shift_(other=other) def __rshift__(input, other): if _capturing(): _captured = _capture_call(__rshift__, (input, other), {}) if _captured is not None: return _captured if not isinstance(other, (tensorplay.Scalar, tensorplay.Tensor)): other = tensorplay.Scalar(other) return _C.__rshift__(input, other) def __irshift__(input, other): return input.__irshift__(other=other) [docs] def bitwise_right_shift_(input, other): return input.bitwise_right_shift_(other=other) [docs] def digamma_(input): return input.digamma_() def trace_backward(grad, sizes): if _capturing(): _captured = _capture_call(trace_backward, (grad, sizes), {}) if _captured is not None: return _captured if isinstance(sizes, int) and not isinstance(sizes, bool): sizes = [sizes] return _C.trace_backward(grad, sizes) [docs] def ne_(input, other): return input.ne_(other=other) [docs] def not_equal_(input, other): return input.not_equal_(other=other) [docs] def ge_(input, other): return input.ge_(other=other) [docs] def greater_equal_(input, other): return input.greater_equal_(other=other) [docs] def le_(input, other): return input.le_(other=other) [docs] def less_equal_(input, other): return input.less_equal_(other=other) [docs] def gt_(input, other): return input.gt_(other=other) [docs] def greater_(input, other): return input.greater_(other=other) [docs] def lt_(input, other): return input.lt_(other=other) [docs] def less_(input, other): return input.less_(other=other) def index_select_backward(grad, self_sizes, dim, index): if _capturing(): _captured = _capture_call(index_select_backward, (grad, self_sizes, dim, index), {}) if _captured is not None: return _captured if isinstance(self_sizes, int) and not isinstance(self_sizes, bool): self_sizes = [self_sizes] return _C.index_select_backward(grad, self_sizes, dim, index) def masked_select_backward(grad, input, mask): if _capturing(): _captured = _capture_call(masked_select_backward, (grad, input, mask), {}) if _captured is not None: return _captured return _C.masked_select_backward(grad, input, mask) [docs] def nonzero_numpy(input): if _capturing(): _captured = _capture_call(nonzero_numpy, (input,), {}) if _captured is not None: return _captured return _C.nonzero_numpy(input) def gather_backward(grad, input, dim, index, sparse_grad): if _capturing(): _captured = _capture_call(gather_backward, (grad, input, dim, index, sparse_grad), {}) if _captured is not None: return _captured return _C.gather_backward(grad, input, dim, index, sparse_grad) def _gather_sparse_backward(input, dim, index, grad): if _capturing(): _captured = _capture_call(_gather_sparse_backward, (input, dim, index, grad), {}) if _captured is not None: return _captured return _C._gather_sparse_backward(input, dim, index, grad) [docs] def cross_entropy_loss(input, target, weight=None, reduction=1, ignore_index=-100, label_smoothing=0.0): if _capturing(): _captured = _capture_call(cross_entropy_loss, (input, target, weight, reduction, ignore_index, label_smoothing), {}) if _captured is not None: return _captured return _C.cross_entropy_loss(input, target, weight, reduction, ignore_index, label_smoothing) def _linalg_check_errors(info, api_name, is_matrix): if _capturing(): _captured = _capture_call(_linalg_check_errors, (info, api_name, is_matrix), {}) if _captured is not None: return _captured return _C._linalg_check_errors(info, api_name, is_matrix=is_matrix) [docs] def swapaxes_(input, axis0, axis1): return input.swapaxes_(axis0=axis0, axis1=axis1) [docs] def swapdims_(input, dim0, dim1): return input.swapdims_(dim0=dim0, dim1=dim1) def _cholesky_solve_helper(input, A, upper): if _capturing(): _captured = _capture_call(_cholesky_solve_helper, (input, A, upper), {}) if _captured is not None: return _captured return _C._cholesky_solve_helper(input, A, upper) [docs] def geqrf(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(geqrf, (input,), {'out': out}) if _captured is not None: return _captured return _C.geqrf(self=input, out=out) if _capturing(): _captured = _capture_call(geqrf, (input,), {}) if _captured is not None: return _captured return _C.geqrf(self=input) [docs] def orgqr(input, input2, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(orgqr, (input, input2), {'out': out}) if _captured is not None: return _captured return _C.orgqr(self=input, input2=input2, out=out) if _capturing(): _captured = _capture_call(orgqr, (input, input2), {}) if _captured is not None: return _captured return _C.orgqr(self=input, input2=input2) [docs] def ormqr(input, input2, input3, left=True, transpose=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(ormqr, (input, input2, input3, left, transpose), {'out': out}) if _captured is not None: return _captured return _C.ormqr(self=input, input2=input2, input3=input3, left=left, transpose=transpose, out=out) if _capturing(): _captured = _capture_call(ormqr, (input, input2, input3, left, transpose), {}) if _captured is not None: return _captured return _C.ormqr(self=input, input2=input2, input3=input3, left=left, transpose=transpose) def _lu_with_info(input, pivot=True, check_errors=True): if _capturing(): _captured = _capture_call(_lu_with_info, (input, pivot, check_errors), {}) if _captured is not None: return _captured return _C._lu_with_info(input, pivot, check_errors) [docs] def lu_solve(input, LU_data, LU_pivots, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(lu_solve, (input, LU_data, LU_pivots), {'out': out}) if _captured is not None: return _captured return _C.lu_solve(self=input, LU_data=LU_data, LU_pivots=LU_pivots, out=out) if _capturing(): _captured = _capture_call(lu_solve, (input, LU_data, LU_pivots), {}) if _captured is not None: return _captured return _C.lu_solve(self=input, LU_data=LU_data, LU_pivots=LU_pivots) [docs] def lu_unpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(lu_unpack, (LU_data, LU_pivots, unpack_data, unpack_pivots), {'out': out}) if _captured is not None: return _captured return _C.lu_unpack(LU_data=LU_data, LU_pivots=LU_pivots, unpack_data=unpack_data, unpack_pivots=unpack_pivots, out=out) if _capturing(): _captured = _capture_call(lu_unpack, (LU_data, LU_pivots, unpack_data, unpack_pivots), {}) if _captured is not None: return _captured return _C.lu_unpack(LU_data=LU_data, LU_pivots=LU_pivots, unpack_data=unpack_data, unpack_pivots=unpack_pivots) [docs] def polygamma_(input, n): return input.polygamma_(n=n) [docs] def arctan2(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(arctan2, (input, other), {'out': out}) if _captured is not None: return _captured return _C.arctan2(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(arctan2, (input, other), {}) if _captured is not None: return _captured return _C.arctan2(self=input, other=other) [docs] def arctan2_(input, other): return input.arctan2_(other=other) def _histogramdd_bin_edges(input, bins, range=None, weight=None, density=False): if _capturing(): _captured = _capture_call(_histogramdd_bin_edges, (input, bins, range, weight, density), {}) if _captured is not None: return _captured if isinstance(bins, int) and not isinstance(bins, bool): bins = [bins] return _C._histogramdd_bin_edges(input, bins, range=range, weight=weight, density=density) def _histogramdd_from_bin_cts(input, bins, range=None, weight=None, density=False): if _capturing(): _captured = _capture_call(_histogramdd_from_bin_cts, (input, bins, range, weight, density), {}) if _captured is not None: return _captured if isinstance(bins, int) and not isinstance(bins, bool): bins = [bins] return _C._histogramdd_from_bin_cts(input, bins, range=range, weight=weight, density=density) def _histogramdd_from_bin_tensors(input, bins, weight=None, density=False): if _capturing(): _captured = _capture_call(_histogramdd_from_bin_tensors, (input, bins, weight, density), {}) if _captured is not None: return _captured return _C._histogramdd_from_bin_tensors(input, bins, weight=weight, density=density) def histogramdd(input, bins, range=None, weight=None, density=False): if _capturing(): _captured = _capture_call(histogramdd, (input, bins, range, weight, density), {}) if _captured is not None: return _captured if isinstance(bins, int) and not isinstance(bins, bool): bins = [bins] return _C.histogramdd(input, bins, range, weight, density) [docs] def fmod_(input, other): return input.fmod_(other=other) [docs] def igamma_(input, other): return input.igamma_(other=other) [docs] def igammac_(input, other): return input.igammac_(other=other) [docs] def remainder_(input, other): return input.remainder_(other=other) [docs] def pow_(input, exponent): return input.pow_(exponent=exponent) [docs] def float_power_(input, exponent): return input.float_power_(exponent=exponent) [docs] def normal_functional(input, mean=0, std=1, generator=None): if _capturing(): _captured = _capture_call(normal_functional, (input, mean, std, generator), {}) if _captured is not None: return _captured return _C.normal_functional(input, mean, std, generator=generator) [docs] def normal(mean, std=_MISSING, size=None, *, generator=None, out=None, dtype=None, layout=None, device=None, pin_memory=False, requires_grad=False): if size is not None: if std is _MISSING: raise TypeError('normal() with a size takes both mean and std') if out is not None: if _capturing(): _captured = _capture_call(normal, (mean, std, size), {'generator': generator, 'out': out}) if _captured is not None: return _captured return _C.normal(mean, std, size, generator=generator, out=out) if _capturing(): _captured = _capture_call(normal, (mean, std, size), {'generator': generator, 'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory, 'requires_grad': requires_grad}) if _captured is not None: return _captured return _C.normal(mean, std, size, generator=generator, dtype=dtype, layout=layout, device=_ensure_device(device), pin_memory=pin_memory, requires_grad=requires_grad) if std is _MISSING: std = 1.0 if out is not None: if _capturing(): _captured = _capture_call(normal, (mean, std), {'generator': generator, 'out': out}) if _captured is not None: return _captured return _C.normal(mean, std, generator=generator, out=out) if _capturing(): _captured = _capture_call(normal, (mean, std), {'generator': generator}) if _captured is not None: return _captured return _C.normal(mean, std, generator=generator) [docs] def alias(input): if _capturing(): _captured = _capture_call(alias, (input,), {}) if _captured is not None: return _captured return _C.alias(input) def _foreach_acos(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_acos, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_acos(input, *args, **kwargs) def _foreach_acos_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_acos_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_acos_(input, *args, **kwargs) def _foreach_asin(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_asin, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_asin(input, *args, **kwargs) def _foreach_asin_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_asin_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_asin_(input, *args, **kwargs) def _foreach_atan(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_atan, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_atan(input, *args, **kwargs) def _foreach_atan_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_atan_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_atan_(input, *args, **kwargs) def _foreach_ceil(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_ceil, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_ceil(input, *args, **kwargs) def _foreach_ceil_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_ceil_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_ceil_(input, *args, **kwargs) def _foreach_cos(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_cos, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_cos(input, *args, **kwargs) def _foreach_cos_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_cos_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_cos_(input, *args, **kwargs) def _foreach_cosh(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_cosh, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_cosh(input, *args, **kwargs) def _foreach_cosh_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_cosh_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_cosh_(input, *args, **kwargs) def _foreach_erf(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_erf, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_erf(input, *args, **kwargs) def _foreach_erf_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_erf_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_erf_(input, *args, **kwargs) def _foreach_erfc(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_erfc, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_erfc(input, *args, **kwargs) def _foreach_erfc_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_erfc_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_erfc_(input, *args, **kwargs) def _foreach_exp(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_exp, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_exp(input, *args, **kwargs) def _foreach_exp_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_exp_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_exp_(input, *args, **kwargs) def _foreach_expm1(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_expm1, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_expm1(input, *args, **kwargs) def _foreach_expm1_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_expm1_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_expm1_(input, *args, **kwargs) def _foreach_floor(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_floor, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_floor(input, *args, **kwargs) def _foreach_floor_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_floor_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_floor_(input, *args, **kwargs) def _foreach_frac(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_frac, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_frac(input, *args, **kwargs) def _foreach_frac_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_frac_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_frac_(input, *args, **kwargs) def _foreach_lgamma(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_lgamma, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_lgamma(input, *args, **kwargs) def _foreach_lgamma_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_lgamma_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_lgamma_(input, *args, **kwargs) def _foreach_log(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log(input, *args, **kwargs) def _foreach_log_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log_(input, *args, **kwargs) def _foreach_log10(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log10, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log10(input, *args, **kwargs) def _foreach_log10_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log10_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log10_(input, *args, **kwargs) def _foreach_log1p(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log1p, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log1p(input, *args, **kwargs) def _foreach_log1p_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log1p_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log1p_(input, *args, **kwargs) def _foreach_log2(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log2, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log2(input, *args, **kwargs) def _foreach_log2_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_log2_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_log2_(input, *args, **kwargs) def _foreach_max(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_max, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_max(input, *args, **kwargs) def _foreach_norm(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_norm, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_norm(input, *args, **kwargs) def _foreach_powsum(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_powsum, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_powsum(input, *args, **kwargs) def _foreach_round(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_round, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_round(input, *args, **kwargs) def _foreach_round_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_round_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_round_(input, *args, **kwargs) def _foreach_sigmoid(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sigmoid, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sigmoid(input, *args, **kwargs) def _foreach_sigmoid_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sigmoid_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sigmoid_(input, *args, **kwargs) def _foreach_sin(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sin, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sin(input, *args, **kwargs) def _foreach_sin_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sin_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sin_(input, *args, **kwargs) def _foreach_sinh(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sinh, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sinh(input, *args, **kwargs) def _foreach_sinh_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_sinh_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_sinh_(input, *args, **kwargs) def _foreach_tan(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_tan, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_tan(input, *args, **kwargs) def _foreach_tan_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_tan_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_tan_(input, *args, **kwargs) def _foreach_tanh(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_tanh, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_tanh(input, *args, **kwargs) def _foreach_tanh_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_tanh_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_tanh_(input, *args, **kwargs) def _foreach_trunc(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_trunc, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_trunc(input, *args, **kwargs) def _foreach_trunc_(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_trunc_, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_trunc_(input, *args, **kwargs) def _foreach_clone(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_clone, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_clone(input, *args, **kwargs) def _foreach_copy(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_copy, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_copy(input, *args, **kwargs) def _foreach_mm(input, *args, **kwargs): if _capturing(): _captured = _capture_call(_foreach_mm, (input, *args), kwargs) if _captured is not None: return _captured return _C._foreach_mm(input, *args, **kwargs) def _convert_indices_from_coo_to_csr(input, size, *, out_int32=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(_convert_indices_from_coo_to_csr, (input, size), {'out_int32': out_int32, 'out': out}) if _captured is not None: return _captured return _C._convert_indices_from_coo_to_csr(self=input, size=size, out_int32=out_int32, out=out) if _capturing(): _captured = _capture_call(_convert_indices_from_coo_to_csr, (input, size), {'out_int32': out_int32}) if _captured is not None: return _captured return _C._convert_indices_from_coo_to_csr(self=input, size=size, out_int32=out_int32) def _convert_indices_from_csr_to_coo(crow_indices, col_indices, *, out_int32=False, transpose=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(_convert_indices_from_csr_to_coo, (crow_indices, col_indices), {'out_int32': out_int32, 'transpose': transpose, 'out': out}) if _captured is not None: return _captured return _C._convert_indices_from_csr_to_coo(crow_indices=crow_indices, col_indices=col_indices, out_int32=out_int32, transpose=transpose, out=out) if _capturing(): _captured = _capture_call(_convert_indices_from_csr_to_coo, (crow_indices, col_indices), {'out_int32': out_int32, 'transpose': transpose}) if _captured is not None: return _captured return _C._convert_indices_from_csr_to_coo(crow_indices=crow_indices, col_indices=col_indices, out_int32=out_int32, transpose=transpose) [docs] def nll_loss_nd(input, target, weight=None, reduction=1, ignore_index=-100): if _capturing(): _captured = _capture_call(nll_loss_nd, (input, target, weight, reduction, ignore_index), {}) if _captured is not None: return _captured return _C.nll_loss_nd(input, target, weight, reduction, ignore_index) [docs] def nll_loss_forward(input, target, weight, reduction, ignore_index, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nll_loss_forward, (input, target, weight, reduction, ignore_index), {'out': out}) if _captured is not None: return _captured return _C.nll_loss_forward(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, out=out) if _capturing(): _captured = _capture_call(nll_loss_forward, (input, target, weight, reduction, ignore_index), {}) if _captured is not None: return _captured return _C.nll_loss_forward(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index) [docs] def nll_loss2d_forward(input, target, weight, reduction, ignore_index, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(nll_loss2d_forward, (input, target, weight, reduction, ignore_index), {'out': out}) if _captured is not None: return _captured return _C.nll_loss2d_forward(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index, out=out) if _capturing(): _captured = _capture_call(nll_loss2d_forward, (input, target, weight, reduction, ignore_index), {}) if _captured is not None: return _captured return _C.nll_loss2d_forward(self=input, target=target, weight=weight, reduction=reduction, ignore_index=ignore_index) def soft_margin_loss_backward(grad_output, input, target, reduction, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(soft_margin_loss_backward, (grad_output, input, target, reduction), {'out': out}) if _captured is not None: return _captured return _C.soft_margin_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction, out=out) if _capturing(): _captured = _capture_call(soft_margin_loss_backward, (grad_output, input, target, reduction), {}) if _captured is not None: return _captured return _C.soft_margin_loss_backward(grad_output=grad_output, self=input, target=target, reduction=reduction) [docs] def glu_jvp(glu, x, dx, dim): if _capturing(): _captured = _capture_call(glu_jvp, (glu, x, dx, dim), {}) if _captured is not None: return _captured return _C.glu_jvp(glu, x, dx, dim) [docs] def glu_backward_jvp(grad_x, grad_glu, x, dgrad_glu, dx, dim): if _capturing(): _captured = _capture_call(glu_backward_jvp, (grad_x, grad_glu, x, dgrad_glu, dx, dim), {}) if _captured is not None: return _captured return _C.glu_backward_jvp(grad_x, grad_glu, x, dgrad_glu, dx, dim) [docs] def log_sigmoid_forward(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(log_sigmoid_forward, (input,), {'out': out}) if _captured is not None: return _captured return _C.log_sigmoid_forward(self=input, out=out) if _capturing(): _captured = _capture_call(log_sigmoid_forward, (input,), {}) if _captured is not None: return _captured return _C.log_sigmoid_forward(self=input) [docs] def rrelu_with_noise_(input, noise, lower=0.125, upper=0.3333333333333333, training=False, generator=None): if _capturing(): _captured = _capture_call(rrelu_with_noise_, (input, noise, lower, upper, training, generator), {}) if _captured is not None: return _captured if not isinstance(lower, (tensorplay.Scalar, tensorplay.Tensor)): lower = tensorplay.Scalar(lower) if not isinstance(upper, (tensorplay.Scalar, tensorplay.Tensor)): upper = tensorplay.Scalar(upper) return _C.rrelu_with_noise_(input, noise, lower, upper, training, generator) [docs] def mkldnn_adaptive_avg_pool2d(input, output_size, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(mkldnn_adaptive_avg_pool2d, (input, output_size), {'out': out}) if _captured is not None: return _captured return _C.mkldnn_adaptive_avg_pool2d(self=input, output_size=output_size, out=out) if _capturing(): _captured = _capture_call(mkldnn_adaptive_avg_pool2d, (input, output_size), {}) if _captured is not None: return _captured return _C.mkldnn_adaptive_avg_pool2d(self=input, output_size=output_size) def mkldnn_adaptive_avg_pool2d_backward(grad_output, input): if _capturing(): _captured = _capture_call(mkldnn_adaptive_avg_pool2d_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C.mkldnn_adaptive_avg_pool2d_backward(grad_output, input) def _adaptive_avg_pool2d(input, output_size): if _capturing(): _captured = _capture_call(_adaptive_avg_pool2d, (input, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C._adaptive_avg_pool2d(input, output_size) def _adaptive_avg_pool2d_backward(grad_output, input): if _capturing(): _captured = _capture_call(_adaptive_avg_pool2d_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C._adaptive_avg_pool2d_backward(grad_output, input) def _adaptive_avg_pool3d(input, output_size): if _capturing(): _captured = _capture_call(_adaptive_avg_pool3d, (input, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C._adaptive_avg_pool3d(input, output_size) def _adaptive_avg_pool3d_backward(grad_output, input): if _capturing(): _captured = _capture_call(_adaptive_avg_pool3d_backward, (grad_output, input), {}) if _captured is not None: return _captured return _C._adaptive_avg_pool3d_backward(grad_output, input) [docs] def reflection_pad1d(input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(reflection_pad1d, (input, padding), {'out': out}) if _captured is not None: return _captured return _C.reflection_pad1d(self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(reflection_pad1d, (input, padding), {}) if _captured is not None: return _captured return _C.reflection_pad1d(self=input, padding=padding) def reflection_pad1d_backward(grad_output, input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(reflection_pad1d_backward, (grad_output, input, padding), {'out': out}) if _captured is not None: return _captured return _C.reflection_pad1d_backward(grad_output=grad_output, self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(reflection_pad1d_backward, (grad_output, input, padding), {}) if _captured is not None: return _captured return _C.reflection_pad1d_backward(grad_output=grad_output, self=input, padding=padding) [docs] def reflection_pad2d(input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(reflection_pad2d, (input, padding), {'out': out}) if _captured is not None: return _captured return _C.reflection_pad2d(self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(reflection_pad2d, (input, padding), {}) if _captured is not None: return _captured return _C.reflection_pad2d(self=input, padding=padding) def reflection_pad2d_backward(grad_output, input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(reflection_pad2d_backward, (grad_output, input, padding), {'out': out}) if _captured is not None: return _captured return _C.reflection_pad2d_backward(grad_output=grad_output, self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(reflection_pad2d_backward, (grad_output, input, padding), {}) if _captured is not None: return _captured return _C.reflection_pad2d_backward(grad_output=grad_output, self=input, padding=padding) [docs] def reflection_pad3d(input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(reflection_pad3d, (input, padding), {'out': out}) if _captured is not None: return _captured return _C.reflection_pad3d(self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(reflection_pad3d, (input, padding), {}) if _captured is not None: return _captured return _C.reflection_pad3d(self=input, padding=padding) def reflection_pad3d_backward(grad_output, input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(reflection_pad3d_backward, (grad_output, input, padding), {'out': out}) if _captured is not None: return _captured return _C.reflection_pad3d_backward(grad_output=grad_output, self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(reflection_pad3d_backward, (grad_output, input, padding), {}) if _captured is not None: return _captured return _C.reflection_pad3d_backward(grad_output=grad_output, self=input, padding=padding) [docs] def replication_pad1d(input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(replication_pad1d, (input, padding), {'out': out}) if _captured is not None: return _captured return _C.replication_pad1d(self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(replication_pad1d, (input, padding), {}) if _captured is not None: return _captured return _C.replication_pad1d(self=input, padding=padding) def replication_pad1d_backward(grad_output, input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(replication_pad1d_backward, (grad_output, input, padding), {'out': out}) if _captured is not None: return _captured return _C.replication_pad1d_backward(grad_output=grad_output, self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(replication_pad1d_backward, (grad_output, input, padding), {}) if _captured is not None: return _captured return _C.replication_pad1d_backward(grad_output=grad_output, self=input, padding=padding) [docs] def replication_pad2d(input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(replication_pad2d, (input, padding), {'out': out}) if _captured is not None: return _captured return _C.replication_pad2d(self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(replication_pad2d, (input, padding), {}) if _captured is not None: return _captured return _C.replication_pad2d(self=input, padding=padding) def replication_pad2d_backward(grad_output, input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(replication_pad2d_backward, (grad_output, input, padding), {'out': out}) if _captured is not None: return _captured return _C.replication_pad2d_backward(grad_output=grad_output, self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(replication_pad2d_backward, (grad_output, input, padding), {}) if _captured is not None: return _captured return _C.replication_pad2d_backward(grad_output=grad_output, self=input, padding=padding) [docs] def replication_pad3d(input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(replication_pad3d, (input, padding), {'out': out}) if _captured is not None: return _captured return _C.replication_pad3d(self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(replication_pad3d, (input, padding), {}) if _captured is not None: return _captured return _C.replication_pad3d(self=input, padding=padding) def replication_pad3d_backward(grad_output, input, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(replication_pad3d_backward, (grad_output, input, padding), {'out': out}) if _captured is not None: return _captured return _C.replication_pad3d_backward(grad_output=grad_output, self=input, padding=padding, out=out) if _capturing(): _captured = _capture_call(replication_pad3d_backward, (grad_output, input, padding), {}) if _captured is not None: return _captured return _C.replication_pad3d_backward(grad_output=grad_output, self=input, padding=padding) def _pad_circular(input, pad): if _capturing(): _captured = _capture_call(_pad_circular, (input, pad), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C._pad_circular(input, pad) def _pad_enum(input, pad, mode, value=None): if _capturing(): _captured = _capture_call(_pad_enum, (input, pad, mode, value), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C._pad_enum(input, pad, mode, value) [docs] def pad(input, pad, mode='constant', value=None): if _capturing(): _captured = _capture_call(pad, (input, pad, mode, value), {}) if _captured is not None: return _captured if isinstance(pad, int) and not isinstance(pad, bool): pad = [pad] return _C.pad(input, pad, mode, value) def _upsample_bilinear2d_aa(input, output_size, align_corners, scale_factors, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_bilinear2d_aa, (input, output_size, align_corners, scale_factors), {'out': out}) if _captured is not None: return _captured return _C._upsample_bilinear2d_aa(input, output_size, align_corners, scale_factors, out=out) if _capturing(): _captured = _capture_call(_upsample_bilinear2d_aa, (input, output_size, align_corners, scale_factors), {}) if _captured is not None: return _captured return _C._upsample_bilinear2d_aa(input, output_size, align_corners, scale_factors) def _upsample_bicubic2d_aa(input, output_size, align_corners, scale_factors, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_bicubic2d_aa, (input, output_size, align_corners, scale_factors), {'out': out}) if _captured is not None: return _captured return _C._upsample_bicubic2d_aa(input, output_size, align_corners, scale_factors, out=out) if _capturing(): _captured = _capture_call(_upsample_bicubic2d_aa, (input, output_size, align_corners, scale_factors), {}) if _captured is not None: return _captured return _C._upsample_bicubic2d_aa(input, output_size, align_corners, scale_factors) def _upsample_lanczos2d_aa(input, output_size, align_corners, scale_factors, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_lanczos2d_aa, (input, output_size, align_corners, scale_factors), {'out': out}) if _captured is not None: return _captured return _C._upsample_lanczos2d_aa(input, output_size, align_corners, scale_factors, out=out) if _capturing(): _captured = _capture_call(_upsample_lanczos2d_aa, (input, output_size, align_corners, scale_factors), {}) if _captured is not None: return _captured return _C._upsample_lanczos2d_aa(input, output_size, align_corners, scale_factors) def _upsample_nearest_exact1d(input, output_size, scale_factors, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_nearest_exact1d, (input, output_size, scale_factors), {'out': out}) if _captured is not None: return _captured return _C._upsample_nearest_exact1d(input, output_size, scale_factors, out=out) if _capturing(): _captured = _capture_call(_upsample_nearest_exact1d, (input, output_size, scale_factors), {}) if _captured is not None: return _captured return _C._upsample_nearest_exact1d(input, output_size, scale_factors) def _upsample_nearest_exact2d(input, output_size, scale_factors, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_nearest_exact2d, (input, output_size, scale_factors), {'out': out}) if _captured is not None: return _captured return _C._upsample_nearest_exact2d(input, output_size, scale_factors, out=out) if _capturing(): _captured = _capture_call(_upsample_nearest_exact2d, (input, output_size, scale_factors), {}) if _captured is not None: return _captured return _C._upsample_nearest_exact2d(input, output_size, scale_factors) def _upsample_nearest_exact3d(input, output_size, scale_factors, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_nearest_exact3d, (input, output_size, scale_factors), {'out': out}) if _captured is not None: return _captured return _C._upsample_nearest_exact3d(input, output_size, scale_factors, out=out) if _capturing(): _captured = _capture_call(_upsample_nearest_exact3d, (input, output_size, scale_factors), {}) if _captured is not None: return _captured return _C._upsample_nearest_exact3d(input, output_size, scale_factors) def _upsample_bilinear2d_aa_backward(grad_output, output_size, input_size, align_corners, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_bilinear2d_aa_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C._upsample_bilinear2d_aa_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(_upsample_bilinear2d_aa_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {}) if _captured is not None: return _captured return _C._upsample_bilinear2d_aa_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w) def _upsample_bicubic2d_aa_backward(grad_output, output_size, input_size, align_corners, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_bicubic2d_aa_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C._upsample_bicubic2d_aa_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(_upsample_bicubic2d_aa_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {}) if _captured is not None: return _captured return _C._upsample_bicubic2d_aa_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w) def _upsample_lanczos2d_aa_backward(grad_output, output_size, input_size, align_corners, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_lanczos2d_aa_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C._upsample_lanczos2d_aa_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(_upsample_lanczos2d_aa_backward, (grad_output, output_size, input_size, align_corners, scales_h, scales_w), {}) if _captured is not None: return _captured return _C._upsample_lanczos2d_aa_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, align_corners=align_corners, scales_h=scales_h, scales_w=scales_w) def _upsample_nearest_exact1d_backward(grad_output, output_size, input_size, scales=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_nearest_exact1d_backward, (grad_output, output_size, input_size, scales), {'out': out}) if _captured is not None: return _captured return _C._upsample_nearest_exact1d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales=scales, out=out) if _capturing(): _captured = _capture_call(_upsample_nearest_exact1d_backward, (grad_output, output_size, input_size, scales), {}) if _captured is not None: return _captured return _C._upsample_nearest_exact1d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales=scales) def _upsample_nearest_exact2d_backward(grad_output, output_size, input_size, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_nearest_exact2d_backward, (grad_output, output_size, input_size, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C._upsample_nearest_exact2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(_upsample_nearest_exact2d_backward, (grad_output, output_size, input_size, scales_h, scales_w), {}) if _captured is not None: return _captured return _C._upsample_nearest_exact2d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_h=scales_h, scales_w=scales_w) def _upsample_nearest_exact3d_backward(grad_output, output_size, input_size, scales_d=None, scales_h=None, scales_w=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_upsample_nearest_exact3d_backward, (grad_output, output_size, input_size, scales_d, scales_h, scales_w), {'out': out}) if _captured is not None: return _captured return _C._upsample_nearest_exact3d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_d=scales_d, scales_h=scales_h, scales_w=scales_w, out=out) if _capturing(): _captured = _capture_call(_upsample_nearest_exact3d_backward, (grad_output, output_size, input_size, scales_d, scales_h, scales_w), {}) if _captured is not None: return _captured return _C._upsample_nearest_exact3d_backward(grad_output=grad_output, output_size=output_size, input_size=input_size, scales_d=scales_d, scales_h=scales_h, scales_w=scales_w) [docs] def slow_conv_transpose2d(input, weight, kernel_size, bias=None, stride=1, padding=0, output_padding=0, dilation=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(slow_conv_transpose2d, (input, weight, kernel_size, bias, stride, padding, output_padding, dilation), {'out': out}) if _captured is not None: return _captured return _C.slow_conv_transpose2d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, output_padding=output_padding, dilation=dilation, out=out) if _capturing(): _captured = _capture_call(slow_conv_transpose2d, (input, weight, kernel_size, bias, stride, padding, output_padding, dilation), {}) if _captured is not None: return _captured return _C.slow_conv_transpose2d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, output_padding=output_padding, dilation=dilation) [docs] def slow_conv_transpose3d(input, weight, kernel_size, bias=None, stride=1, padding=0, output_padding=0, dilation=1, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(slow_conv_transpose3d, (input, weight, kernel_size, bias, stride, padding, output_padding, dilation), {'out': out}) if _captured is not None: return _captured return _C.slow_conv_transpose3d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, output_padding=output_padding, dilation=dilation, out=out) if _capturing(): _captured = _capture_call(slow_conv_transpose3d, (input, weight, kernel_size, bias, stride, padding, output_padding, dilation), {}) if _captured is not None: return _captured return _C.slow_conv_transpose3d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, output_padding=output_padding, dilation=dilation) [docs] def thnn_conv2d(input, weight, kernel_size, bias=None, stride=1, padding=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(thnn_conv2d, (input, weight, kernel_size, bias, stride, padding), {'out': out}) if _captured is not None: return _captured return _C.thnn_conv2d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, out=out) if _capturing(): _captured = _capture_call(thnn_conv2d, (input, weight, kernel_size, bias, stride, padding), {}) if _captured is not None: return _captured return _C.thnn_conv2d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding) def _slow_conv2d_forward(input, weight, kernel_size, bias, stride, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_slow_conv2d_forward, (input, weight, kernel_size, bias, stride, padding), {'out': out}) if _captured is not None: return _captured return _C._slow_conv2d_forward(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, out=out) if _capturing(): _captured = _capture_call(_slow_conv2d_forward, (input, weight, kernel_size, bias, stride, padding), {}) if _captured is not None: return _captured return _C._slow_conv2d_forward(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding) def _slow_conv2d_backward(grad_output, input, weight, kernel_size, stride, padding, output_mask, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_slow_conv2d_backward, (grad_output, input, weight, kernel_size, stride, padding, output_mask), {'out': out}) if _captured is not None: return _captured return _C._slow_conv2d_backward(grad_output=grad_output, self=input, weight=weight, kernel_size=kernel_size, stride=stride, padding=padding, output_mask=output_mask, out=out) if _capturing(): _captured = _capture_call(_slow_conv2d_backward, (grad_output, input, weight, kernel_size, stride, padding, output_mask), {}) if _captured is not None: return _captured return _C._slow_conv2d_backward(grad_output=grad_output, self=input, weight=weight, kernel_size=kernel_size, stride=stride, padding=padding, output_mask=output_mask) def _conv_depthwise2d(input, weight, kernel_size, bias, stride, padding, dilation, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_conv_depthwise2d, (input, weight, kernel_size, bias, stride, padding, dilation), {'out': out}) if _captured is not None: return _captured return _C._conv_depthwise2d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, dilation=dilation, out=out) if _capturing(): _captured = _capture_call(_conv_depthwise2d, (input, weight, kernel_size, bias, stride, padding, dilation), {}) if _captured is not None: return _captured return _C._conv_depthwise2d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, dilation=dilation) [docs] def conv_depthwise3d(input, weight, kernel_size, bias, stride, padding, dilation): if _capturing(): _captured = _capture_call(conv_depthwise3d, (input, weight, kernel_size, bias, stride, padding, dilation), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.conv_depthwise3d(input, weight, kernel_size, bias, stride, padding, dilation) [docs] def slow_conv3d(input, weight, kernel_size, bias=None, stride=1, padding=0, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(slow_conv3d, (input, weight, kernel_size, bias, stride, padding), {'out': out}) if _captured is not None: return _captured return _C.slow_conv3d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, out=out) if _capturing(): _captured = _capture_call(slow_conv3d, (input, weight, kernel_size, bias, stride, padding), {}) if _captured is not None: return _captured return _C.slow_conv3d(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding) [docs] def slow_conv3d_forward(input, weight, kernel_size, bias, stride, padding, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(slow_conv3d_forward, (input, weight, kernel_size, bias, stride, padding), {'out': out}) if _captured is not None: return _captured return _C.slow_conv3d_forward(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding, out=out) if _capturing(): _captured = _capture_call(slow_conv3d_forward, (input, weight, kernel_size, bias, stride, padding), {}) if _captured is not None: return _captured return _C.slow_conv3d_forward(self=input, weight=weight, kernel_size=kernel_size, bias=bias, stride=stride, padding=padding) [docs] def slow_conv_dilated2d(input, weight, kernel_size, bias=None, stride=1, padding=0, dilation=1): if _capturing(): _captured = _capture_call(slow_conv_dilated2d, (input, weight, kernel_size, bias, stride, padding, dilation), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.slow_conv_dilated2d(input, weight, kernel_size, bias, stride, padding, dilation) [docs] def slow_conv_dilated3d(input, weight, kernel_size, bias=None, stride=1, padding=0, dilation=1): if _capturing(): _captured = _capture_call(slow_conv_dilated3d, (input, weight, kernel_size, bias, stride, padding, dilation), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C.slow_conv_dilated3d(input, weight, kernel_size, bias, stride, padding, dilation) def _add_batch_dim(input, batch_dim, level): if _capturing(): _captured = _capture_call(_add_batch_dim, (input, batch_dim, level), {}) if _captured is not None: return _captured return _C._add_batch_dim(input, batch_dim, level) def _remove_batch_dim(input, level, batch_size, out_dim): if _capturing(): _captured = _capture_call(_remove_batch_dim, (input, level, batch_size, out_dim), {}) if _captured is not None: return _captured return _C._remove_batch_dim(input, level, batch_size, out_dim) [docs] def special_entr(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_entr, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_entr(self=input, out=out) if _capturing(): _captured = _capture_call(special_entr, (input,), {}) if _captured is not None: return _captured return _C.special_entr(self=input) [docs] def special_ndtri(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_ndtri, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_ndtri(self=input, out=out) if _capturing(): _captured = _capture_call(special_ndtri, (input,), {}) if _captured is not None: return _captured return _C.special_ndtri(self=input) [docs] def special_log_ndtr(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_log_ndtr, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_log_ndtr(self=input, out=out) if _capturing(): _captured = _capture_call(special_log_ndtr, (input,), {}) if _captured is not None: return _captured return _C.special_log_ndtr(self=input) [docs] def special_expm1(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_expm1, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_expm1(self=input, out=out) if _capturing(): _captured = _capture_call(special_expm1, (input,), {}) if _captured is not None: return _captured return _C.special_expm1(self=input) [docs] def special_exp2(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_exp2, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_exp2(self=input, out=out) if _capturing(): _captured = _capture_call(special_exp2, (input,), {}) if _captured is not None: return _captured return _C.special_exp2(self=input) [docs] def special_psi(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_psi, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_psi(self=input, out=out) if _capturing(): _captured = _capture_call(special_psi, (input,), {}) if _captured is not None: return _captured return _C.special_psi(self=input) [docs] def special_digamma(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_digamma, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_digamma(self=input, out=out) if _capturing(): _captured = _capture_call(special_digamma, (input,), {}) if _captured is not None: return _captured return _C.special_digamma(self=input) [docs] def special_gammaln(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_gammaln, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_gammaln(self=input, out=out) if _capturing(): _captured = _capture_call(special_gammaln, (input,), {}) if _captured is not None: return _captured return _C.special_gammaln(self=input) [docs] def special_erf(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_erf, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_erf(self=input, out=out) if _capturing(): _captured = _capture_call(special_erf, (input,), {}) if _captured is not None: return _captured return _C.special_erf(self=input) [docs] def special_erfc(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_erfc, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_erfc(self=input, out=out) if _capturing(): _captured = _capture_call(special_erfc, (input,), {}) if _captured is not None: return _captured return _C.special_erfc(self=input) [docs] def special_erfcx(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_erfcx, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_erfcx(self=input, out=out) if _capturing(): _captured = _capture_call(special_erfcx, (input,), {}) if _captured is not None: return _captured return _C.special_erfcx(self=input) [docs] def special_erfinv(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_erfinv, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_erfinv(self=input, out=out) if _capturing(): _captured = _capture_call(special_erfinv, (input,), {}) if _captured is not None: return _captured return _C.special_erfinv(self=input) [docs] def special_ndtr(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_ndtr, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_ndtr(self=input, out=out) if _capturing(): _captured = _capture_call(special_ndtr, (input,), {}) if _captured is not None: return _captured return _C.special_ndtr(self=input) [docs] def special_xlog1py(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_xlog1py, (input, other), {'out': out}) if _captured is not None: return _captured return _C.special_xlog1py(input, other, out=out) if _capturing(): _captured = _capture_call(special_xlog1py, (input, other), {}) if _captured is not None: return _captured return _C.special_xlog1py(input, other) [docs] def special_xlogy(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_xlogy, (input, other), {'out': out}) if _captured is not None: return _captured return _C.special_xlogy(input, other, out=out) if _capturing(): _captured = _capture_call(special_xlogy, (input, other), {}) if _captured is not None: return _captured return _C.special_xlogy(input, other) [docs] def special_zeta(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_zeta, (input, other), {'out': out}) if _captured is not None: return _captured return _C.special_zeta(input, other, out=out) if _capturing(): _captured = _capture_call(special_zeta, (input, other), {}) if _captured is not None: return _captured return _C.special_zeta(input, other) [docs] def special_i0(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_i0, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_i0(self=input, out=out) if _capturing(): _captured = _capture_call(special_i0, (input,), {}) if _captured is not None: return _captured return _C.special_i0(self=input) [docs] def special_i0e(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_i0e, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_i0e(self=input, out=out) if _capturing(): _captured = _capture_call(special_i0e, (input,), {}) if _captured is not None: return _captured return _C.special_i0e(self=input) [docs] def special_i1(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_i1, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_i1(self=input, out=out) if _capturing(): _captured = _capture_call(special_i1, (input,), {}) if _captured is not None: return _captured return _C.special_i1(self=input) [docs] def special_i1e(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_i1e, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_i1e(self=input, out=out) if _capturing(): _captured = _capture_call(special_i1e, (input,), {}) if _captured is not None: return _captured return _C.special_i1e(self=input) [docs] def special_logit(input, eps=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_logit, (input, eps), {'out': out}) if _captured is not None: return _captured return _C.special_logit(self=input, eps=eps, out=out) if _capturing(): _captured = _capture_call(special_logit, (input, eps), {}) if _captured is not None: return _captured return _C.special_logit(self=input, eps=eps) [docs] def special_polygamma(n, input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_polygamma, (n, input), {'out': out}) if _captured is not None: return _captured return _C.special_polygamma(n=n, self=input, out=out) if _capturing(): _captured = _capture_call(special_polygamma, (n, input), {}) if _captured is not None: return _captured return _C.special_polygamma(n=n, self=input) [docs] def special_logsumexp(input, dim, keepdim=False, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_logsumexp, (input, dim, keepdim), {'out': out}) if _captured is not None: return _captured return _C.special_logsumexp(self=input, dim=dim, keepdim=keepdim, out=out) if _capturing(): _captured = _capture_call(special_logsumexp, (input, dim, keepdim), {}) if _captured is not None: return _captured return _C.special_logsumexp(self=input, dim=dim, keepdim=keepdim) [docs] def special_expit(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_expit, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_expit(self=input, out=out) if _capturing(): _captured = _capture_call(special_expit, (input,), {}) if _captured is not None: return _captured return _C.special_expit(self=input) [docs] def special_sinc(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_sinc, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_sinc(self=input, out=out) if _capturing(): _captured = _capture_call(special_sinc, (input,), {}) if _captured is not None: return _captured return _C.special_sinc(self=input) [docs] def special_round(input, *, decimals=0, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_round, (input,), {'decimals': decimals, 'out': out}) if _captured is not None: return _captured return _C.special_round(self=input, decimals=decimals, out=out) if _capturing(): _captured = _capture_call(special_round, (input,), {'decimals': decimals}) if _captured is not None: return _captured return _C.special_round(self=input, decimals=decimals) [docs] def special_log1p(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_log1p, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_log1p(self=input, out=out) if _capturing(): _captured = _capture_call(special_log1p, (input,), {}) if _captured is not None: return _captured return _C.special_log1p(self=input) [docs] def special_log_softmax(input, dim, dtype=None): if _capturing(): _captured = _capture_call(special_log_softmax, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.special_log_softmax(input, dim, dtype=dtype) [docs] def special_gammainc(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_gammainc, (input, other), {'out': out}) if _captured is not None: return _captured return _C.special_gammainc(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(special_gammainc, (input, other), {}) if _captured is not None: return _captured return _C.special_gammainc(self=input, other=other) [docs] def special_gammaincc(input, other, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_gammaincc, (input, other), {'out': out}) if _captured is not None: return _captured return _C.special_gammaincc(self=input, other=other, out=out) if _capturing(): _captured = _capture_call(special_gammaincc, (input, other), {}) if _captured is not None: return _captured return _C.special_gammaincc(self=input, other=other) [docs] def special_multigammaln(input, p, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_multigammaln, (input, p), {'out': out}) if _captured is not None: return _captured return _C.special_multigammaln(self=input, p=p, out=out) if _capturing(): _captured = _capture_call(special_multigammaln, (input, p), {}) if _captured is not None: return _captured return _C.special_multigammaln(self=input, p=p) [docs] def special_softmax(input, dim, dtype=None): if _capturing(): _captured = _capture_call(special_softmax, (input, dim, dtype), {}) if _captured is not None: return _captured return _C.special_softmax(input, dim, dtype) [docs] def fft_hfft(input, n=None, dim=-1, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_hfft, (input, n, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_hfft(self=input, n=n, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_hfft, (input, n, dim, norm), {}) if _captured is not None: return _captured return _C.fft_hfft(self=input, n=n, dim=dim, norm=norm) [docs] def fft_ihfft(input, n=None, dim=-1, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_ihfft, (input, n, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_ihfft(self=input, n=n, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_ihfft, (input, n, dim, norm), {}) if _captured is not None: return _captured return _C.fft_ihfft(self=input, n=n, dim=dim, norm=norm) [docs] def fft_hfft2(input, s=None, dim=[-2,-1], norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_hfft2, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_hfft2(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_hfft2, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_hfft2(self=input, s=s, dim=dim, norm=norm) [docs] def fft_ihfft2(input, s=None, dim=[-2,-1], norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_ihfft2, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_ihfft2(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_ihfft2, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_ihfft2(self=input, s=s, dim=dim, norm=norm) [docs] def fft_fftn(input, s=None, dim=None, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_fftn, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_fftn(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_fftn, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_fftn(self=input, s=s, dim=dim, norm=norm) [docs] def fft_ifftn(input, s=None, dim=None, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_ifftn, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_ifftn(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_ifftn, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_ifftn(self=input, s=s, dim=dim, norm=norm) [docs] def fft_rfftn(input, s=None, dim=None, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_rfftn, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_rfftn(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_rfftn, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_rfftn(self=input, s=s, dim=dim, norm=norm) [docs] def fft_irfftn(input, s=None, dim=None, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_irfftn, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_irfftn(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_irfftn, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_irfftn(self=input, s=s, dim=dim, norm=norm) [docs] def fft_hfftn(input, s=None, dim=None, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_hfftn, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_hfftn(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_hfftn, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_hfftn(self=input, s=s, dim=dim, norm=norm) [docs] def fft_ihfftn(input, s=None, dim=None, norm=None, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_ihfftn, (input, s, dim, norm), {'out': out}) if _captured is not None: return _captured return _C.fft_ihfftn(self=input, s=s, dim=dim, norm=norm, out=out) if _capturing(): _captured = _capture_call(fft_ihfftn, (input, s, dim, norm), {}) if _captured is not None: return _captured return _C.fft_ihfftn(self=input, s=s, dim=dim, norm=norm) [docs] def fft_fftfreq(n, d=1.0, *, dtype=None, layout=None, device=None, pin_memory=None, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_fftfreq, (n, d), {'out': out}) if _captured is not None: return _captured return _C.fft_fftfreq(n, d, out=out) if _capturing(): _captured = _capture_call(fft_fftfreq, (n, d), {'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured return _C.fft_fftfreq(n=n, d=d, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory) [docs] def fft_rfftfreq(n, d=1.0, *, dtype=None, layout=None, device=None, pin_memory=None, out=None): if out is not None: if _capturing(): _captured = _capture_call(fft_rfftfreq, (n, d), {'out': out}) if _captured is not None: return _captured return _C.fft_rfftfreq(n, d, out=out) if _capturing(): _captured = _capture_call(fft_rfftfreq, (n, d), {'dtype': dtype, 'layout': layout, 'device': device, 'pin_memory': pin_memory}) if _captured is not None: return _captured return _C.fft_rfftfreq(n=n, d=d, dtype=dtype, layout=layout, device=device, pin_memory=pin_memory) [docs] def fft_fftshift(input, dim=None): if _capturing(): _captured = _capture_call(fft_fftshift, (input, dim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.fft_fftshift(input, dim) [docs] def fft_ifftshift(input, dim=None): if _capturing(): _captured = _capture_call(fft_ifftshift, (input, dim), {}) if _captured is not None: return _captured if isinstance(dim, int) and not isinstance(dim, bool): dim = [dim] return _C.fft_ifftshift(input, dim) def _linalg_det(A, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_linalg_det, (A,), {'out': out}) if _captured is not None: return _captured return _C._linalg_det(A=A, out=out) if _capturing(): _captured = _capture_call(_linalg_det, (A,), {}) if _captured is not None: return _captured return _C._linalg_det(A=A) [docs] def det(input): if _capturing(): _captured = _capture_call(det, (input,), {}) if _captured is not None: return _captured return _C.det(input) def _linalg_slogdet(A, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_linalg_slogdet, (A,), {'out': out}) if _captured is not None: return _captured return _C._linalg_slogdet(A=A, out=out) if _capturing(): _captured = _capture_call(_linalg_slogdet, (A,), {}) if _captured is not None: return _captured return _C._linalg_slogdet(A=A) [docs] def slogdet(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(slogdet, (input,), {'out': out}) if _captured is not None: return _captured return _C.slogdet(self=input, out=out) if _capturing(): _captured = _capture_call(slogdet, (input,), {}) if _captured is not None: return _captured return _C.slogdet(self=input) [docs] def logdet(input): if _capturing(): _captured = _capture_call(logdet, (input,), {}) if _captured is not None: return _captured return _C.logdet(input) def _linalg_eigvals(input): if _capturing(): _captured = _capture_call(_linalg_eigvals, (input,), {}) if _captured is not None: return _captured return _C._linalg_eigvals(input) def _linalg_eigh(A, UPLO='L', compute_v=True, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(_linalg_eigh, (A, UPLO, compute_v), {'out': out}) if _captured is not None: return _captured return _C._linalg_eigh(A=A, UPLO=UPLO, compute_v=compute_v, out=out) if _capturing(): _captured = _capture_call(_linalg_eigh, (A, UPLO, compute_v), {}) if _captured is not None: return _captured return _C._linalg_eigh(A=A, UPLO=UPLO, compute_v=compute_v) [docs] def inverse(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(inverse, (input,), {'out': out}) if _captured is not None: return _captured return _C.inverse(self=input, out=out) if _capturing(): _captured = _capture_call(inverse, (input,), {}) if _captured is not None: return _captured return _C.inverse(self=input) def _linalg_svd(A, full_matrices=False, compute_uv=True, *, driver=None, out=None): if out is not None: if _capturing(): _captured = _capture_call(_linalg_svd, (A, full_matrices, compute_uv), {'driver': driver, 'out': out}) if _captured is not None: return _captured return _C._linalg_svd(A=A, full_matrices=full_matrices, compute_uv=compute_uv, driver=driver, out=out) if _capturing(): _captured = _capture_call(_linalg_svd, (A, full_matrices, compute_uv), {'driver': driver}) if _captured is not None: return _captured return _C._linalg_svd(A=A, full_matrices=full_matrices, compute_uv=compute_uv, driver=driver) def _linalg_solve_ex(A, B, *, left=True, check_errors=False, out=None): if out is not None: if _capturing(): _captured = _capture_call(_linalg_solve_ex, (A, B), {'left': left, 'check_errors': check_errors, 'out': out}) if _captured is not None: return _captured return _C._linalg_solve_ex(A=A, B=B, left=left, check_errors=check_errors, out=out) if _capturing(): _captured = _capture_call(_linalg_solve_ex, (A, B), {'left': left, 'check_errors': check_errors}) if _captured is not None: return _captured return _C._linalg_solve_ex(A=A, B=B, left=left, check_errors=check_errors) def _spsolve(A, B, left=True): if _capturing(): _captured = _capture_call(_spsolve, (A, B, left), {}) if _captured is not None: return _captured return _C._spsolve(A, B, left=left) [docs] def nested_to_padded_tensor(input, padding, output_size=None): if _capturing(): _captured = _capture_call(nested_to_padded_tensor, (input, padding, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.nested_to_padded_tensor(input, padding, output_size) def _test_serialization_subcmul(input, other, alpha=1): if _capturing(): _captured = _capture_call(_test_serialization_subcmul, (input, other, alpha), {}) if _captured is not None: return _captured if not isinstance(alpha, (tensorplay.Scalar, tensorplay.Tensor)): alpha = tensorplay.Scalar(alpha) return _C._test_serialization_subcmul(input, other, alpha) def _test_parallel_materialize(input, num_parallel, skip_first=False): if _capturing(): _captured = _capture_call(_test_parallel_materialize, (input, num_parallel, skip_first), {}) if _captured is not None: return _captured return _C._test_parallel_materialize(input, num_parallel, skip_first) def _test_optional_intlist(values, addends): if _capturing(): _captured = _capture_call(_test_optional_intlist, (values, addends), {}) if _captured is not None: return _captured if isinstance(addends, int) and not isinstance(addends, bool): addends = [addends] return _C._test_optional_intlist(values, addends) def _test_optional_filled_intlist(values, addends): if _capturing(): _captured = _capture_call(_test_optional_filled_intlist, (values, addends), {}) if _captured is not None: return _captured if isinstance(addends, int) and not isinstance(addends, bool): addends = [addends] return _C._test_optional_filled_intlist(values, addends) def _test_optional_floatlist(values, addends): if _capturing(): _captured = _capture_call(_test_optional_floatlist, (values, addends), {}) if _captured is not None: return _captured return _C._test_optional_floatlist(values, addends) def _test_string_default(dummy, a='"\'\\', b='"\'\\'): if _capturing(): _captured = _capture_call(_test_string_default, (dummy, a, b), {}) if _captured is not None: return _captured return _C._test_string_default(dummy, a, b) def _test_ambiguous_defaults(dummy, a=1, b=1): if _capturing(): _captured = _capture_call(_test_ambiguous_defaults, (dummy, a, b), {}) if _captured is not None: return _captured return _C._test_ambiguous_defaults(dummy, a, b) def _test_warn_in_autograd(input): if _capturing(): _captured = _capture_call(_test_warn_in_autograd, (input,), {}) if _captured is not None: return _captured return _C._test_warn_in_autograd(input) def _test_autograd_multiple_dispatch(input): if _capturing(): _captured = _capture_call(_test_autograd_multiple_dispatch, (input,), {}) if _captured is not None: return _captured return _C._test_autograd_multiple_dispatch(input) def _test_autograd_multiple_dispatch_view(input): if _capturing(): _captured = _capture_call(_test_autograd_multiple_dispatch_view, (input,), {}) if _captured is not None: return _captured return _C._test_autograd_multiple_dispatch_view(input) def _test_autograd_multiple_dispatch_view_copy(input): if _capturing(): _captured = _capture_call(_test_autograd_multiple_dispatch_view_copy, (input,), {}) if _captured is not None: return _captured return _C._test_autograd_multiple_dispatch_view_copy(input) [docs] def segment_reduce(data, reduce, lengths=None, indices=None, offsets=None, axis=0, unsafe=False, initial=None): if _capturing(): _captured = _capture_call(segment_reduce, (data, reduce, lengths, indices, offsets, axis, unsafe, initial), {}) if _captured is not None: return _captured if initial is not None and not isinstance(initial, (tensorplay.Scalar, tensorplay.Tensor)): initial = tensorplay.Scalar(initial) return _C.segment_reduce(data, reduce, lengths=lengths, indices=indices, offsets=offsets, axis=axis, unsafe=unsafe, initial=initial) def _segment_reduce_backward(grad_output, output, data, reduce, lengths=None, offsets=None, axis=0, initial=None): if _capturing(): _captured = _capture_call(_segment_reduce_backward, (grad_output, output, data, reduce, lengths, offsets, axis, initial), {}) if _captured is not None: return _captured if initial is not None and not isinstance(initial, (tensorplay.Scalar, tensorplay.Tensor)): initial = tensorplay.Scalar(initial) return _C._segment_reduce_backward(grad_output, output, data, reduce, lengths=lengths, offsets=offsets, axis=axis, initial=initial) def _segment_reduce(data, reduce, lengths=None, offsets=None, axis=0, initial=None): if _capturing(): _captured = _capture_call(_segment_reduce, (data, reduce, lengths, offsets, axis, initial), {}) if _captured is not None: return _captured if initial is not None and not isinstance(initial, (tensorplay.Scalar, tensorplay.Tensor)): initial = tensorplay.Scalar(initial) return _C._segment_reduce(data, reduce, lengths=lengths, offsets=offsets, axis=axis, initial=initial) [docs] def pad_sequence(sequences, batch_first=False, padding_value=0.0, padding_side='right'): if _capturing(): _captured = _capture_call(pad_sequence, (sequences, batch_first, padding_value, padding_side), {}) if _captured is not None: return _captured return _C.pad_sequence(sequences, batch_first, padding_value, padding_side) [docs] def flatten_dense_tensors(*args): if _capturing(): _captured = _capture_call(flatten_dense_tensors, (*args,), {}) if _captured is not None: return _captured return _C.flatten_dense_tensors(*args) [docs] def unflatten_dense_tensors(flat, tensors): if _capturing(): _captured = _capture_call(unflatten_dense_tensors, (flat, tensors), {}) if _captured is not None: return _captured return _C.unflatten_dense_tensors(flat, tensors) def _nested_tensor_from_tensor_list(list, dtype=None, layout=None, device=None, pin_memory=None): if _capturing(): _captured = _capture_call(_nested_tensor_from_tensor_list, (list, dtype, layout, device, pin_memory), {}) if _captured is not None: return _captured return _C._nested_tensor_from_tensor_list(list, dtype, layout, _ensure_device(device), pin_memory) def _fw_primal_copy(input, level): if _capturing(): _captured = _capture_call(_fw_primal_copy, (input, level), {}) if _captured is not None: return _captured return _C._fw_primal_copy(input, level) def _make_dual_copy(primal, tangent, level): if _capturing(): _captured = _capture_call(_make_dual_copy, (primal, tangent, level), {}) if _captured is not None: return _captured return _C._make_dual_copy(primal, tangent, level) [docs] def view_as_real_copy(input): if _capturing(): _captured = _capture_call(view_as_real_copy, (input,), {}) if _captured is not None: return _captured return _C.view_as_real_copy(input) [docs] def view_as_complex_copy(input): if _capturing(): _captured = _capture_call(view_as_complex_copy, (input,), {}) if _captured is not None: return _captured return _C.view_as_complex_copy(input) def _conj_copy(input): if _capturing(): _captured = _capture_call(_conj_copy, (input,), {}) if _captured is not None: return _captured return _C._conj_copy(input) def _neg_view_copy(input): if _capturing(): _captured = _capture_call(_neg_view_copy, (input,), {}) if _captured is not None: return _captured return _C._neg_view_copy(input) [docs] def as_strided_copy(input, size, stride, storage_offset=None): if _capturing(): _captured = _capture_call(as_strided_copy, (input, size, stride, storage_offset), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C.as_strided_copy(input, size, stride, storage_offset) def _sparse_broadcast_to_copy(input, size): if _capturing(): _captured = _capture_call(_sparse_broadcast_to_copy, (input, size), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] return _C._sparse_broadcast_to_copy(input, size) def _reshape_alias_copy(input, size, stride): if _capturing(): _captured = _capture_call(_reshape_alias_copy, (input, size, stride), {}) if _captured is not None: return _captured if isinstance(size, int) and not isinstance(size, bool): size = [size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] return _C._reshape_alias_copy(input, size, stride) def _indices_copy(input): if _capturing(): _captured = _capture_call(_indices_copy, (input,), {}) if _captured is not None: return _captured return _C._indices_copy(input) def _values_copy(input): if _capturing(): _captured = _capture_call(_values_copy, (input,), {}) if _captured is not None: return _captured return _C._values_copy(input) [docs] def indices_copy(input): if _capturing(): _captured = _capture_call(indices_copy, (input,), {}) if _captured is not None: return _captured return _C.indices_copy(input) [docs] def values_copy(input): if _capturing(): _captured = _capture_call(values_copy, (input,), {}) if _captured is not None: return _captured return _C.values_copy(input) [docs] def crow_indices_copy(input): if _capturing(): _captured = _capture_call(crow_indices_copy, (input,), {}) if _captured is not None: return _captured return _C.crow_indices_copy(input) [docs] def col_indices_copy(input): if _capturing(): _captured = _capture_call(col_indices_copy, (input,), {}) if _captured is not None: return _captured return _C.col_indices_copy(input) [docs] def ccol_indices_copy(input): if _capturing(): _captured = _capture_call(ccol_indices_copy, (input,), {}) if _captured is not None: return _captured return _C.ccol_indices_copy(input) [docs] def row_indices_copy(input): if _capturing(): _captured = _capture_call(row_indices_copy, (input,), {}) if _captured is not None: return _captured return _C.row_indices_copy(input) [docs] def to_padded_tensor(input, padding, output_size=None): if _capturing(): _captured = _capture_call(to_padded_tensor, (input, padding, output_size), {}) if _captured is not None: return _captured return input.to_padded_tensor(padding=padding, output_size=output_size) def _jagged_to_padded_dense_forward(values, offsets, max_lengths, padding_value=0.0): if _capturing(): _captured = _capture_call(_jagged_to_padded_dense_forward, (values, offsets, max_lengths, padding_value), {}) if _captured is not None: return _captured if isinstance(max_lengths, int) and not isinstance(max_lengths, bool): max_lengths = [max_lengths] return _C._jagged_to_padded_dense_forward(values, offsets, max_lengths, padding_value) def _padded_dense_to_jagged_forward(dense, offsets, total_L=None): if _capturing(): _captured = _capture_call(_padded_dense_to_jagged_forward, (dense, offsets, total_L), {}) if _captured is not None: return _captured return _C._padded_dense_to_jagged_forward(dense, offsets, total_L) def _nested_from_padded_tensor(padded, offsets, dummy, ragged_idx=1, min_seqlen=None, max_seqlen=None, sum_S=None): if _capturing(): _captured = _capture_call(_nested_from_padded_tensor, (padded, offsets, dummy, ragged_idx, min_seqlen, max_seqlen, sum_S), {}) if _captured is not None: return _captured return _C._nested_from_padded_tensor(padded, offsets, dummy, ragged_idx, min_seqlen, max_seqlen, sum_S) def _nested_tensor_softmax_with_shape(input, query): if _capturing(): _captured = _capture_call(_nested_tensor_softmax_with_shape, (input, query), {}) if _captured is not None: return _captured return _C._nested_tensor_softmax_with_shape(input, query) def _safe_softmax(input, dim, dtype=None): if _capturing(): _captured = _capture_call(_safe_softmax, (input, dim, dtype), {}) if _captured is not None: return _captured return _C._safe_softmax(input, dim, dtype) def _transformer_encoder_layer_fwd(src, embed_dim, num_heads, qkv_weight, qkv_bias, proj_weight, proj_bias, use_gelu, norm_first, eps, norm_weight_1, norm_bias_1, norm_weight_2, norm_bias_2, ffn_weight_1, ffn_bias_1, ffn_weight_2, ffn_bias_2, mask=None, mask_type=None): if _capturing(): _captured = _capture_call(_transformer_encoder_layer_fwd, (src, embed_dim, num_heads, qkv_weight, qkv_bias, proj_weight, proj_bias, use_gelu, norm_first, eps, norm_weight_1, norm_bias_1, norm_weight_2, norm_bias_2, ffn_weight_1, ffn_bias_1, ffn_weight_2, ffn_bias_2, mask, mask_type), {}) if _captured is not None: return _captured return _C._transformer_encoder_layer_fwd(src, embed_dim, num_heads, qkv_weight, qkv_bias, proj_weight, proj_bias, use_gelu, norm_first, eps, norm_weight_1, norm_bias_1, norm_weight_2, norm_bias_2, ffn_weight_1, ffn_bias_1, ffn_weight_2, ffn_bias_2, mask, mask_type) def _native_multi_head_attention(query, key, value, embed_dim, num_head, qkv_weight, qkv_bias, proj_weight, proj_bias, mask=None, need_weights=True, average_attn_weights=True, mask_type=None): if _capturing(): _captured = _capture_call(_native_multi_head_attention, (query, key, value, embed_dim, num_head, qkv_weight, qkv_bias, proj_weight, proj_bias, mask, need_weights, average_attn_weights, mask_type), {}) if _captured is not None: return _captured return _C._native_multi_head_attention(query, key, value, embed_dim, num_head, qkv_weight, qkv_bias, proj_weight, proj_bias, mask, need_weights, average_attn_weights, mask_type) def _fused_sdp_choice(query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False, scale=None, enable_gqa=False): if _capturing(): _captured = _capture_call(_fused_sdp_choice, (query, key, value, attn_mask, dropout_p, is_causal, scale, enable_gqa), {}) if _captured is not None: return _captured return _C._fused_sdp_choice(query, key, value, attn_mask, dropout_p, is_causal, scale=scale, enable_gqa=enable_gqa) def _scaled_dot_product_attention_math(query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False, dropout_mask=None, scale=None, enable_gqa=False): if _capturing(): _captured = _capture_call(_scaled_dot_product_attention_math, (query, key, value, attn_mask, dropout_p, is_causal, dropout_mask, scale, enable_gqa), {}) if _captured is not None: return _captured return _C._scaled_dot_product_attention_math(query, key, value, attn_mask, dropout_p, is_causal, dropout_mask, scale=scale, enable_gqa=enable_gqa) def _scaled_dot_product_attention_math_for_mps(query, key, value, attn_mask=None, dropout_p=0.0, is_causal=False, dropout_mask=None, scale=None, enable_gqa=False): if _capturing(): _captured = _capture_call(_scaled_dot_product_attention_math_for_mps, (query, key, value, attn_mask, dropout_p, is_causal, dropout_mask, scale, enable_gqa), {}) if _captured is not None: return _captured return _C._scaled_dot_product_attention_math_for_mps(query, key, value, attn_mask, dropout_p, is_causal, dropout_mask, scale=scale, enable_gqa=enable_gqa) def _scaled_dot_product_flash_attention(query, key, value, dropout_p=0.0, is_causal=False, return_debug_mask=False, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_flash_attention, (query, key, value, dropout_p, is_causal, return_debug_mask, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_flash_attention(query, key, value, dropout_p, is_causal, return_debug_mask, scale=scale) def _scaled_dot_product_flash_attention_for_cpu(query, key, value, dropout_p=0.0, is_causal=False, attn_mask=None, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_flash_attention_for_cpu, (query, key, value, dropout_p, is_causal, attn_mask, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_flash_attention_for_cpu(query, key, value, dropout_p, is_causal, attn_mask=attn_mask, scale=scale) def _scaled_dot_product_fused_attention_overrideable(query, key, value, attn_bias=None, dropout_p=0.0, is_causal=False, return_debug_mask=False, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_fused_attention_overrideable, (query, key, value, attn_bias, dropout_p, is_causal, return_debug_mask, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_fused_attention_overrideable(query, key, value, attn_bias, dropout_p, is_causal, return_debug_mask, scale=scale) def _scaled_dot_product_flash_attention_backward(grad_out, query, key, value, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, philox_seed, philox_offset, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_flash_attention_backward, (grad_out, query, key, value, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, philox_seed, philox_offset, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_flash_attention_backward(grad_out, query, key, value, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, philox_seed, philox_offset, scale=scale) def _scaled_dot_product_flash_attention_for_cpu_backward(grad_out, query, key, value, out, logsumexp, dropout_p, is_causal, attn_mask=None, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_flash_attention_for_cpu_backward, (grad_out, query, key, value, out, logsumexp, dropout_p, is_causal, attn_mask, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_flash_attention_for_cpu_backward(grad_out, query, key, value, out, logsumexp, dropout_p, is_causal, attn_mask=attn_mask, scale=scale) def _scaled_dot_product_fused_attention_overrideable_backward(grad_out, query, key, value, attn_bias, grad_input_mask, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, philox_seed, philox_offset, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_fused_attention_overrideable_backward, (grad_out, query, key, value, attn_bias, grad_input_mask, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, philox_seed, philox_offset, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_fused_attention_overrideable_backward(grad_out, query, key, value, attn_bias, grad_input_mask, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, philox_seed, philox_offset, scale=scale) def _scaled_dot_product_efficient_attention(query, key, value, attn_bias, compute_log_sumexp, dropout_p=0.0, is_causal=False, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_efficient_attention, (query, key, value, attn_bias, compute_log_sumexp, dropout_p, is_causal, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_efficient_attention(query, key, value, attn_bias, compute_log_sumexp, dropout_p, is_causal, scale=scale) def _scaled_dot_product_efficient_attention_backward(grad_out_, query, key, value, attn_bias, out, logsumexp, philox_seed, philox_offset, dropout_p, grad_input_mask, is_causal=False, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_efficient_attention_backward, (grad_out_, query, key, value, attn_bias, out, logsumexp, philox_seed, philox_offset, dropout_p, grad_input_mask, is_causal, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_efficient_attention_backward(grad_out_, query, key, value, attn_bias, out, logsumexp, philox_seed, philox_offset, dropout_p, grad_input_mask, is_causal, scale=scale) def _scaled_dot_product_cudnn_attention(query, key, value, attn_bias, compute_log_sumexp, dropout_p=0.0, is_causal=False, return_debug_mask=False, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_cudnn_attention, (query, key, value, attn_bias, compute_log_sumexp, dropout_p, is_causal, return_debug_mask, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_cudnn_attention(query, key, value, attn_bias, compute_log_sumexp, dropout_p, is_causal, return_debug_mask, scale=scale) def _scaled_dot_product_cudnn_attention_backward(grad_out, query, key, value, out, logsumexp, philox_seed, philox_offset, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, scale=None): if _capturing(): _captured = _capture_call(_scaled_dot_product_cudnn_attention_backward, (grad_out, query, key, value, out, logsumexp, philox_seed, philox_offset, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, scale), {}) if _captured is not None: return _captured return _C._scaled_dot_product_cudnn_attention_backward(grad_out, query, key, value, out, logsumexp, philox_seed, philox_offset, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, scale=scale) def _flash_attention_forward(query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale=None, window_size_left=None, window_size_right=None, seqused_k=None, alibi_slopes=None, block_table=None, num_splits=None): if _capturing(): _captured = _capture_call(_flash_attention_forward, (query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale, window_size_left, window_size_right, seqused_k, alibi_slopes, block_table, num_splits), {}) if _captured is not None: return _captured return _C._flash_attention_forward(query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale=scale, window_size_left=window_size_left, window_size_right=window_size_right, seqused_k=seqused_k, alibi_slopes=alibi_slopes, block_table=block_table, num_splits=num_splits) def _flash_attention_forward_no_dropout_inplace(out, query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale=None, window_size_left=None, window_size_right=None, seqused_k=None, alibi_slopes=None, block_table=None, num_splits=None): if _capturing(): _captured = _capture_call(_flash_attention_forward_no_dropout_inplace, (out, query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale, window_size_left, window_size_right, seqused_k, alibi_slopes, block_table, num_splits), {}) if _captured is not None: return _captured return _C._flash_attention_forward_no_dropout_inplace(out, query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale=scale, window_size_left=window_size_left, window_size_right=window_size_right, seqused_k=seqused_k, alibi_slopes=alibi_slopes, block_table=block_table, num_splits=num_splits) def _flash_attention_backward(grad_out, query, key, value, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, rng_state, unused, scale=None, window_size_left=None, window_size_right=None): if _capturing(): _captured = _capture_call(_flash_attention_backward, (grad_out, query, key, value, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, rng_state, unused, scale, window_size_left, window_size_right), {}) if _captured is not None: return _captured return _C._flash_attention_backward(grad_out, query, key, value, out, logsumexp, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, rng_state, unused, scale=scale, window_size_left=window_size_left, window_size_right=window_size_right) def _efficient_attention_forward(query, key, value, bias, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, dropout_p, custom_mask_type, compute_log_sumexp=False, scale=None, seqlen_k=None, window_size=None): if _capturing(): _captured = _capture_call(_efficient_attention_forward, (query, key, value, bias, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, dropout_p, custom_mask_type, compute_log_sumexp, scale, seqlen_k, window_size), {}) if _captured is not None: return _captured return _C._efficient_attention_forward(query, key, value, bias, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, dropout_p, custom_mask_type, compute_log_sumexp, scale=scale, seqlen_k=seqlen_k, window_size=window_size) def _efficient_attention_backward(grad_out_, query, key, value, bias, out, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, logsumexp, dropout_p, philox_seed, philox_offset, custom_mask_type, bias_requires_grad, scale=None, num_splits_key=None, window_size=None, shared_storage_dqdkdv=False): if _capturing(): _captured = _capture_call(_efficient_attention_backward, (grad_out_, query, key, value, bias, out, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, logsumexp, dropout_p, philox_seed, philox_offset, custom_mask_type, bias_requires_grad, scale, num_splits_key, window_size, shared_storage_dqdkdv), {}) if _captured is not None: return _captured return _C._efficient_attention_backward(grad_out_, query, key, value, bias, out, cu_seqlens_q, cu_seqlens_k, max_seqlen_q, max_seqlen_k, logsumexp, dropout_p, philox_seed, philox_offset, custom_mask_type, bias_requires_grad, scale=scale, num_splits_key=num_splits_key, window_size=window_size, shared_storage_dqdkdv=shared_storage_dqdkdv) def _cudnn_attention_forward(query, key, value, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, compute_log_sumexp, dropout_p=0.0, is_causal=False, return_debug_mask=False, scale=None, seqused_k=None, block_table=None): if _capturing(): _captured = _capture_call(_cudnn_attention_forward, (query, key, value, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, compute_log_sumexp, dropout_p, is_causal, return_debug_mask, scale, seqused_k, block_table), {}) if _captured is not None: return _captured return _C._cudnn_attention_forward(query, key, value, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, compute_log_sumexp, dropout_p, is_causal, return_debug_mask, scale=scale, seqused_k=seqused_k, block_table=block_table) def _cudnn_attention_backward(grad_out, query, key, value, out, logsumexp, philox_seed, philox_offset, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, scale=None): if _capturing(): _captured = _capture_call(_cudnn_attention_backward, (grad_out, query, key, value, out, logsumexp, philox_seed, philox_offset, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, scale), {}) if _captured is not None: return _captured return _C._cudnn_attention_backward(grad_out, query, key, value, out, logsumexp, philox_seed, philox_offset, attn_bias, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, scale=scale) def _triton_scaled_dot_attention(q, k, v, dropout_p=0.0): if _capturing(): _captured = _capture_call(_triton_scaled_dot_attention, (q, k, v, dropout_p), {}) if _captured is not None: return _captured return _C._triton_scaled_dot_attention(q, k, v, dropout_p) def _fill_mem_eff_dropout_mask_(input, dropout_p, seed, offset): if _capturing(): _captured = _capture_call(_fill_mem_eff_dropout_mask_, (input, dropout_p, seed, offset), {}) if _captured is not None: return _captured return _C._fill_mem_eff_dropout_mask_(input, dropout_p, seed, offset) def _triton_multi_head_attention(query, key, value, embed_dim, num_head, qkv_weight, qkv_bias, proj_weight, proj_bias, mask=None): if _capturing(): _captured = _capture_call(_triton_multi_head_attention, (query, key, value, embed_dim, num_head, qkv_weight, qkv_bias, proj_weight, proj_bias, mask), {}) if _captured is not None: return _captured return _C._triton_multi_head_attention(query, key, value, embed_dim, num_head, qkv_weight, qkv_bias, proj_weight, proj_bias, mask) [docs] def special_airy_ai(x, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_airy_ai, (x,), {'out': out}) if _captured is not None: return _captured return _C.special_airy_ai(x=x, out=out) if _capturing(): _captured = _capture_call(special_airy_ai, (x,), {}) if _captured is not None: return _captured return _C.special_airy_ai(x=x) [docs] def special_bessel_j0(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_bessel_j0, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_bessel_j0(self=input, out=out) if _capturing(): _captured = _capture_call(special_bessel_j0, (input,), {}) if _captured is not None: return _captured return _C.special_bessel_j0(self=input) [docs] def special_bessel_j1(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_bessel_j1, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_bessel_j1(self=input, out=out) if _capturing(): _captured = _capture_call(special_bessel_j1, (input,), {}) if _captured is not None: return _captured return _C.special_bessel_j1(self=input) [docs] def special_bessel_y0(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_bessel_y0, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_bessel_y0(self=input, out=out) if _capturing(): _captured = _capture_call(special_bessel_y0, (input,), {}) if _captured is not None: return _captured return _C.special_bessel_y0(self=input) [docs] def special_bessel_y1(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_bessel_y1, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_bessel_y1(self=input, out=out) if _capturing(): _captured = _capture_call(special_bessel_y1, (input,), {}) if _captured is not None: return _captured return _C.special_bessel_y1(self=input) [docs] def special_chebyshev_polynomial_t(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_t, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_t(x, n, out=out) if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_t, (x, n), {}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_t(x, n) [docs] def special_chebyshev_polynomial_u(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_u, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_u(x, n, out=out) if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_u, (x, n), {}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_u(x, n) [docs] def special_chebyshev_polynomial_v(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_v, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_v(x, n, out=out) if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_v, (x, n), {}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_v(x, n) [docs] def special_chebyshev_polynomial_w(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_w, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_w(x, n, out=out) if _capturing(): _captured = _capture_call(special_chebyshev_polynomial_w, (x, n), {}) if _captured is not None: return _captured return _C.special_chebyshev_polynomial_w(x, n) [docs] def special_hermite_polynomial_h(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_hermite_polynomial_h, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_hermite_polynomial_h(x, n, out=out) if _capturing(): _captured = _capture_call(special_hermite_polynomial_h, (x, n), {}) if _captured is not None: return _captured return _C.special_hermite_polynomial_h(x, n) [docs] def special_hermite_polynomial_he(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_hermite_polynomial_he, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_hermite_polynomial_he(x, n, out=out) if _capturing(): _captured = _capture_call(special_hermite_polynomial_he, (x, n), {}) if _captured is not None: return _captured return _C.special_hermite_polynomial_he(x, n) [docs] def special_laguerre_polynomial_l(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_laguerre_polynomial_l, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_laguerre_polynomial_l(x, n, out=out) if _capturing(): _captured = _capture_call(special_laguerre_polynomial_l, (x, n), {}) if _captured is not None: return _captured return _C.special_laguerre_polynomial_l(x, n) [docs] def special_legendre_polynomial_p(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_legendre_polynomial_p, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_legendre_polynomial_p(x, n, out=out) if _capturing(): _captured = _capture_call(special_legendre_polynomial_p, (x, n), {}) if _captured is not None: return _captured return _C.special_legendre_polynomial_p(x, n) [docs] def special_modified_bessel_i0(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_modified_bessel_i0, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_modified_bessel_i0(self=input, out=out) if _capturing(): _captured = _capture_call(special_modified_bessel_i0, (input,), {}) if _captured is not None: return _captured return _C.special_modified_bessel_i0(self=input) [docs] def special_modified_bessel_i1(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_modified_bessel_i1, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_modified_bessel_i1(self=input, out=out) if _capturing(): _captured = _capture_call(special_modified_bessel_i1, (input,), {}) if _captured is not None: return _captured return _C.special_modified_bessel_i1(self=input) [docs] def special_modified_bessel_k0(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_modified_bessel_k0, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_modified_bessel_k0(self=input, out=out) if _capturing(): _captured = _capture_call(special_modified_bessel_k0, (input,), {}) if _captured is not None: return _captured return _C.special_modified_bessel_k0(self=input) [docs] def special_modified_bessel_k1(input, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_modified_bessel_k1, (input,), {'out': out}) if _captured is not None: return _captured return _C.special_modified_bessel_k1(self=input, out=out) if _capturing(): _captured = _capture_call(special_modified_bessel_k1, (input,), {}) if _captured is not None: return _captured return _C.special_modified_bessel_k1(self=input) [docs] def special_scaled_modified_bessel_k0(x, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_scaled_modified_bessel_k0, (x,), {'out': out}) if _captured is not None: return _captured return _C.special_scaled_modified_bessel_k0(x=x, out=out) if _capturing(): _captured = _capture_call(special_scaled_modified_bessel_k0, (x,), {}) if _captured is not None: return _captured return _C.special_scaled_modified_bessel_k0(x=x) [docs] def special_scaled_modified_bessel_k1(x, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_scaled_modified_bessel_k1, (x,), {'out': out}) if _captured is not None: return _captured return _C.special_scaled_modified_bessel_k1(x=x, out=out) if _capturing(): _captured = _capture_call(special_scaled_modified_bessel_k1, (x,), {}) if _captured is not None: return _captured return _C.special_scaled_modified_bessel_k1(x=x) [docs] def special_shifted_chebyshev_polynomial_t(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_t, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_t(x, n, out=out) if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_t, (x, n), {}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_t(x, n) [docs] def special_shifted_chebyshev_polynomial_u(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_u, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_u(x, n, out=out) if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_u, (x, n), {}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_u(x, n) [docs] def special_shifted_chebyshev_polynomial_v(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_v, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_v(x, n, out=out) if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_v, (x, n), {}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_v(x, n) [docs] def special_shifted_chebyshev_polynomial_w(x, n, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_w, (x, n), {'out': out}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_w(x, n, out=out) if _capturing(): _captured = _capture_call(special_shifted_chebyshev_polynomial_w, (x, n), {}) if _captured is not None: return _captured return _C.special_shifted_chebyshev_polynomial_w(x, n) [docs] def special_spherical_bessel_j0(x, *, out=None): if out is not None: if _capturing(): _captured = _capture_call(special_spherical_bessel_j0, (x,), {'out': out}) if _captured is not None: return _captured return _C.special_spherical_bessel_j0(x=x, out=out) if _capturing(): _captured = _capture_call(special_spherical_bessel_j0, (x,), {}) if _captured is not None: return _captured return _C.special_spherical_bessel_j0(x=x) def _foobar(input, arg1=True, arg2=True, arg3=True): if _capturing(): _captured = _capture_call(_foobar, (input, arg1, arg2, arg3), {}) if _captured is not None: return _captured return _C._foobar(input, arg1, arg2, arg3=arg3) def _propagate_xla_data(input, output): if _capturing(): _captured = _capture_call(_propagate_xla_data, (input, output), {}) if _captured is not None: return _captured return _C._propagate_xla_data(input, output) def _quantized_weight_prepack(weight): if _capturing(): _captured = _capture_call(_quantized_weight_prepack, (weight,), {}) if _captured is not None: return _captured return _C._quantized_weight_prepack(weight) def _quantized_packed_run(input, packed, offsets, scales, zero_points, bias, weight_sizes, output_scale, output_zero_point, stride=[], padding=[], dilation=[], groups=1, relu=False, output_float=False, activation=0, negative_slope=0, residual=None): if _capturing(): _captured = _capture_call(_quantized_packed_run, (input, packed, offsets, scales, zero_points, bias, weight_sizes, output_scale, output_zero_point, stride, padding, dilation, groups, relu, output_float, activation, negative_slope, residual), {}) if _captured is not None: return _captured if isinstance(weight_sizes, int) and not isinstance(weight_sizes, bool): weight_sizes = [weight_sizes] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] return _C._quantized_packed_run(input, packed, offsets, scales, zero_points, bias, weight_sizes, output_scale, output_zero_point, stride, padding, dilation, groups, relu, output_float, activation, negative_slope, residual) def quantized_batch_norm_relu(input, weight, bias, mean, var, eps, output_scale, output_zero_point): if _capturing(): _captured = _capture_call(quantized_batch_norm_relu, (input, weight, bias, mean, var, eps, output_scale, output_zero_point), {}) if _captured is not None: return _captured return _C.quantized_batch_norm_relu(input, weight, bias, mean, var, eps, output_scale, output_zero_point) def quantized_binary(a, b, scale, zero_point, operation, relu=False): if _capturing(): _captured = _capture_call(quantized_binary, (a, b, scale, zero_point, operation, relu), {}) if _captured is not None: return _captured return _C.quantized_binary(a, b, scale, zero_point, operation, relu) def quantized_scalar(input, value, operation, relu=False): if _capturing(): _captured = _capture_call(quantized_scalar, (input, value, operation, relu), {}) if _captured is not None: return _captured return _C.quantized_scalar(input, value, operation, relu) def quantized_scalar_out(input, value, operation, out, relu=False): if _capturing(): _captured = _capture_call(quantized_scalar_out, (input, value, operation, out, relu), {}) if _captured is not None: return _captured return _C.quantized_scalar_out(input, value, operation, out, relu) def quantized_softmax(input, dim, scale, zero_point): if _capturing(): _captured = _capture_call(quantized_softmax, (input, dim, scale, zero_point), {}) if _captured is not None: return _captured return _C.quantized_softmax(input, dim, scale, zero_point) def quantized_matmul(a, b, scale, zero_point): if _capturing(): _captured = _capture_call(quantized_matmul, (a, b, scale, zero_point), {}) if _captured is not None: return _captured return _C.quantized_matmul(a, b, scale, zero_point) def quantized_prelu(input, weight, scale, zero_point): if _capturing(): _captured = _capture_call(quantized_prelu, (input, weight, scale, zero_point), {}) if _captured is not None: return _captured return _C.quantized_prelu(input, weight, scale, zero_point) def quantized_avg_pool(input, kernel_size, stride=[], padding=[], ceil_mode=False, count_include_pad=True, divisor_override=None): if _capturing(): _captured = _capture_call(quantized_avg_pool, (input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override), {}) if _captured is not None: return _captured if isinstance(kernel_size, int) and not isinstance(kernel_size, bool): kernel_size = [kernel_size] if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] return _C.quantized_avg_pool(input, kernel_size, stride, padding, ceil_mode, count_include_pad, divisor_override) def quantized_adaptive_avg_pool(input, output_size): if _capturing(): _captured = _capture_call(quantized_adaptive_avg_pool, (input, output_size), {}) if _captured is not None: return _captured if isinstance(output_size, int) and not isinstance(output_size, bool): output_size = [output_size] return _C.quantized_adaptive_avg_pool(input, output_size) def quantized_dropout(input, scale, zero_point, p=0.5, training=False): if _capturing(): _captured = _capture_call(quantized_dropout, (input, scale, zero_point, p, training), {}) if _captured is not None: return _captured return _C.quantized_dropout(input, scale, zero_point, p, training) def _quantized_fp16_prepack(weight): if _capturing(): _captured = _capture_call(_quantized_fp16_prepack, (weight,), {}) if _captured is not None: return _captured return _C._quantized_fp16_prepack(weight) def _quantized_fp16_linear(input, weight, bias=None, relu=False): if _capturing(): _captured = _capture_call(_quantized_fp16_linear, (input, weight, bias, relu), {}) if _captured is not None: return _captured return _C._quantized_fp16_linear(input, weight, bias, relu) def quantized_unary(input, scale, zero_point, operation, a=0.0, b=1.0): if _capturing(): _captured = _capture_call(quantized_unary, (input, scale, zero_point, operation, a, b), {}) if _captured is not None: return _captured return _C.quantized_unary(input, scale, zero_point, operation, a, b) def _quantized_rowwise_pack(weight, bit_width=8, optimized_qparams=False, nbins=200, ratio=0.16, rowwise_min_max=None): if _capturing(): _captured = _capture_call(_quantized_rowwise_pack, (weight, bit_width, optimized_qparams, nbins, ratio, rowwise_min_max), {}) if _captured is not None: return _captured return _C._quantized_rowwise_pack(weight, bit_width, optimized_qparams, nbins, ratio, rowwise_min_max) def _quantized_rowwise_unpack(weight, bit_width=8): if _capturing(): _captured = _capture_call(_quantized_rowwise_unpack, (weight, bit_width), {}) if _captured is not None: return _captured return _C._quantized_rowwise_unpack(weight, bit_width) def _quantized_embedding_weight_pack(weight): if _capturing(): _captured = _capture_call(_quantized_embedding_weight_pack, (weight,), {}) if _captured is not None: return _captured return _C._quantized_embedding_weight_pack(weight) def _quantized_embedding(weight, indices, bit_width=8): if _capturing(): _captured = _capture_call(_quantized_embedding, (weight, indices, bit_width), {}) if _captured is not None: return _captured return _C._quantized_embedding(weight, indices, bit_width) def _quantized_embedding_bag(weight, indices, bit_width=8, offsets=None, per_sample_weights=None, compressed_indices_mapping=None, include_last_offset=False, pruned_weights=False): if _capturing(): _captured = _capture_call(_quantized_embedding_bag, (weight, indices, bit_width, offsets, per_sample_weights, compressed_indices_mapping, include_last_offset, pruned_weights), {}) if _captured is not None: return _captured return _C._quantized_embedding_bag(weight, indices, bit_width, offsets, per_sample_weights, compressed_indices_mapping, include_last_offset, pruned_weights) def quantized_convolution(input, weight, bias, scale, zero_point, stride=[], padding=[], dilation=[], groups=1, transposed=False, output_padding=[], relu=False, output_float=False): if _capturing(): _captured = _capture_call(quantized_convolution, (input, weight, bias, scale, zero_point, stride, padding, dilation, groups, transposed, output_padding, relu, output_float), {}) if _captured is not None: return _captured if isinstance(stride, int) and not isinstance(stride, bool): stride = [stride] if isinstance(padding, int) and not isinstance(padding, bool): padding = [padding] if isinstance(dilation, int) and not isinstance(dilation, bool): dilation = [dilation] if isinstance(output_padding, int) and not isinstance(output_padding, bool): output_padding = [output_padding] return _C.quantized_convolution(input, weight, bias, scale, zero_point, stride, padding, dilation, groups, transposed, output_padding, relu, output_float) def _quantized_recurrent_cell(input, hidden, cell, weight_ih, weight_hh, bias_ih, bias_hh, mode, reduce_range=True): if _capturing(): _captured = _capture_call(_quantized_recurrent_cell, (input, hidden, cell, weight_ih, weight_hh, bias_ih, bias_hh, mode, reduce_range), {}) if _captured is not None: return _captured return _C._quantized_recurrent_cell(input, hidden, cell, weight_ih, weight_hh, bias_ih, bias_hh, mode, reduce_range) def _quantized_recurrent(input, hidden, cell, weights, biases, num_layers, dropout, training, bidirectional, batch_first, mode, reduce_range=True, batch_sizes=None): if _capturing(): _captured = _capture_call(_quantized_recurrent, (input, hidden, cell, weights, biases, num_layers, dropout, training, bidirectional, batch_first, mode, reduce_range, batch_sizes), {}) if _captured is not None: return _captured return _C._quantized_recurrent(input, hidden, cell, weights, biases, num_layers, dropout, training, bidirectional, batch_first, mode, reduce_range, batch_sizes) def _quantized_int4_mm(input, weight, group_size, scale_and_zero): if _capturing(): _captured = _capture_call(_quantized_int4_mm, (input, weight, group_size, scale_and_zero), {}) if _captured is not None: return _captured return _C._quantized_int4_mm(input, weight, group_size, scale_and_zero) def _quantized_wrapped_linear(input, input_scale, input_zero_point, weight, weight_scale, weight_zero_point, bias, output_scale, output_zero_point, out_channels): if _capturing(): _captured = _capture_call(_quantized_wrapped_linear, (input, input_scale, input_zero_point, weight, weight_scale, weight_zero_point, bias, output_scale, output_zero_point, out_channels), {}) if _captured is not None: return _captured return _C._quantized_wrapped_linear(input, input_scale, input_zero_point, weight, weight_scale, weight_zero_point, bias, output_scale, output_zero_point, out_channels) def _quantized_wrapped_half_prepack(weight): if _capturing(): _captured = _capture_call(_quantized_wrapped_half_prepack, (weight,), {}) if _captured is not None: return _captured return _C._quantized_wrapped_half_prepack(weight) def _quantized_wrapped_half_linear(input, weight, bias, out_channels): if _capturing(): _captured = _capture_call(_quantized_wrapped_half_linear, (input, weight, bias, out_channels), {}) if _captured is not None: return _captured return _C._quantized_wrapped_half_linear(input, weight, bias, out_channels) def _quantized_recurrent_step(input_gates, hidden_gates, hidden, cell, mode): if _capturing(): _captured = _capture_call(_quantized_recurrent_step, (input_gates, hidden_gates, hidden, cell, mode), {}) if _captured is not None: return _captured return _C._quantized_recurrent_step(input_gates, hidden_gates, hidden, cell, mode) def _quantum_apply_gate(state, mat, wires): if _capturing(): _captured = _capture_call(_quantum_apply_gate, (state, mat, wires), {}) if _captured is not None: return _captured if isinstance(wires, int) and not isinstance(wires, bool): wires = [wires] return _C._quantum_apply_gate(state, mat, wires) def _quantum_state_probs(state): if _capturing(): _captured = _capture_call(_quantum_state_probs, (state,), {}) if _captured is not None: return _captured return _C._quantum_state_probs(state) def _quantum_marginal_probs(state, wires): if _capturing(): _captured = _capture_call(_quantum_marginal_probs, (state, wires), {}) if _captured is not None: return _captured if isinstance(wires, int) and not isinstance(wires, bool): wires = [wires] return _C._quantum_marginal_probs(state, wires) def _quantum_pauli_expectation(state, word): if _capturing(): _captured = _capture_call(_quantum_pauli_expectation, (state, word), {}) if _captured is not None: return _captured return _C._quantum_pauli_expectation(state, word) try: _C.install_factory_fast_paths(_C, { 'empty': empty, 'zeros': zeros, 'ones': ones, 'rand': rand, 'randn': randn, 'full': full, 'eye': eye, 'empty_like': empty_like, 'zeros_like': zeros_like, 'ones_like': ones_like, 'full_like': full_like, }) # Adopt the C trampolines (installed as _C._fast) as the # public factories: eager calls skip the Python frame; captures # divert back to the wrapper objects handed over above. empty = _C.empty_fast zeros = _C.zeros_fast ones = _C.ones_fast rand = _C.rand_fast randn = _C.randn_fast full = _C.full_fast eye = _C.eye_fast empty_like = _C.empty_like_fast zeros_like = _C.zeros_like_fast ones_like = _C.ones_like_fast full_like = _C.full_like_fast except (AttributeError, TypeError): pass ```