<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraph/Builder/Tensor",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO7BuilderV6TensorV"
  },
  "title" : "BNNSGraph.Builder.Tensor"
}
-->

# BNNSGraph.Builder.Tensor

A structure that represents an abstract handle to a tensor that you use within a `BNNSGraph.makeContext` closure.

```
struct Tensor<T> where T : BNNSScalar
```

## Topics

### Operators

[`static func .! (BNNSGraph.Builder.Tensor<Bool>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/.!(_:))

Adds an element-wise logical not operation to the current graph.

[`static func .!= (BNNSGraph.Builder.Tensor<T>, BNNSGraph.Builder.Tensor<T>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/.!=(_:_:))

Adds an element-wise inequality operation to the current graph.

[`static func .& (BNNSGraph.Builder.Tensor<Bool>, BNNSGraph.Builder.Tensor<Bool>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/.&(_:_:))

Adds an element-wise logical and operation to the current graph.

[`static func .== (BNNSGraph.Builder.Tensor<T>, BNNSGraph.Builder.Tensor<T>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/.==(_:_:))

Adds an element-wise equality operation to the current graph.

[`static func .| (BNNSGraph.Builder.Tensor<Bool>, BNNSGraph.Builder.Tensor<Bool>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/._(_:_:)-171l2)

Adds an element-wise logical or operation to the current graph.

[`static func .< (BNNSGraph.Builder.Tensor<T>, BNNSGraph.Builder.Tensor<T>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/._(_:_:)-6sgl6)

Adds an element-wise less than comparison operation to the current graph.

[`static func .^ (BNNSGraph.Builder.Tensor<Bool>, BNNSGraph.Builder.Tensor<Bool>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/._(_:_:)-6soc4)

Adds an element-wise logical xor operation to the current graph.

[`static func .> (BNNSGraph.Builder.Tensor<T>, BNNSGraph.Builder.Tensor<T>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/._(_:_:)-9vd51)

Adds an element-wise greater than comparison operation to the current graph.

[`static func .<= (BNNSGraph.Builder.Tensor<T>, BNNSGraph.Builder.Tensor<T>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/._=(_:_:)-20vpj)

Adds an element-wise less than or equal comparison operation to the current graph.

[`static func .>= (BNNSGraph.Builder.Tensor<T>, BNNSGraph.Builder.Tensor<T>) -> BNNSGraph.Builder.Tensor<Bool>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/._=(_:_:)-6gvvh)

Adds an element-wise greater than or equal comparison operation to the current graph.

### Instance Properties

[`var dataType: BNNSDataType?`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/dataType)

The data type of the tensor.

[`var description: String`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/description)

A textual representation of this instance.

[`var rank: Int?`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/rank)

The rank of the tensor.

[`var shape: [Int]?`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/shape)

The shape of the tensor.

[`var stride: [Int]?`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/stride)

The stride of the tensor.

### Instance Methods

[`func abs() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/abs())

Adds an element-wise absolute operation to the current graph.

[`func acos() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/acos())

Adds an element-wise acos operation to the current graph.

[`func acosh() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/acosh())

Adds an element-wise atan operation to the current graph.

[`func argMax(axis: Int, keepDimension: Bool) -> BNNSGraph.Builder.Tensor<Int32>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/argMax(axis:keepDimension:))

Adds an argmax operation to the current graph.

[`func argMin(axis: Int, keepDimension: Bool) -> BNNSGraph.Builder.Tensor<Int32>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/argMin(axis:keepDimension:))

Adds an argmin operation to the current graph.

[`func argSort(axis: Int, sortOrder: BNNSGraph.Builder.SortOrder) -> BNNSGraph.Builder.Tensor<Int32>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/argSort(axis:sortOrder:))

Adds an argsort operation to the current graph.

[`func asin() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/asin())

Adds an element-wise asin operation to the current graph.

[`func asinh() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/asinh())

Adds an element-wise asinh operation to the current graph.

[`func atan() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/atan())

Adds an element-wise atan operation to the current graph.

[`func atanh() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/atanh())

Adds an element-wise atanh operation to the current graph.

[`func batchNorm(mean: some BNNSGraph.Builder.OperationParameter<T>, variance: some BNNSGraph.Builder.OperationParameter<T>, epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/batchNorm(mean:variance:epsilon:))

Adds a batch normalization operation to the current graph.

[`func batchNorm(mean: some BNNSGraph.Builder.OperationParameter<T>, variance: some BNNSGraph.Builder.OperationParameter<T>, weight: some BNNSGraph.Builder.OperationParameter<T>, bias: some BNNSGraph.Builder.OperationParameter<T>, epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/batchNorm(mean:variance:weight:bias:epsilon:))

Adds a batch normalization operation to the current graph.

[`func bidirectionalLSTM(initialHiddenStates: BNNSGraph.Builder.Tensor<T>, initialCellStates: BNNSGraph.Builder.Tensor<T>, inputHiddenWeight: BNNSGraph.Builder.Tensor<T>, hiddenHiddenWeight: BNNSGraph.Builder.Tensor<T>, bias: BNNSGraph.Builder.Tensor<T>, inputHiddenWeightBack: BNNSGraph.Builder.Tensor<T>, hiddenHiddenWeightBack: BNNSGraph.Builder.Tensor<T>, biasBack: BNNSGraph.Builder.Tensor<T>, activation: BNNSGraph.Builder.Activation, recurrentActivation: BNNSGraph.Builder.Activation, cellActivation: BNNSGraph.Builder.Activation, outputSequence: Bool) -> (output: BNNSGraph.Builder.Tensor<T>, hiddenStates: BNNSGraph.Builder.Tensor<T>, memoryStates: BNNSGraph.Builder.Tensor<T>)`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/bidirectionalLSTM(initialHiddenStates:initialCellStates:inputHiddenWeight:hiddenHiddenWeight:bias:inputHiddenWeightBack:hiddenHiddenWeightBack:biasBack:activation:recurrentActivation:cellActivation:outputSequence:))

Adds a bidirectional LSTM operation to the current graph.

[`func cast<U>(to: U.Type) -> BNNSGraph.Builder.Tensor<U>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/cast(to:))

Adds a cast operation to the current graph.

[`func ceil() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/ceil())

Adds an element-wise ceiling operation to the current graph.

[`func channelNorm(epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/channelNorm(epsilon:))

Adds a channel normalization operation to the current graph.

[`func channelNorm(weight: some BNNSGraph.Builder.OperationParameter<T>, bias: some BNNSGraph.Builder.OperationParameter<T>, epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/channelNorm(weight:bias:epsilon:))

Adds a channel normalization operation to the current graph.

[`func clampedReLU(alpha: Float, beta: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/clampedReLU(alpha:beta:))

Adds a Clamped Rectified Linear Unit (ReLU) activation operation to the current graph.

[`func clip(to: ClosedRange<Float>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/clip(to:))

Adds an element-wise clip operation to the current graph.

[`func conv(weight: some BNNSGraph.Builder.OperationParameter<T>, strides: [Int], bias: some BNNSGraph.Builder.OperationParameter<T>, padding: BNNSGraph.Builder.ConvolutionPadding, dilations: [Int]?, groupCount: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/conv(weight:strides:bias:padding:dilations:groupCount:))

Adds a convolution operation to the current graph.

[`func conv(weight: some BNNSGraph.Builder.OperationParameter<T>, strides: [Int], padding: BNNSGraph.Builder.ConvolutionPadding, dilations: [Int]?, groupCount: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/conv(weight:strides:padding:dilations:groupCount:))

Adds a convolution operation to the current graph.

[`func convTranspose(weight: some BNNSGraph.Builder.OperationParameter<T>, strides: [Int], bias: some BNNSGraph.Builder.OperationParameter<T>, padding: BNNSGraph.Builder.ConvolutionPadding, outputPaddingValues: [Int]?, dilations: [Int]?, groupCount: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/convTranspose(weight:strides:bias:padding:outputPaddingValues:dilations:groupCount:))

Adds a transposed convolution operation to the current graph.

[`func convTranspose(weight: some BNNSGraph.Builder.OperationParameter<T>, strides: [Int], padding: BNNSGraph.Builder.ConvolutionPadding, outputPaddingValues: [Int]?, dilations: [Int]?, groupCount: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/convTranspose(weight:strides:padding:outputPaddingValues:dilations:groupCount:))

Adds a transposed convolution operation to the current graph.

[`func cos() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/cos())

Adds an element-wise cos operation to the current graph.

[`func cosh() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/cosh())

Adds an element-wise cosh operation to the current graph.

[`func cumulativeSum(axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/cumulativeSum(axis:))

Adds a cumulative sum operation to the the graph.

[`func elu(alpha: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/elu(alpha:))

Adds an Exponential Linear Unit (ELU) activation operation to the current graph.

[`func erf() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/erf())

Adds an Error Function (erf) activation operation to the current graph.

[`func exp() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/exp())

Adds an element-wise exp operation to the current graph.

[`func exp2() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/exp2())

Adds an element-wise exp operation to the current graph.

[`func floor() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/floor())

Adds an element-wise floor operation to the current graph.

[`func fma(y: some BNNSGraph.Builder.OperationParameter<T>, z: some BNNSGraph.Builder.OperationParameter<T>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/fma(y:z:))

Adds an element-wise fused multiply-add operation to the current graph.

[`func gather(indices: some BNNSGraph.Builder.OperationParameter<Int32>, axis: Int, batchDimensionCount: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/gather(indices:axis:batchDimensionCount:))

Adds a gather operation to the current graph.

[`func gatherAlongAxis(indices: some BNNSGraph.Builder.OperationParameter<Int32>, axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/gatherAlongAxis(indices:axis:))

Adds a gather-along-axis operation to the current graph.

[`func gatherND(indices: some BNNSGraph.Builder.OperationParameter<Int32>, batchDimensionCount: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/gatherND(indices:batchDimensionCount:))

Adds a gather-nd operation to the current graph.

[`func gelu() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/gelu())

Adds a Gaussian Error Linear Unit (GELU) activation operation to the current graph.

[`func geluSigmoidApproximation() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/geluSigmoidApproximation())

Adds a Gaussian Error Linear Unit (GELU) sigmoid approximation activation operation to the current graph.

[`func geluTanhApproximation() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/geluTanhApproximation())

Adds a Gaussian Error Linear Unit (GELU) tanh approximation activation operation to the current graph.

[`func gru(initialHiddenStates: BNNSGraph.Builder.Tensor<T>, inputHiddenWeight: BNNSGraph.Builder.Tensor<T>, hiddenHiddenWeight: BNNSGraph.Builder.Tensor<T>, bias: BNNSGraph.Builder.Tensor<T>, inputBias: BNNSGraph.Builder.Tensor<T>, direction: BNNSGraph.Builder.Direction, activation: BNNSGraph.Builder.Activation, recurrentActivation: BNNSGraph.Builder.Activation, applyResetGateAfterMatMul: Bool, outputSequence: Bool) -> (output: BNNSGraph.Builder.Tensor<T>, hiddenStates: BNNSGraph.Builder.Tensor<T>)`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/gru(initialHiddenStates:inputHiddenWeight:hiddenHiddenWeight:bias:inputBias:direction:activation:recurrentActivation:applyResetGateAfterMatMul:outputSequence:))

Adds a GRU operation to the current graph.

[`func hardSigmoid(alpha: Float, beta: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/hardSigmoid(alpha:beta:))

Adds a hard sigmoid activation operation to the current graph.

[`func hardSwish() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/hardSwish())

Adds a hard swish activation operation to the current graph.

[`func instanceNorm(epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/instanceNorm(epsilon:))

Adds a instance normalization operation to the current graph.

[`func instanceNorm(weight: some BNNSGraph.Builder.OperationParameter<T>, bias: some BNNSGraph.Builder.OperationParameter<T>, epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/instanceNorm(weight:bias:epsilon:))

Adds a instance normalization operation to the current graph.

[`func l1Norm(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/l1Norm(axes:keepDimensions:))

Adds a sum-of-absolutes reduction operation along the given axis operation to the current graph.

[`func l2Norm(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/l2Norm(axes:keepDimensions:))

Adds a Euclidean-norm reduction operation along the given axis operation to the current graph.

[`func l2Norm(epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/l2Norm(epsilon:))

Adds an L2 spatial normalization operation to the current graph.

[`func layerNorm(axes: [Int], epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/layerNorm(axes:epsilon:))

Adds a layer normalization operation to the current graph.

[`func layerNorm(weight: some BNNSGraph.Builder.OperationParameter<T>, bias: some BNNSGraph.Builder.OperationParameter<T>, axes: [Int], epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/layerNorm(weight:bias:axes:epsilon:))

Adds a layer normalization operation to the current graph.

[`func leakyReLU(alpha: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/leakyReLU(alpha:))

Adds a Leaky Rectified Linear Unit (ReLU) activation operation to the current graph.

[`func linear(weight: some BNNSGraph.Builder.OperationParameter<T>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/linear(weight:))

Adds a linear transformation operation to the current graph.

[`func linear(weight: some BNNSGraph.Builder.OperationParameter<T>, bias: some BNNSGraph.Builder.OperationParameter<T>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/linear(weight:bias:))

Adds a linear transformation operation to the current graph.

[`func log(epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/log(epsilon:))

Adds an element-wise log operation to the current graph.

[`func logSoftmax(axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/logSoftmax(axis:))

Adds a log-softmax along the given axis operation to the current graph.

[`func logSum(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/logSum(axes:keepDimensions:))

Adds a log-sum reduction operation along the given axis operation to the current graph.

[`func logSumExp(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/logSumExp(axes:keepDimensions:))

Adds a log-sum-exp reduction operation along the given axis operation to the current graph.

[`func lstm(initialHiddenStates: BNNSGraph.Builder.Tensor<T>, initialCellStates: BNNSGraph.Builder.Tensor<T>, inputHiddenWeight: BNNSGraph.Builder.Tensor<T>, hiddenHiddenWeight: BNNSGraph.Builder.Tensor<T>, bias: BNNSGraph.Builder.Tensor<T>, direction: BNNSGraph.Builder.Direction, activation: BNNSGraph.Builder.Activation, recurrentActivation: BNNSGraph.Builder.Activation, cellActivation: BNNSGraph.Builder.Activation, outputSequence: Bool) -> (output: BNNSGraph.Builder.Tensor<T>, hiddenStates: BNNSGraph.Builder.Tensor<T>, memoryStates: BNNSGraph.Builder.Tensor<T>)`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/lstm(initialHiddenStates:initialCellStates:inputHiddenWeight:hiddenHiddenWeight:bias:direction:activation:recurrentActivation:cellActivation:outputSequence:))

Adds an LSTM operation to the current graph.

[`func matmul(transpose: Bool, other: some BNNSGraph.Builder.OperationParameter<T>, transposeOther: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/matmul(transpose:other:transposeOther:))

Adds a matrix-matrix multiplication operation to the current graph.

[`func matmul(transpose: Bool, other: some BNNSGraph.Builder.OperationParameter<T>, transposeOther: Bool, bias: some BNNSGraph.Builder.OperationParameter<T>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/matmul(transpose:other:transposeOther:bias:))

Adds a matrix-matrix multiplication operation to the current graph.

[`func max(y: some BNNSGraph.Builder.OperationParameter<T>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/max(y:))

Adds an element-wise maximum operation to the current graph.

[`func maximum(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/maximum(axes:keepDimensions:))

Adds a maximum reduction operation along the given axis operation to the current graph.

[`func mean(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/mean(axes:keepDimensions:))

Adds a mean reduction operation along the given axis operation to the current graph.

[`func min(y: some BNNSGraph.Builder.OperationParameter<T>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/min(y:))

Adds an element-wise minimum operation to the current graph.

[`func minimum(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/minimum(axes:keepDimensions:))

Adds a minimum reduction operation along the given axis operation to the current graph.

[`func pad(BNNSGraph.Builder.Padding, padding: [Int]) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/pad(_:padding:))

Adds a padding operation to the graph

[`func pooling(BNNSGraph.Builder.PoolingFunction, kernelSize: [Int], strides: [Int], padding: BNNSGraph.Builder.PoolingPadding, ceilingMode: BNNSGraph.Builder.CeilingMode) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/pooling(_:kernelSize:strides:padding:ceilingMode:))

Adds a pooling operation to the current graph.

[`func pow(y: some BNNSGraph.Builder.OperationParameter<T>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/pow(y:))

Adds an element-wise power operation to the current graph.

[`func prelu(alpha: [Float]) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/prelu(alpha:))

Adds a Parametric ReLU (PReLU) activation operation to the current graph.

[`func product(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/product(axes:keepDimensions:))

Adds a product reduction operation along the given axis operation to the current graph.

[`func reciprocal(epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/reciprocal(epsilon:))

Adds an element-wise reciprocal operation to the current graph.

[`func relu() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/relu())

Adds a Rectified Linear Unit (ReLU) activation operation to the current graph.

[`func relu6() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/relu6())

Adds a Rectified Linear Unit 6 (ReLU6)  activation operation to the current graph.

[`func reshape(to: some BNNSGraph.Builder.OperationParameter<Int32>) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/reshape(to:)-5oniw)

Adds a dynamic reshape operation to the current graph.

[`func reshape(to: [Int]) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/reshape(to:)-9stle)

Adds a reshape operation to the current graph.

[`func rmsNorm(scale: some BNNSGraph.Builder.OperationParameter<T>, epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/rmsNorm(scale:epsilon:))

Adds an RMS spatial normalization operation to the current graph.

[`func rnn(initialHiddenStates: BNNSGraph.Builder.Tensor<T>, inputHiddenWeight: BNNSGraph.Builder.Tensor<T>, hiddenHiddenWeight: BNNSGraph.Builder.Tensor<T>, bias: BNNSGraph.Builder.Tensor<T>, direction: BNNSGraph.Builder.Direction, activation: BNNSGraph.Builder.Activation, outputSequence: Bool) -> (output: BNNSGraph.Builder.Tensor<T>, hiddenStates: BNNSGraph.Builder.Tensor<T>)`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/rnn(initialHiddenStates:inputHiddenWeight:hiddenHiddenWeight:bias:direction:activation:outputSequence:))

Adds an RNN operation to the current graph.

[`func round() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/round())

Adds an element-wise round operation to the current graph.

[`func rsqrt(epsilon: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/rsqrt(epsilon:))

Adds an element-wise rsqrt operation to the current graph.

[`func scaledTanh(alpha: Float, beta: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/scaledTanh(alpha:beta:))

Adds a scaled tanh activation operation to the current graph.

[`func scatter(updates: BNNSGraph.Builder.Tensor<T>, indices: some BNNSGraph.Builder.OperationParameter<Int32>, mode: BNNSGraph.Builder.ScatterMode, axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/scatter(updates:indices:mode:axis:))

Adds a scatter operation to the current graph.

[`func scatterAlongAxis(updates: BNNSGraph.Builder.Tensor<T>, indices: some BNNSGraph.Builder.OperationParameter<Int32>, mode: BNNSGraph.Builder.ScatterMode, axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/scatterAlongAxis(updates:indices:mode:axis:))

Adds a scatter-along-axis operation to the current graph

[`func scatterND(updates: BNNSGraph.Builder.Tensor<T>, indices: some BNNSGraph.Builder.OperationParameter<Int32>, mode: BNNSGraph.Builder.ScatterMode) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/scatterND(updates:indices:mode:))

Adds a scatter-nd operation to the current graph.

[`func select<U>(BNNSGraph.Builder.Tensor<U>, BNNSGraph.Builder.Tensor<U>) -> BNNSGraph.Builder.Tensor<U>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/select(_:_:)-1fiqe)

Adds a tensor-tensor select operation to the current graph.

[`func select<U>(BNNSGraph.Builder.Tensor<U>, any BNNSGraph.Builder.OperationParameter<U>) -> BNNSGraph.Builder.Tensor<U>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/select(_:_:)-3ha1f)

Adds a tensor-scalar select operation to the current graph.

[`func select<U>(any BNNSGraph.Builder.OperationParameter<U>, BNNSGraph.Builder.Tensor<U>) -> BNNSGraph.Builder.Tensor<U>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/select(_:_:)-77itm)

Adds a scalar-tensor select operation to the current graph.

[`func sigmoid() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/sigmoid())

Adds a sigmoid activation operation to the current graph.

[`func silu() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/silu())

Adds a Sigmoid Linear Unit (SiLU) activation operation to the current graph.

[`func sin() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/sin())

Adds an element-wise sin operation to the current graph.

[`func sinh() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/sinh())

Adds an element-wise sinh operation to the current graph.

[`func softmax(axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/softmax(axis:))

Adds a softmax along the given axis operation to the current graph.

[`func softplus(alpha: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/softplus(alpha:))

Adds a softplus activation operation to the current graph.

[`func softsign() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/softsign())

Adds a softsign activation operation to the current graph.

[`func sqrt() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/sqrt())

Adds an element-wise sqrt operation to the current graph.

[`func squeeze(axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/squeeze(axis:))

Adds a squeeze operation in the graph.

[`func sum(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/sum(axes:keepDimensions:))

Adds a sum reduction operation along the given axis operation to the current graph.

[`func sumOfSquares(axes: [Int], keepDimensions: Bool) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/sumOfSquares(axes:keepDimensions:))

Adds a sum-of-squares reduction operation along the given axis operation to the current graph.

[`func tan() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/tan())

Adds an element-wise tan operation to the current graph.

[`func tanh() -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/tanh())

Adds an element-wise hyperbolic tangent operation to the current graph.

[`func tensorShape() -> BNNSGraph.Builder.Tensor<Int32>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/tensorShape())

Adds a shape operation to the current graph.

[`func threshold(to: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/threshold(to:))

Adds an element-wise round operation to the current graph.

[`func thresholdedReLU(alpha: Float) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/thresholdedReLU(alpha:))

Adds a Thresholded Leaky Rectified Linear Unit (ReLU) activation operation to the current graph.

[`func topK(Int, axis: Int, findLargest: Bool) -> (values: BNNSGraph.Builder.Tensor<T>, indices: BNNSGraph.Builder.Tensor<Int32>)`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/topK(_:axis:findLargest:))

Adds a top-k operation to the current graph.

[`func transpose(axes: [Int]) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/transpose(axes:))

Adds a transpose operation to the current graph.

[`func unsqueeze(axis: Int) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/unsqueeze(axis:))

Adds an unsqueeze operation in the graph.

### Subscripts

[`subscript(any BNNSGraph.Builder.SliceIndex...) -> BNNSGraph.Builder.Tensor<T>`](/documentation/Accelerate/BNNSGraph/Builder/Tensor/subscript(_:))

Adds a slice operation to the current graph.

### Default Implementations

[OperationParameter Implementations](/documentation/Accelerate/BNNSGraph/Builder/Tensor/OperationParameter-Implementations)

## Relationships

### Conforms To

[`Escapable`](/documentation/Swift/Escapable)

[`TensorDescriptor`](/documentation/Accelerate/BNNSGraph/TensorDescriptor)

[`Copyable`](/documentation/Swift/Copyable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`OperationParameter`](/documentation/Accelerate/BNNSGraph/Builder/OperationParameter)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)