为您找到相关结果95,826个
GCN 图神经网络使用详解 可视化 Pytorch_python_脚本之家
# Gather some statistics about the graph. print(f'Number of nodes: {data.num_nodes}') print(f'Number of edges: {data.num_edges}') print(f'Average node degree: {data.num_edges / data.num_nodes:.2f}') print(f'Number of training nodes: {data.train_mask.sum()}') print(f'Training...
www.jb51.net/article/2702...htm 2025-3-13
tensorflow estimator 使用hook实现finetune方式_python_脚本之家
# ops can no longer be added to the graph. print('Session created.') tf.logging.info('Fine-tuning from %s' % self.checkpoint_path) self.saver.restore(session, os.path.expanduser(self.checkpoint_path)) tf.logging.info('End fineturn from %s' % self.checkpoint_path) def before_run(self...
www.jb51.net/article/1789...htm 2025-3-4
PyTorch训练LSTM时loss.backward()报错的解决方案_python_脚本之家
RuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time. 千万别改成loss.backward(retain_graph=True),会导致显卡内存随着训练一直增加直到OOM: ...
www.jb51.net/article/2137...htm 2025-3-16
使用D3.js构建实时图形的示例代码_javascript技巧_脚本之家
// Select all bars on the graph, take them out, and exit the previous data set. // Enter the new data and append the rectangles for each object in the poll array svg .selectAll('.bar') .remove() .exit() .data(poll) .enter() .append('rect') .attr('class', 'bar') .attr(...
www.jb51.net/article/1463...htm 2025-2-26
Pytorch中的backward()多个loss函数用法_python_脚本之家
graph leaves.The graph is differentiated using the chain rule. If any of tensors are non-scalar (i.e. their data has more than one element) and require gradient, the function additionally requires specifying grad_tensors. It should be a sequence of matching length, that contains gradient of...
www.jb51.net/article/2131...htm 2025-3-4
pytorch中retain_graph==True的作用说明_python_脚本之家
总的来说进行一次backward之后,各个节点的值会清除,这样进行第二次backward会报错,如果加上retain_graph==True后,可以再来一次backward。 retain_graph参数的作用 官方定义: retain_graph (bool, optional) – If False, the graph used to compute the grad will be freed. Note that in nearly all cases settin...
www.jb51.net/article/2759...htm 2025-3-17
TensorFlow深度学习另一种程序风格实现卷积神经网络_python_脚本之家
# LAUNCH THE GRAPH sess = tf.Session() # 定义一个Session sess.run(init) #在sess里run一下初始化操作 # OPTIMIZE for epoch in range(training_epochs): avg_cost = 0. total_batch = int(mnist.train.num_examples/batch_size) for i in range(total_batch): batch_xs, batch_ys = mnist.train...
www.jb51.net/article/2272...htm 2025-3-9