I want to Reshape FunctionalTensor using Functional.Reshape().
For this purpose, I want to get shape of source FunctionalTensor.
However, FunctionalTensor does not seem to have a shape member like a Tensor.
How to get original shape of FunctionalTensor?
Any good ways to make this?
var graph = new FunctionalGraph();
var inputs = graph.AddInputs(model);
var outputs = graph.Forward(model, inputs);
var output = outputs[0];
var shape = /* how to get shape of output? */
var reshaped_output = output.Reshape(new int[3] { shape[0], shape[1] * shape[2], shape[3] }); // e.g. (dim0, dim1, dim2, dim3) -> (dim0, dim1 * dim2, dim3)
var edited_model = graph.Compile(reshaped_output);
You can use Debug.Log(functionalTensor) to print the shape of your tensor for debugging purposes. We will expand the capabilities of functional tensors in the future for better support of shapes and data types.
Yes, I know that.
I want to dynamically process to inputted models of various shapes.
For that you have to get the tensor shape at run time, that depends on the inputted models.
I’m glad your team will consider this features. Thanks,