Coder Social home page Coder Social logo

Comments (6)

will0206 avatar will0206 commented on June 6, 2024

補充

後來我試著用swig編譯了library.i使其變成py
然後把src下所有檔案複製到test並且執行

(tensorflow_gpuenv) C:\Users\William\source\repos\alpha-zero-gomoku\test>python leaner_test.py play
Traceback (most recent call last):
File "leaner_test.py", line 6, in
import learner
File "C:\Users\William\source\repos\alpha-zero-gomoku\test\learner.py", line 17, in
from library import MCTS, Gomoku, NeuralNetwork
File "C:\Users\William\source\repos\alpha-zero-gomoku\test\library.py", line 15, in
import _library
ModuleNotFoundError: No module named '_library'

from alpha-zero-gomoku.

hijkzzz avatar hijkzzz commented on June 6, 2024

同学你好
请参考Releases页面编译好的工程结构

from alpha-zero-gomoku.

will0206 avatar will0206 commented on June 6, 2024

我試試看,謝謝您的回覆

from alpha-zero-gomoku.

Augustusmyc avatar Augustusmyc commented on June 6, 2024

系统win10,python用的anaconda的版本,python3.6.8,swig用的swigwin 4.0.0 (应该是最新版), cmake版本3.13.0-rc3

@wall1350 请问问题解决了么?我也遇到了和你相同的问题。

