MACE移植要求

2022-09-09 14:12:24 字數 1113 閱讀 9777

mace支援tensorflow的depth_to_space和space_to_depth,以及strided_slice運算元。

其中depth_to_space可以用來無平滑地進行上取樣。

space_to_depth無損地下取樣。

strided_slice一般採用tensor[index_a : index_b]的方式使用,但stride_slice很不成熟,最好不用,採用掩膜(mask)相乘的方式來計算

tf.reduce_mean在mace中不支援channel axis的合併

tf.minimum不支援,但可以用-(tf.maximum(-x, w))來實現

mace在gpu上不支援matmul,所以只能採用tf.nn.conv2d來實現全連線。如下:

def

gray_world_balance(x):

mean_ = tf.maximum(tf.reduce_mean(x, axis=(1, 2), keepdims=true), 1e-6)

print

(mean_.shape)

kernel = np.array([[[[0.333333, 0.333333, 0.333333, 0.333333],

[0.333333, 0.333333, 0.333333, 0.333333],

[0.333333, 0.333333, 0.333333, 0.333333],

[0.0, 0.0, 0.0, 0.0]]]], dtype=np.float32)

w_ = tf.constant(kernel, dtype=tf.float32)

print

(w_.shape)

global_mean_ = tf.nn.conv2d(input=mean_, filter=w_, strides=(1, 1, 1, 1), padding='

valid')

print

(global_mean_.shape)

ratio_ = global_mean_ /mean_

print

(ratio_.shape)

return -tf.maximum(-x * ratio_, -1.0)

小公尺開源框架MACE 原始碼閱讀筆記 1

enum devicetype 框架支援的裝置型別及其對應id.enum macestatus 函式的返回型別macetensor 定義了mace輸入輸出tensor,有幾個不同形式的建構函式 maceengine 作為mace框架引擎,根據建構函式傳入的devicetype執行相應的功能 作為深入...

移植作業系統的對微處理器的要求

1.什麼是移植?就是使選用的實時核心能在某乙個特定的微處理器上執行。為了方便移植,大部分的實時作業系統 都是用c語言編寫的。但仍然需要用c和組合語言編寫一些與微處理器相關的 因為有一些操作需要組合語言才能實現。2.作業系統對微處理器的要求?首先,要移植作業系統,就要明白作業系統對微處理器的要求。由於...

系統移植 核心移植

irom soc samsung固化的位址 iram soc 256k dram 片上外設 記憶體 norflash 讀快 啟動u boot noneflash 寫快 啟動u boot emmc 包括noneflash和讀寫noneflash的控制器 sdmmc sd卡 bl1 bl2 1.irom...