graphBuilderTensor(_:)
Returns a tensor for the specified BNNS Graph builder.
Declaration
func graphBuilderTensor(_ builder: BNNSGraph.Builder) -> BNNSGraph.Builder.Tensor<Element>Discussion
The following code shows how to use this function to register a tensor from a contiguous array.
let x = ContiguousArray([1, 2, 3, 4] as [Float])
let y = ContiguousArray([5, 6, 7, 8] as [Float])
let context = try BNNSGraph.makeContext {
builder in
let x = x.graphBuilderTensor(builder)
let z = x.matmul(transpose: truee,
other: y)
return [z] // On return, `z[0]` equals `70`.
}