Question on Reshape shape tensor input

I’m making a Reshape layer, and in the constructor, one parameter is
shape: The name to use for the 1D shape tensor of the layer

So I’m creating a separate tensor, which this layer will reference by name (right?)

Does this mean, it’ll use that tensors shape for the reshaping?
Or, will it use it as a data container, and pull the desired output shape out of the tensor’s inner numerical data?

Like if I’m going from [1,16,4,4] input, to [1, 256] output, I should be creating a one dimensional Tensor with two elements, 1 and 256?
Or should I create a [1, 256] tensor filled with zeroes?

yeah, AFAIK, you would do this:

TensorInt myshape = new TensorInt(new TensorShape(2), new[] { 1, 256 });
model.AddConstant(new Unity.Sentis.Layers.Constant("myshape", myshape));

then dispose of myshape when your program closes.

1 Like

Thanks for the interest in building models directly.
We’ll make building a model easier in the future :slight_smile:
In the meantime, do note that you can use a GPUComputeOp.Reshape(tensor, shape) or do tensor.ShallowReshape(shape)