---
title: "graphBuilderTensor(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/arrayslice/graphbuildertensor(_:)"
---

# graphBuilderTensor(_:)

Returns a tensor for the specified BNNS Graph builder.

## Declaration

```swift
func graphBuilderTensor(_ builder: BNNSGraph.Builder) -> BNNSGraph.Builder.Tensor<Element>
```

## Discussion

Discussion The following code shows how to use this function to register a tensor from an array slice.    let x = ([0, 1, 2, 3, 4, 5] as [Float])[1...4]    let y = ([4, 5, 6, 7, 8, 9] as [Float])[1...4]

let context = try BNNSGraph.makeContext {        builder in

let x = x.graphBuilderTensor(builder)

let z = x.matmul(transpose: true,                         other: y)

return [z] // On return, `z[0]` equals `70`.    }
