Tuesday 19 November 2019

check shape of array in numpy and tensorflow

Numpy : its a python module/package to perform scientific computation on arrays.

How to install numpy package in anaconda

>> pip install  numpy

or

>> conda install numpy

To check if numpy package is  installed or not use

>> conda list
output :
>> numpy                     1.14.2

Once the package is installed you can import into you application

ex : import numpy

Basic numpy operation on Array :

>>> input = np.array([[1,2,3],[2,3,4]])
>>> input.shape
>>> (2, 3)


Ex : In digit recognition using tensorflow we can get shape

import tensorflow as tf
mnist = tf.keras.datasets.mnist
import numpy as np
print( tf.__version__)
(x_train, y_train),(x_test, y_test) = mnist.load_data()

print(x_train.shape);
>> (60000, 28, 28)
print( x_train[0].shape)
>> (28, 28) 


Note :
1. Tensorflow | keras| framework is used.
2. Mnist database for digit recognition

1 comment:



  1. Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well I really get amazed to read this. It's really good.
    I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!.
    mobile phone repair in Fredericksburg
    iphone repair in Fredericksburg
    cell phone repair in Fredericksburg
    phone repair in Fredericksburg
    tablet repair in Fredericksburg
    mobile phone repair in Fredericksburg
    mobile phone repair Fredericksburg
    iphone repair Fredericksburg
    cell phone repair Fredericksburg
    phone repair Fredericksburg

    ReplyDelete