【发布时间】:2018-03-02 12:52:11
【问题描述】:
我正在尝试使用 PyTorch 训练模型。有没有什么简单的方法可以从 Tensorflow 中创建像 weighted_cross_entropy_with_logits 这样的损失?
weighted_cross_entropy_with_logits 中有 pos_weight 参数可以帮助平衡。但是BCEWithLogitsLoss 的参数列表中只有标签的权重。
【问题讨论】:
-
顺便说一句,我已经实现了
pos_weight,并且相应的拉取请求已合并到 PyTorch 0.4.1 中。见the docs
标签: tensorflow machine-learning pytorch