1

My model accepts data in the shape(1, 32, 32, 3), I am looking for a way to pass the data using np.array from numpy. Any help on this will be appreciated please

5
  • What is the shape of your input data ? Commented Jun 5, 2023 at 15:09
  • np.random.rand(1, 32, 32, 3) Commented Jun 5, 2023 at 15:09
  • @rochard4u my shape of the input data is shape": [1, 32, 32, 3] and datatype is fp32 Commented Jun 5, 2023 at 15:22
  • Thanks @GodIsOne, How can I add it to numpy.array ? Commented Jun 5, 2023 at 15:23
  • @Mahesh just assign it to a variable. It will be your numpy array. arr=np.random.rand(1, 32, 32, 3). So now arr is your numpy array with shape (1, 32, 32, 3) Commented Jun 5, 2023 at 15:50

1 Answer 1

2

Your data right now is a one-dimensional array you want to convert your input data to a 4-dimensional array? Because a 4d array is a matrice of matrices the data input you have right now looks like a singular index within a matrix of the bigger matrix of matrixes. to create a 4d array it just:

a = np.random.rand(1, 32, 32, 3)

to get something better we need the structure of your data

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.