雲端計算.

Slides:



Advertisements
Similar presentations
2.3 Modeling Real World Data with Matrices
Advertisements

Section 13-4: Matrix Multiplication
Maths for Computer Graphics
Matrices The Basics Vocabulary and basic concepts.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
4.2 Operations with Matrices Scalar multiplication.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
AIM: How do we perform basic matrix operations? DO NOW:  Describe the steps for solving a system of Inequalities  How do you know which region is shaded?
If A and B are both m × n matrices then the sum of A and B, denoted A + B, is a matrix obtained by adding corresponding elements of A and B. add these.
4.3 Matrix Multiplication 1.Multiplying a Matrix by a Scalar 2.Multiplying Matrices.
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
8.2 Operations With Matrices
1.3 Solutions of Linear Systems
Warm Up Perform the indicated operations. If the matrix does not exist, write impossible
MATRIX A set of numbers arranged in rows and columns enclosed in round or square brackets is called a matrix. The order of a matrix gives the number of.
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
Chapter 5: Matrices and Determinants Section 5.5: Augmented Matrix Solutions.
4-3 Matrix Multiplication Objective: To multiply a matrix by a scalar multiple.
Add and subtract matrices. Multiply by a matrix scalar.
2.3 MODELING REAL WORLD DATA WITH MATRICES By the end of the section students will be able to add, subtract, and multiply matrices of various sizes. Students.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
Ch. 12 Vocabulary 1.) matrix 2.) element 3.) scalar 4.) scalar multiplication.
13.4 Product of Two Matrices
Sections 2.4 and 2.5 Matrix Operations
Lesson 43: Working with Matrices: Multiplication
12-1 Organizing Data Using Matrices
Multiplying Matrices.
Linear Algebra review (optional)
Tensorflow Tutorial Homin Yoon.
Matrix Operations.
What we’re learning today:
Matrix Multiplication
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Section 3.3 – The Cross Product
Intro to NLP and Deep Learning
Section 10.4 – Determinant of a SQUARE Matrix
Matrix Operations SpringSemester 2017.
Multiplying Matrices.
WarmUp 2-3 on your calculator or on paper..
INF 5860 Machine learning for image classification
7.3 Matrices.
Introduction to TensorFlow
Warmup Solve each system of equations. 4x – 2y + 5z = 36 2x + 5y – z = –8 –3x + y + 6z = 13 A. (4, –5, 2) B. (3, –2, 4) C. (3, –1, 9) D. no solution.
Multiplying Matrices.
[ ] [ ] [ ] [ ] EXAMPLE 3 Scalar multiplication Simplify the product:
MNIST Dataset Training with Tensorflow
MATRICES MATRIX OPERATIONS.
2.2 Introduction to Matrices
Section 3.2 – Determinant of a SQUARE Matrix
Multiplying Matrices.
Matrix Addition
Section 10.4 – Determinant of a SQUARE Matrix
Tensorflow Tutorial Presented By :- Ankur Mali
Multi-Dimensional Arrays
Tensorflow Lecture 박 영 택 컴퓨터학부.
Matrices.
Linear Algebra review (optional)
1.8 Matrices.
Matrix Operations Ms. Olifer.
What is the dimension of the matrix below?
Matrix Operations SpringSemester 2017.
1.8 Matrices.
Multiplying Matrices.
3.5 Perform Basic Matrix Operations Algebra II.
Multiplying Matrices.
Introduction to Matrices
MATRICES MATTER!.
Multiplying Matrices.
Presentation transcript:

雲端計算

Tensorflow Python3.5 while

Tensorflow

tensorflow結構

hello world from __future__ import print_function import tensorflow as tf try: tf.contrib.eager.enable_eager_execution() except ValueError: pass # enable_eager_execution errors after its first call tensor = tf.constant('Hello, world!') tensor_value = tensor.numpy() print(tensor_value)

