contributed by < Jordymalone >
第一周測驗題
測驗 1
目標: 完成 list_insert_before 函式
以下程式碼運用〈你所不知道的 C 語言: linked list 和非連續記憶體〉提及的 "a pointer to a pointer" 技巧,撰寫鏈結串列的經典操作。
解釋程式碼運作原理
考慮以下程式碼:
JordyMalone changed a month agoView mode Like Bookmark
contributed by: <JordyMalone> Github
Part A: Mathematical Functions
In this section, we will implement fundamental matrix operations commonly used in neural networks. We will create functions for the following:
Dot Product: This function will calculate the dot product of two vectors.
Matrix Multiplication: This function will handle the multiplication of two matrices.
Element-wise ReLU (Rectified Linear Unit): This function will apply the ReLU activation function element-wise, replacing negative values with 0.
Argmax: This function will find the index of the maximum value within an array.
JordyMalone changed 5 months agoView mode Like Bookmark
contributed by <JordyMalone>
Quiz 1 - Problem C
Problem analysis
In this problem, we utilized three functions: fabsf, my_clz and fp16_to_fp32.
The fabsf function, discussed in Problem A, calculates the absolute value of a floating-point number. Rather than using traditional arithmetic operations, it clears the sign bit through a bitwise operation to return the result.
The my_clz function counts the number of leading zero bits in the binary representation of an unsigned integer, starting from the most significant bit. It then returns an integer that represents how many zero bits precede the first 1 in the binary representation of the number.
The fp16_to_fp32 function converts a 16-bit floating-point number in IEEE half-precision format to a 32-bit floating-point number in single-precision format. The my_clz function is also used in fp16_to_fp32.
JordyMalone changed 6 months agoView mode Like Bookmark