顺带一提,在执行cmake build 时遇到了“找不到python36_d.lib”的错误,我参考https://www.jianshu.com/p/6498af8ec352 注释掉了两行代码才解决,另外,cmake build 时出现了497个警告,这里粘贴一部分:
D:\Projects\libtorch\include\c10/core/TensorImpl.h(1018): warning C4244: “参数”: 从“float”转换到“const Ty”,可能丢失数据 [D:\Proj
ects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/core/TensorImpl.h(1416): warning C4244: “初始化”: 从“int64_t”转换到“int”,可能丢失数据 [D:\Project
s\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/LegacyTypeDispatch.h(137): warning C4251: “at::LegacyTypeDispatch::type_regist
ry”: class“std::unique_ptrat::Type,at::LegacyTypeDeleter”需要有 dll 接口由 class“at::LegacyTypeDispatch”的客户端使用 [D:\Projects
\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/DeprecatedTypePropertiesRegistry.h(27): warning C4251: “at::DeprecatedTypeProp
ertiesRegistry::registry”: class“std::unique_ptr<at::DeprecatedTypeProperties,std::default_delete<Ty>>”需要有 dll 接口由 cla
ss“at::DeprecatedTypePropertiesRegistry”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/Tensor.h(773): warning C4251: “at::Tensor::impl
”: class“c10::intrusive_ptr<c1
0::TensorImpl,c10::UndefinedTensorImpl>”需要有 dll 接口由 class“at::Tensor”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build
_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/Tensor.h(774): warning C4522: “at::Tensor”: 指定了多个赋值运算符 [D:\Projects\alpha-zero
-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/Tensor.h(801): warning C4251: “at::WeakTensor::weak_impl
”: class“c10::weak_in
trusive_ptr<TTarget,NullType>”需要有 dll 接口由 struct“at::WeakTensor”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_lib
rary.vcxproj]
D:\Projects\libtorch\include\ATen/LegacyTHDispatch.h(122): warning C4251: “at::LegacyTHDispatch::dispatcher_registry”
: class“std::unique_ptrat::LegacyTHDispatcher,at::LegacyTHDispatcherDeleter”需要有 dll 接口由 class“at::LegacyTHDispatch”的客
户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/core/Stream.h(126): warning C4244: “参数”: 从“unsigned int64”转换到“c10::DeviceIndex”,可能
丢失数据 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/core/Stream.h(126): warning C4244: “参数”: 从“unsigned int64”转换到“c10::StreamId”,可能丢失数
据 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/Context.h(134): warning C4251: “at::Context::generator_registry”: class“std::unique
ptr<at::Generator,std::default_delete<Ty>>”需要有 dll 接口由 class“at::Context”的客户端使用 [D:\Projects\alpha-zero-gomoku-master
\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/Context.h(151): warning C4251: “at::Context::thc_init”: struct“std::once_flag”需要有 d
ll 接口由 class“at::Context”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/Context.h(152): warning C4251: “at::Context::thh_init”: struct“std::once_flag”需要有 d
ll 接口由 class“at::Context”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/Context.h(153): warning C4251: “at::Context::complex_init
”: struct“std::once_flag”
需要有 dll 接口由 class“at::Context”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/Context.h(157): warning C4251: “at::Context::next_id”: struct“std::atomic”需要有 dll 接口由 class“at::Context”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/Context.h(158): warning C4251: “at::Context::thc_state”: class“std::unique_ptr<THCS
tate,void (cdecl *)(THCState *)>”需要有 dll 接口由 class“at::Context”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_li
brary.vcxproj]
D:\Projects\libtorch\include\ATen/Context.h(159): warning C4251: “at::Context::thh_state”: class“std::unique_ptr<THHS
tate,void (cdecl *)(THHState *)>”需要有 dll 接口由 class“at::Context”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_li
brary.vcxproj]
D:\Projects\libtorch\include\ATen/TensorGeometry.h(56): warning C4251: “at::TensorGeometry::sizes
”: class“std::vecto
r<int64_t,std::allocator<Ty>>”需要有 dll 接口由 struct“at::TensorGeometry”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build
_library.vcxproj]
D:\Projects\libtorch\include\ATen/TensorGeometry.h(57): warning C4251: “at::TensorGeometry::strides
”: class“std::vec
tor<int64_t,std::allocator<Ty>>”需要有 dll 接口由 struct“at::TensorGeometry”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\bui
ld_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/autograd/variable.h(331): warning C4251: “torch::autograd::Variable::Autograd
Meta::name”: class“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“torch::autogr
ad::Variable::AutogradMeta”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/autograd/variable.h(334): warning C4251: “torch::autograd::Variable::Autograd
Meta::grad_fn
”: class“std::shared_ptrtorch::autograd::Function”需要有 dll 接口由 struct“torch::autograd::Variable::Autogra
dMeta”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/autograd/variable.h(335): warning C4251: “torch::autograd::Variable::Autograd
Meta::grad_accumulator
”: class“std::weak_ptrtorch::autograd::Function”需要有 dll 接口由 struct“torch::autograd::Variable::
AutogradMeta”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/autograd/variable.h(337): warning C4251: “torch::autograd::Variable::Autograd
Meta::hooks
”: class“std::vector<std::shared_ptrtorch::autograd::FunctionPreHook,std::allocator<Ty>>”需要有 dll 接口由 str
uct“torch::autograd::Variable::AutogradMeta”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/autograd/variable.h(353): warning C4251: “torch::autograd::Variable::Autograd
Meta::mutex
”: class“std::mutex”需要有 dll 接口由 struct“torch::autograd::Variable::AutogradMeta”的客户端使用 [D:\Projects\alpha-ze
ro-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(27): warning C4251: “c10::ivalue::ConstantString::str
”: class“std::b
asic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“c10::ivalue::ConstantString”的客户端使用 [D:
\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(46): warning C4251: “c10::ivalue::List::elements”: class“std::
vector<Type,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::List”的客户端使用 [D:\Projects\alpha-zero-gomoku-mast
er\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(46): warning C4251: “c10::ivalue::Listc10::IValue::elements
”: clas
s“std::vector<Elem,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::Listc10::IValue”的客户端使用 [D:\Projects\alpha-zer
o-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(560): warning C4275: 非 dll 接口 class“std::exception”用作 dll 接口 struct“c
10::ivalue::Future::FutureError”的基 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(570): warning C4251: “c10::ivalue::Future::FutureError::error_msg”: c
lass“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“c10::ivalue::Future::Future
Error”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(676): warning C4251: “c10::ivalue::Future::mutex
”: class“std::mutex”
需要有 dll 接口由 struct“c10::ivalue::Future”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(678): warning C4251: “c10::ivalue::Future::completed
”: struct“std::a
tomic”需要有 dll 接口由 struct“c10::ivalue::Future”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(679): warning C4251: “c10::ivalue::Future::callbacks”: class“std::vec
tor<std::function<void (void)>,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::Future”的客户端使用 [D:\Projects\alpha-ze
ro-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(722): warning C4251: “c10::ivalue::Object::type
”: class“std::shared
ptrc10::ClassType”需要有 dll 接口由 struct“c10::ivalue::Object”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.
vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(723): warning C4251: “c10::ivalue::Object::slots”: class“std::vector
<Elem,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::Object”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_l
ibrary.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(728): warning C4251: “c10::ivalue::GenericDict::elements
”: class“std
::unordered_map<c10::IValue,c10::IValue,c10::ivalue::DictHash,c10::ivalue::DictEqualTo,std::allocator<std::pair<const _
Kty,Ty>>>”需要有 dll 接口由 struct“c10::ivalue::GenericDict”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxp
roj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(781): warning C4244: “return”: 从“double”转换到“float”,可能丢失数据 [D:\Project
s\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(783): warning C4244: “return”: 从“int64_t”转换到“unsigned char”,可能丢失数据 [D
:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(784): warning C4244: “return”: 从“int64_t”转换到“signed char”,可能丢失数据 [D:
Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(785): warning C4244: “return”: 从“int64_t”转换到“unsigned short”,可能丢失数据 [
D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(786): warning C4244: “return”: 从“int64_t”转换到“short”,可能丢失数据 [D:\Projec
ts\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(787): warning C4244: “return”: 从“int64_t”转换到“int”,可能丢失数据 [D:\Projects
\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(788): warning C4244: “return”: 从“int64_t”转换到“uint32_t”,可能丢失数据 [D:\Pro
jects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(790): warning C4244: “return”: 从“int64_t”转换到“c10::detail::guarded_un
signed_long”,可能丢失数据 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(46): warning C4251: “c10::ivalue::List<int64_t>::elements
”: class“st
d::vector<int64_t,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::List<int64_t>”的客户端使用 [D:\Projects\alpha-zero-gom
oku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(46): warning C4251: “c10::ivalue::List::elements
”: class“std
::vector<T,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::List”的客户端使用 [D:\Projects\alpha-zero-gomoku-mast
er\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(46): warning C4251: “c10::ivalue::List::elements
”: class“std::
vector<bool,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::List”的客户端使用 [D:\Projects\alpha-zero-gomoku-maste
r\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(46): warning C4251: “c10::ivalue::Listat::Tensor::elements
”: class
“std::vector<at::Tensor,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ivalue::Listat::Tensor”的客户端使用 [D:\Projects\alpha
-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/ivalue.h(1003): warning C4244: “参数”: 从“int64_t”转换到“const Kty”,可能丢失数据 [D:\Proj
ects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(66): warning C4251: “std::enable_shared_from_thisc10::Type::Wptr
”: class“std::weak_ptr<Ty>”需要有 dll 接口由 class“std::enable_shared_from_thisc10::Type”的客户端使用 [D:\Projects\alpha-zero-go
moku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(227): warning C4251: “c10::SingleElementType<c10::TypeKind::Optiona
lType,c10::OptionalType>::elem”: class“std::shared_ptrc10::Type”需要有 dll 接口由 struct“c10::SingleElementType<c10::TypeKi
nd::OptionalType,c10::OptionalType>”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(477): warning C4251: “c10::VaryingShape::size
”: class“c10::optiona
l<size_t>”需要有 dll 接口由 struct“c10::VaryingShape”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(478): warning C4251: “c10::VaryingShape::dims
”: class“std::vector<
c10::optional<int64_t>,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::VaryingShape”的客户端使用 [D:\Projects\alpha-zero-gomoku-
master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(571): warning C4251: “c10::ProfiledTensorType::scalar_type
”: class
“c10::optionalc10::ScalarType”需要有 dll 接口由 struct“c10::ProfiledTensorType”的客户端使用 [D:\Projects\alpha-zero-gomoku-master
\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(572): warning C4251: “c10::ProfiledTensorType::device
”: class“c10:
:optionalc10::Device”需要有 dll 接口由 struct“c10::ProfiledTensorType”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_l
ibrary.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(575): warning C4251: “c10::ProfiledTensorType::requires_grad
”: cla
ss“c10::optional”需要有 dll 接口由 struct“c10::ProfiledTensorType”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_l
ibrary.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(533): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据 [D:\Projects\al
pha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(537): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据 [D:\Projects\al
pha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(682): warning C4251: “c10::CompleteTensorType::sizes”: class“std::
vector<int64_t,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::CompleteTensorType”的客户端使用 [D:\Projects\alpha-zero-gomoku-ma
ster\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(683): warning C4251: “c10::CompleteTensorType::strides
”: class“std
::vector<int64_t,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::CompleteTensorType”的客户端使用 [D:\Projects\alpha-zero-gomoku-
master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(688): warning C4251: “c10::SingleElementType<c10::TypeKind::ListTyp
e,c10::ListType>::elem”: class“std::shared_ptrc10::Type”需要有 dll 接口由 struct“c10::SingleElementType<c10::TypeKind::List
Type,c10::ListType>”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(801): warning C4251: “c10::DictType::types”: class“std::vector<c10:
:TypePtr,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::DictType”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_libr
ary.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(808): warning C4251: “c10::SingleElementType<c10::TypeKind::FutureT
ype,c10::FutureType>::elem”: class“std::shared_ptrc10::Type”需要有 dll 接口由 struct“c10::SingleElementType<c10::TypeKind::
FutureType,c10::FutureType>”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(941): warning C4251: “c10::TupleType::elements
”: class“std::vector
<c10::TypePtr,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::TupleType”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build
_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(943): warning C4251: “c10::TupleType::names
”: class“c10::optional<
std::vector<std::string,std::allocator<Ty>>>”需要有 dll 接口由 struct“c10::TupleType”的客户端使用 [D:\Projects\alpha-zero-gomoku-m
aster\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(1450): warning C4251: “c10::ClassType::qualifiedName
”: class“std::
basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“c10::ClassType”的客户端使用 [D:\Projects\al
pha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(1454): warning C4251: “c10::ClassType::qualifier
”: class“std::basi
c_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“c10::ClassType”的客户端使用 [D:\Projects\alpha-
zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(1456): warning C4251: “c10::ClassType::basename”: class“std::basic
string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“c10::ClassType”的客户端使用 [D:\Projects\alpha-z
ero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(1464): warning C4251: “c10::ClassType::attributeNames
”: class“std:
:vector<std::string,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ClassType”的客户端使用 [D:\Projects\alpha-zero-gomoku-master
\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(1465): warning C4251: “c10::ClassType::attributeTypes
”: class“std:
:vector<c10::TypePtr,std::allocator<Ty>>”需要有 dll 接口由 struct“c10::ClassType”的客户端使用 [D:\Projects\alpha-zero-gomoku-maste
r\build_library.vcxproj]
D:\Projects\libtorch\include\ATen/core/jit_type.h(1467): warning C4251: “c10::ClassType::compilation_unit
”: class“st
d::shared_ptrtorch::jit::script::CompilationUnit”需要有 dll 接口由 struct“c10::ClassType”的客户端使用 [D:\Projects\alpha-zero-gom
oku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/scope.h(22): warning C4251: “torch::jit::Scope::parent”: class“c10::intr
usive_ptr<torch::jit::Scope,c10::detail::intrusive_target_default_null_type>”需要有 dll 接口由 struct“torch::jit::Sc
ope”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/constants.h(20): warning C4275: 非 dll 接口 class“std::runtime_error”用作 dll
接口 struct“torch::jit::constant_not_supported_error”的基 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/attributes.h(87): warning C4275: 非 dll 接口 struct“torch::jit::AttributeVal
ue”用作 dll 接口 struct“torch::jit::GraphAttr”的基 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/attributes.h(101): warning C4251: “torch::jit::GraphAttr::value_”: class“
std::shared_ptrtorch::jit::Graph”需要有 dll 接口由 struct“torch::jit::GraphAttr”的客户端使用 [D:\Projects\alpha-zero-gomoku-maste
r\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/attributes.h(104): warning C4275: 非 dll 接口 struct“torch::jit::AttributeVa
lue”用作 dll 接口 struct“torch::jit::GraphsAttr”的基 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/attributes.h(118): warning C4251: “torch::jit::GraphsAttr::value_”: class
“std::vector<std::shared_ptrtorch::jit::Graph,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::GraphsAttr”的客户端使用 [
D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/ir.h(246): warning C4251: “torch::jit::Node::inputs
”: class“std::vector<
torch::jit::Value *,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::Node”的客户端使用 [D:\Projects\alpha-zero-gomoku-mast
er\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/ir.h(247): warning C4251: “torch::jit::Node::outputs
”: class“std::vector
<torch::jit::Value *,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::Node”的客户端使用 [D:\Projects\alpha-zero-gomoku-mas
ter\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/ir.h(249): warning C4251: “torch::jit::Node::blocks
”: class“std::vector<
torch::jit::Block *,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::Node”的客户端使用 [D:\Projects\alpha-zero-gomoku-mast
er\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/ir.h(252): warning C4251: “torch::jit::Node::source_location
”: class“std
::shared_ptrtorch::jit::SourceLocation”需要有 dll 接口由 struct“torch::jit::Node”的客户端使用 [D:\Projects\alpha-zero-gomoku-mast
er\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/ir.h(253): warning C4251: “torch::jit::Node::scope_”: class“c10::intrusiv
e_ptr<torch::jit::Scope,c10::detail::intrusive_target_default_null_type>”需要有 dll 接口由 struct“torch::jit::Node”的
客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/ir.h(756): warning C4251: “torch::jit::Node::values_”: class“std::vector<
torch::jit::Node::AVPtr,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::Node”的客户端使用 [D:\Projects\alpha-zero-gomoku-
master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/tracing_state.h(30): warning C4251: “std::enable_shared_from_this<torch::
jit::tracer::TracingState>::Wptr”: class“std::weak_ptr<Ty>”需要有 dll 接口由 class“std::enable_shared_from_this<torch::jit:
:tracer::TracingState>”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/tracing_state.h(58): warning C4251: “torch::jit::tracer::TracingState::en
v_stack”: class“std::vector<torch::jit::tracer::TracingState::TracingEnvironmentFrame,std::allocator<Ty>>”需要有 dll 接口由
struct“torch::jit::tracer::TracingState”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/tracing_state.h(59): warning C4251: “torch::jit::tracer::TracingState::gr
aph”: class“std::shared_ptrtorch::jit::Graph”需要有 dll 接口由 struct“torch::jit::tracer::TracingState”的客户端使用 [D:\Projects
alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/tracing_state.h(63): warning C4251: “torch::jit::tracer::TracingState::lo
okup_var_name_fn”: class“std::function<std::string (const torch::autograd::Variable &)>”需要有 dll 接口由 struct“torch::jit::
tracer::TracingState”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/tracing_state.h(159): warning C4251: “torch::jit::tracer::NoWarn::state”:
class“std::shared_ptr<Ty>”需要有 dll 接口由 struct“torch::jit::tracer::NoWarn”的客户端使用 [D:\Projects\alpha-zero-gomoku-master
build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/tracer.h(169): warning C4273: “torch::jit::tracer::addInputs”: dll 链接不一致
[D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/tracer.h(176): warning C4273: “torch::jit::tracer::addInputs”: dll 链接不一致
[D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/operator.h(113): warning C4251: “torch::jit::Operator::schema_string
”: c
lass“c10::optionalstd::string”需要有 dll 接口由 struct“torch::jit::Operator”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\bu
ild_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/operator.h(117): warning C4251: “torch::jit::Operator::schema
”: class“st
d::shared_ptrc10::FunctionSchema”需要有 dll 接口由 struct“torch::jit::Operator”的客户端使用 [D:\Projects\alpha-zero-gomoku-master
\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/operator.h(121): warning C4251: “torch::jit::Operator::op
”: class“std::s
hared_ptrtorch::jit::Operation”需要有 dll 接口由 struct“torch::jit::Operator”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\b
uild_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/operator.h(122): warning C4251: “torch::jit::Operator::op_creator
”: clas
s“std::function<torch::jit::Operation (const torch::jit::Node *)>”需要有 dll 接口由 struct“torch::jit::Operator”的客户端使用 [D:\Pr
ojects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/argument_spec.h(168): warning C4251: “torch::jit::ArgumentSpecCreator::in
structions
”: class“std::vector<torch::jit::ArgumentSpecCreator::Inst,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::ji
t::ArgumentSpecCreator”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/argument_spec.h(201): warning C4267: “初始化”: 从“size_t”转换到“int32_t”,可能丢失数据
[D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/argument_spec.h(204): warning C4267: “初始化”: 从“size_t”转换到“int32_t”,可能丢失数据
[D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/argument_spec.h(204): warning C4267: “初始化”: 从“size_t”转换到“const int32_t”,可
能丢失数据 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/argument_spec.h(209): warning C4244: “+=”: 从“int64_t”转换到“int32_t”,可能丢失数据
[D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/argument_spec.h(229): warning C4244: “+=”: 从“int64_t”转换到“int32_t”,可能丢失数据
[D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/argument_spec.h(391): warning C4267: “参数”: 从“size_t”转换到“const int”,可能丢失数据
[D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/interpreter.h(44): warning C4251: “torch::jit::Code::pImpl”: class“std::s
hared_ptrtorch::jit::CodeImpl”需要有 dll 接口由 struct“torch::jit::Code”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build
library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/graph_executor.h(41): warning C4251: “torch::jit::GraphExecutor::pImpl”:
class“std::shared_ptrtorch::jit::GraphExecutorImpl”需要有 dll 接口由 struct“torch::jit::GraphExecutor”的客户端使用 [D:\Projects\a
lpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/compilation_unit.h(160): warning C4251: “torch::jit::script::Funct
ion::name
”: class“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“torch::jit::s
cript::Function”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/compilation_unit.h(161): warning C4251: “torch::jit::script::Funct
ion::graph
”: class“std::shared_ptrtorch::jit::Graph”需要有 dll 接口由 struct“torch::jit::script::Function”的客户端使用 [D:\Proje
cts\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/compilation_unit.h(166): warning C4251: “torch::jit::script::Funct
ion::executor_init_”: struct“std::once_flag”需要有 dll 接口由 struct“torch::jit::script::Function”的客户端使用 [D:\Projects\alpha-z
ero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/compilation_unit.h(171): warning C4251: “torch::jit::script::Funct
ion::function_creator_”: class“std::function<void (torch::jit::script::Function &)>”需要有 dll 接口由 struct“torch::jit::scri
pt::Function”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/compilation_unit.h(176): warning C4251: “torch::jit::script::Funct
ion::schema_”: class“std::unique_ptr<c10::FunctionSchema,std::default_delete<Ty>>”需要有 dll 接口由 struct“torch::jit::scrip
t::Function”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/compilation_unit.h(266): warning C4251: “torch::jit::script::Compi
lationUnit::functions
”: class“std::vector<std::shared_ptrtorch::jit::script::Function,std::allocator<Ty>>”需要有 dll 接
口由 struct“torch::jit::script::CompilationUnit”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/compilation_unit.h(268): warning C4251: “torch::jit::script::Compi
lationUnit::dict
”: class“std::unordered_map<std::string,size_t,std::hashstd::string,std::equal_to<_Kty>,std::allocat
or<std::pair<const _Kty,Ty>>>”需要有 dll 接口由 struct“torch::jit::script::CompilationUnit”的客户端使用 [D:\Projects\alpha-zero-go
moku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(123): warning C4251: “torch::jit::script::Method::functio
n
”: class“std::shared_ptrtorch::jit::script::Function”需要有 dll 接口由 struct“torch::jit::script::Method”的客户端使用 [D:\Proje
cts\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(127): warning C4251: “torch::jit::script::Method::initial
ivalues”: class“std::vector<torch::jit::script::Slot,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::script::Meth
od”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(128): warning C4251: “torch::jit::script::Method::schema

”: struct“c10::FunctionSchema”需要有 dll 接口由 struct“torch::jit::script::Method”的客户端使用 [D:\Projects\alpha-zero-gomoku-maste
r\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(543): warning C4251: “torch::jit::script::Module::modules
_”: class“std::vector<std::shared_ptrtorch::jit::script::Module,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::s
cript::Module”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(544): warning C4251: “torch::jit::script::Module::paramet
ers
”: class“std::vector<torch::jit::script::Slot,std::allocator<Ty>>”需要有 dll 接口由 struct“torch::jit::script::Module”的客
户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(545): warning C4251: “torch::jit::script::Module::attribu
tes
”: class“std::vector<torch::jit::script::Slot,std::allocator<_Ty>>”需要有 dll 接口由 struct“torch::jit::script::Module”的客
户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(546): warning C4251: “torch::jit::script::Module::methods
_”: class“std::vector<std::unique_ptr<torch::jit::script::Method,std::default_delete<Ty>>,std::allocator<std::unique_p
tr<Ty,std::default_delete<Ty>>>>”需要有 dll 接口由 struct“torch::jit::script::Module”的客户端使用 [D:\Projects\alpha-zero-gomoku-
master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(548): warning C4251: “torch::jit::script::Module::dict
”:
class“std::unordered_map<std::string,torch::jit::script::Module::Entry,std::hashstd::string,std::equal_to<Kty>,std:
:allocator<std::pair<const Kty,Ty>>>”需要有 dll 接口由 struct“torch::jit::script::Module”的客户端使用 [D:\Projects\alpha-zero-gom
oku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(549): warning C4251: “torch::jit::script::Module::name
”:
class“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 struct“torch::jit::script::Modul
e”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(551): warning C4251: “torch::jit::script::Module::module

value
”: class“c10::intrusive_ptr<c10::ivalue::Object,c10::detail::intrusive_target_default_null_type>”需要有 dll
接口由 struct“torch::jit::script::Module”的客户端使用 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\torch/csrc/jit/script/module.h(566): warning C4251: “torch::jit::script::Module::create
method_guard”: class“std::recursive_mutex”需要有 dll 接口由 struct“torch::jit::script::Module”的客户端使用 [D:\Projects\alpha-zero
-gomoku-master\build_library.vcxproj]
D:\Projects\alpha-zero-gomoku-master\src\mcts.cpp(91): warning C4267: “初始化”: 从“size_t”转换到“unsigned int”,可能丢失数据 [D:\Pr
ojects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Optional.h(430): warning C4267: “参数”: 从“size_t”转换到“T”,可能丢失数据 [D:\Projects\alpha
-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Half.h(440): warning C4018: “>”: 有符号/无符号不匹配 [D:\Projects\alpha-zero-gomoku-mast
er\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Half.h(400): warning C4244: “参数”: 从“From”转换到“const std::complex::_Ty”,可
能丢失数据 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Half.h(400): warning C4244: “参数”: 从“From”转换到“const std::complex::_Ty”,可能
丢失数据 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Half.h(400): warning C4244: “参数”: 从“From”转换到“const std::complex::_Ty”,可能
丢失数据 [D:\Projects\alpha-zero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Half.h(400): warning C4244: “参数”: 从“From”转换到“float”,可能丢失数据 [D:\Projects\alpha-z
ero-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Half.h(416): warning C4244: “参数”: 从“_Ty”转换到“float”,可能丢失数据 [D:\Projects\alpha-ze
ro-gomoku-master\build_library.vcxproj]
D:\Projects\libtorch\include\c10/util/Half.h(400): warning C4244: “参数”: 从“From”转换到“float”,可能丢失数据 [D:\Projects\alpha-z
ero-gomoku-master\build_library.vcxproj]

from alpha-zero-gomoku.

hijkzzz avatar hijkzzz commented on June 6, 2024

vs要用release模式编译

from alpha-zero-gomoku.

haopan27 avatar haopan27 commented on June 6, 2024

(tensorflow_gpuenv) C:\Users\William\source\repos\alpha-zero-gomoku\test>python leaner_test.py play Traceback (most recent call last): File "leaner_test.py", line 6, in import learner File "../src\learner.py", line 17, in from library import MCTS, Gomoku, NeuralNetwork ModuleNotFoundError: No module named 'library'

這是我的畫面顯示,使用anaconda環境,python3.6

我也碰到相同的问题,后来发现在README.md Run 中执行了cmake之后忘记用make -j10。执行好之后问题就解决了。

from alpha-zero-gomoku.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.