小编foo*_*675的帖子

无法让 pytorch 与张量板一起工作

我正在通过本教程使用 tensorboard https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html#设置 pytorch(v1.3.0 通过 conda)

但在台阶上

from torch.utils.tensorboard import SummaryWriter

# default `log_dir` is "runs" - we'll be more specific here
writer = SummaryWriter('runs/fashion_mnist_experiment_1')
Run Code Online (Sandbox Code Playgroud)

我不断收到错误

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
C:\ProgramData\Anaconda3\envs\fastai_v1\lib\site-packages\torch\utils\tensorboard\__init__.py in 
      1 try:
----> 2     from tensorboard.summary.writer.record_writer import RecordWriter  # noqa F401
      3 except ImportError:

ModuleNotFoundError: No module named 'tensorboard.summary'; 'tensorboard' is not a package

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
c:\Users\matt\Documents\code\playground\tensorboard.py in 
----> 1 from …
Run Code Online (Sandbox Code Playgroud)

python data-visualization machine-learning tensorboard pytorch

14
推荐指数
3
解决办法
2万
查看次数

在sql alchemy 1.4中进行连接查询时发生异常:MissingGreenlet

SQLAlchemy 1.4.17我正在尝试在 pytest 中进行简单的查询

def test_first():
    engine = create_engine(settings.SQLALCHEMY_DATABASE_URI)
    result = engine.execute(text("SELECT email FROM user"))
Run Code Online (Sandbox Code Playgroud)

但我收到这个错误

Exception has occurred: MissingGreenlet
greenlet_spawn has not been called; can't call await_() here. Was IO attempted in an unexpected place? (Background on this error at: http://sqlalche.me/e/14/xd2s)
  File "/Users/mattc/Development/inference/server/inference_server/app/tests/test_01_user.py", line 27, in test_first
    result = engine.execute(text("SELECT email FROM user"))
Run Code Online (Sandbox Code Playgroud)

不知道为什么?有什么建议么?

python sqlalchemy

8
推荐指数
1
解决办法
2万
查看次数

当点击网页上的后退按钮时,Riverpod 会给出错误状态异常

当有人点击网页上的后退按钮时,我在 StateNotifiers 中收到此错误。我已将其隔离到下面请求的地方longRunningAPI

Exception has occurred.
"Error: Bad state: Tried to use RunListNotifier after `dispose` was called.
Run Code Online (Sandbox Code Playgroud)

我有这样的代码。

final runListController = StateNotifierProvider.autoDispose
    .family<RunListNotifier, AsyncValue<List<Run>>, RunListParameter>(
        (ref, param) {
  return RunListNotifier(read: ref.read, param: param);
});

class RunListNotifier extends StateNotifier<AsyncValue<List<Run>>> {
  RunListNotifier({required this.read, required this.param})
      : super(AsyncLoading()) {
    fetchViaAPI(param);
  }

  final Reader read;
  final RunListParameter param;
  void fetchViaAPI(RunListParameter param) async {
    state = AsyncLoading();
    try {
      List<Run> stuff = await read(apiProvider).longRunningAPI(param: param);
      state = AsyncData(stuff);
    } catch (e) {
      state …
Run Code Online (Sandbox Code Playgroud)

flutter riverpod

7
推荐指数
1
解决办法
3898
查看次数

如何在vscode中打印出熊猫数据框

在终端中,我可以打印出a的值,dataframe并且以可读的方式打印出

在此处输入图片说明

与在vscode中一样,在调试器中运行时,它打印成一行很长,很难阅读。

在此处输入图片说明

关于如何使其在vscode上更具可读性的任何建议?

pandas visual-studio-code

5
推荐指数
2
解决办法
7249
查看次数

当我知道文件存在时,导入时出现 E0611 错误

使用pylintE0611当我知道文件存在并且脚本运行良好时,我在导入时遇到错误。建议?我用错误注释了下面的图像。

在此处输入图片说明

pylint

5
推荐指数
1
解决办法
3140
查看次数

如何将 -f 要求添加到 piprequirements.txt 文件

我想安装 Detectron2,查看本教程 https://detectron2.readthedocs.io/en/latest/tutorials/install.html 但不确定如何将 -f URL 放入 pip requests.txt

我尝试的所有内容都给出了错误,并且我找不到相关文档。

在此输入图像描述

建议?

python pip

3
推荐指数
1
解决办法
1578
查看次数

将 ConsumerWidget 嵌套在 Riverpod 中可以吗?

在Riverpods中,可以嵌套ConsumerWidgets吗?像这样的东西吗?我想这样做是为了将我的 api 分开,但感觉这可能会降低性能?

class Foo1 extends ConsumerWidget {
  @override
  Widget build(BuildContext context, ScopedReader watch) {
    // watch something
    return Container(
      child: Foo2(),
    );
  }
}

class Foo2 extends ConsumerWidget {
  @override
    // watch something
  Widget build(BuildContext context, ScopedReader watch) {
    return Container();
  }
}
Run Code Online (Sandbox Code Playgroud)

flutter riverpod

3
推荐指数
1
解决办法
531
查看次数

如何增加swift int枚举

我有一个快速的枚举

 enum MainState : Int {
     case NotStarted
     case Init
     case AskWhatToText
     case RecordWhatToText
 }    
 var state = MainState.NotStarted
Run Code Online (Sandbox Code Playgroud)

并希望做类似的事情

state++
Run Code Online (Sandbox Code Playgroud)

但得到一个错误.建议?

swift

2
推荐指数
2
解决办法
2685
查看次数