openmlsys / openmlsys-zh

《Machine Learning Systems: Design and Implementation》- Chinese Version
https://openmlsys.github.io
3.93k stars 426 forks source link

generation_of_computational_graph ms_function code indent issue #456

Open nope8 opened 1 year ago

nope8 commented 1 year ago

@ms_function #mindspore中基于源码转换的函数装饰器,可以将该函数转换为静态图 def add_and_relu(Y, b): Y = Y + b Y = relu(Y) return Y

def model(X, flag): if flag>0: Y = matmul(W1, X) else: Y = matmul(W2, X) Y = add_and_relu(Y, b) //code indent error return Y

should change to:

@ms_function #mindspore中基于源码转换的函数装饰器,可以将该函数转换为静态图 def add_and_relu(Y, b): Y = Y + b Y = relu(Y) return Y

def model(X, flag): if flag>0: Y = matmul(W1, X) else: Y = matmul(W2, X) Y = add_and_relu(Y, b) return Y