openmlsys-zh
openmlsys-zh copied to clipboard
generation_of_computational_graph ms_function code indent issue
@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