empty
empty

Reputation: 5434

How to add a slice to a Torch7 Tensor?

I am using Lua and Torch 7.

How do I efficiently (without for loops) add Tensors A and B of size (1, 2048, 1024) together to produce a Tensor C of size (2, 2048, 1024)?

I am using the package and documentation at https://github.com/torch/torch7/blob/master/doc/tensor.md but I don't see a function that can help me.

Upvotes: 0

Views: 147

Answers (1)

Dimitry
Dimitry

Reputation: 2358

Some function are in the torch library instead of tensor https://github.com/torch/torch7/blob/master/doc/maths.md#res-torchcat-res-x_1-x_2-dimension- . Maybe this function will be needed to add third dimension before concatenating : https://github.com/torch/torch7/blob/master/doc/tensor.md#result-expandresult-sizes

Upvotes: 1

Related Questions