gpt4 book ai didi

tensorflow-federated - TFF : Modify the process that includes an initialization and iterated computation

转载 作者:行者123 更新时间:2023-12-04 03:35:09 25 4
gpt4 key购买 nike

我可以在这段代码中写什么:

def initialize_fn():
...

最佳答案

iterative_process.initialize() 返回的state 对象通常是一个 Python 容器(tuple, collections.OrderedDict 等)包含 numpy 数组。要看到这一点,请在初始化后尝试 print(state)

也许在 initialze() 之后和在 next() 循环之前用从外部文件加载的值替换值:


def load_my_weights(filename):
# read from external file, create numpy arrays

iterative_process = IterativeProcess(initialize_fn, next_fn)
state = iterative_process.initialize()
state['model'] = load_my_weights(filename) # assumes 'model' is a key in state.
for round in range(num_rounds):
state = iterative_process.next(state)

关于tensorflow-federated - TFF : Modify the process that includes an initialization and iterated computation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67057583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com