tensors 張量 任意維度的陣列 scalar純量: 0-d array vector向量: 1-d array ‘hello’ or 5 vector向量: 1-d array [2, 3, 5, 7, 11] or [5] matrix矩陣: 2-d array [[3.1, 8.2, 5.9][4.3, -2.7, 6.5]]

constant import tensorflow as tf x = tf.constant(5.2) y = tf.Variable([5]) y = tf.Variable([0]) y = y.assign([5]) with tf.Session() as sess: print(x.eval())

tf.add() from __future__ import print_function import tensorflow as tf g = tf.Graph() with g.as_default(): x = tf.constant(8, name="x_const") y = tf.constant(5, name="y_const") my_sum = tf.add(x, y, name="x_y_sum") with tf.Session() as sess: print(my_sum.eval())

Define a third scalar integer constant, z, and assign it a value of 4 Define a third scalar integer constant, z, and assign it a value of 4. Add z to my_sum to yield a new sum. Solution: import tensorflow as tf g = tf.Graph() with g.as_default(): x = tf.constant(8, name="x_const") y = tf.constant(5, name="y_const") my_sum = tf.add(x, y, name="x_y_sum") z = tf.constant(4, name="z_const") new_sum = tf.add(my_sum, z, name="x_y_z_sum") with tf.Session() as sess: print(new_sum.eval())

Vector Addition 向量加法 import tensorflow as tf with tf.Session() as sess: primes = tf.constant([2, 3, 5, 7, 11, 13], dtype=tf.int32) print("primes:", primes.eval()) ones = tf.ones([6], dtype=tf.int32) print("ones:", ones.eval()) just_beyond_primes = tf.add(primes, ones) print("just_beyond_primes:", just_beyond_primes.eval()) twos = tf.constant([2, 2, 2, 2, 2, 2], dtype=tf.int32) primes_doubled = primes * twos print("primes_doubled:", primes_doubled.eval())

shape import tensorflow as tf with tf.Session() as sess: # A scalar (0-D tensor). scalar = tf.zeros([]) # A vector with 3 elements. vector = tf.zeros([3]) # A matrix with 2 rows and 3 columns. matrix = tf.zeros([2, 3]) print('scalar has shape', scalar.get_shape(), 'and value:\n', scalar.eval()) print('vector has shape', vector.get_shape(), 'and value:\n', vector.eval()) print('matrix has shape', matrix.get_shape(), 'and value:\n', matrix.eval())

matrix multiplication 矩陣乘法 import tensorflow as tf with tf.Session() as sess: # A 3x4 matrix (2-d tensor). x = tf.constant([[5, 2, 4, 3], [5, 1, 6, -2], [-1, 3, -1, -2]], dtype=tf.int32) # A 4x2 matrix (2-d tensor). y = tf.constant([[2, 2], [3, 5], [4, 5], [1, 6]], dtype=tf.int32) # Multiply `x` by `y`; result is 3x2 matrix. matrix_multiply_result = tf.matmul(x, y) print(‘3x4 matrix:’) print(x.eval()) print(‘4x2 matrix:’) print(y.eval()) print(matrix_multiply_result.eval())

reshaping import tensorflow as tf matrix = tf.constant( [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]], dtype=tf.int32) reshaped_2x8_matrix = tf.reshape(matrix, [2, 8]) reshaped_4x4_matrix = tf.reshape(matrix, [4, 4]) print("Original matrix (8x2):") print(matrix.eval()) print("Reshaped matrix (2x8):") print(reshaped_2x8_matrix.eval()) print("Reshaped matrix (4x4):") print(reshaped_4x4_matrix.eval())

驗收 a = tf.constant([5, 3, 2, 7, 1, 4]) b = tf.constant([4, 6, 3])

Python3.5 while

del remove()

pop()

sorted() 回傳一個排序好新的list,可用來排序任何的string, list, dictionary, tuple... 預設: 從小排到大 參數 reverse=True :從大排到小

串列的串列 不換行

while

while…else…

break

continue

random

驗收 Create 20 random value in a list *use pop()

驗收 Create 20 random value in a list *use pop()