我正在尝试根据用户可以选择的可能日期列表对日期进行搜索。使用日历,我要求用户输入日期,然后我要获取所有可能的数据包,这些数据包的“ data_possibile”列表中都包含该日期。
这是我正在使用的查询:
@NamedQuery(name="pacchettoPreconfigurato.findVendibileByData", query="SELECT p FROM PacchettoPreconfigurato p WHERE p.in_vendita=TRUE AND (:data) IN (p.date_possibili)")
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试在服务器的日志中部署应用程序时,我得到:
Exception Description: Problem compiling [SELECT p FROM PacchettoPreconfigurato p WHERE p.in_vendita=TRUE AND (:data) IN (p.date_possibili)]. [81, 97] The state field path 'p.date_possibili' cannot be resolved to a collection type.
Run Code Online (Sandbox Code Playgroud)
这是p.date_possibili的定义方式:
@OneToMany(orphanRemoval=true)
@JoinColumn(name="id_pp")
private List<DataPossibilePP> date_possibili;
Run Code Online (Sandbox Code Playgroud)
其中DataPossibilePP为:
@Entity
@IdClass(DataPossibilePPPK.class)
public class DataPossibilePP implements Serializable {
@Id
private Integer id_pp;
@Id
private Date data;
private static final long serialVersionUID = 1L;
/*standard getters and setters*/
} …Run Code Online (Sandbox Code Playgroud) 我有一个函数 fun 需要几个参数 p0,p1,.. 对于每个参数,我给出了一个可能值的列表:
p0_list = ['a','b','c']
p1_list = [5,100]
Run Code Online (Sandbox Code Playgroud)
我现在可以为 p0,p1 的每个组合调用我的函数
for i in itertools.product(*[p0,p1]):
print fun(i)
Run Code Online (Sandbox Code Playgroud)
现在问题来了:如果我已经知道参数 p1 只对 fun 的结果有影响,如果 p0 是 'a' 或 'c' 怎么办?在这种情况下,我需要我的参数组合列表看起来像:
[('a', 5), ('a',100), ('b', 5), ('c',5), ('c', 100)]
Run Code Online (Sandbox Code Playgroud)
所以 ('b', 100) 只是被省略了,因为这将是对乐趣的不必要评估。
我的最终解决方案:
param_lists = [['p0', ['a','b','c']],['p1', [5,100]]]
l = itertools.product(*[x[1] for x in param_lists])
l = [x for x in l if not x[0] == 'b' or x[1]==5]
Run Code Online (Sandbox Code Playgroud)
我将这种方法用于 5 个参数和各种条件,并且效果很好。它也很容易阅读。这段代码的灵感来自 Corley Brigmans 和 nmcleans 的回答。
当我阅读global_step的文档时,这个问题出现了.这里明确声明global_step不可训练.
global_step_tensor = tf.Variable(10,trainable = False,name ='global_step')
sess = tf.Session()
print('global_step:%s'%tf.train.global_step(sess,global_step_tensor))
根据我的理解,可训练意味着可以在sess.run()期间更改值.我试图宣布它既可训练又不训练,并得到相同的结果.所以我不明白为什么我们需要声明它不可训练.
我阅读了可训练的文件,但并没有得到它.
所以我的问题是:
我正在用bazel从源代码构建张量流,如下所述:
https://www.tensorflow.org/install/install_sources
在安装文档之后,我使用以下代码成功编译:
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both \
--cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"--config=cuda \
-k //tensorflow/tools/pip_package:build_pip_package
Run Code Online (Sandbox Code Playgroud)
这里接受的答案和安装文档中的注释"添加--cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"到gcc 5及更高版本的构建命令"的组合.
但是,会import tensorflow as tf导致错误
illegal instruction (core dumped), exiting python.
Run Code Online (Sandbox Code Playgroud)
我还试过:conda update libgcc无济于事.
如何使用gcc 5.0从源代码构建tensorflow?
我有一个 python 定义的工作器QObject,它有一个work()由 QML UI 调用的慢速插槽(在我的实际 UI 中,FolderListModel当用户浏览列表时,该方法在每个项目上动态调用,但对于他的示例代码我'我只是在窗口完成时调用它作为示例)。
我想work异步运行慢速以防止 UI 阻塞。我想通过在 QThread 上移动 Worker 实例并在那里调用插槽来做到这一点,但这不起作用,因为 UI 仍然被阻塞,等待结果的work()到来。
这是我迄今为止尝试的代码:
mcve.qml:
import QtQuick 2.13
import QtQuick.Window 2.13
Window {
id: window
visible: true
width: 800
height: 600
title: qsTr("Main Window")
Component.onCompleted: console.log(worker.work("I'm done!")) // not the actual usage, see note in the question
}
Run Code Online (Sandbox Code Playgroud)
mcve.py:
import QtQuick 2.13
import QtQuick.Window 2.13
Window {
id: window
visible: true
width: 800
height: 600
title: …Run Code Online (Sandbox Code Playgroud) 我有一个tfrecord文件,我存储了一个数据列表,每个元素有2d坐标和3d坐标.坐标是dtype float64的2d numpy数组.
这些是我用来存储它们的功能.
feature = {'train/coord2d': _floats_feature(projC),
'train/coord3d': _floats_feature(sChair)}
Run Code Online (Sandbox Code Playgroud)
我把它们压平成一个浮动列表来存储它们.
def _floats_feature(value):
return tf.train.Feature(float_list=tf.train.FloatList(value=value.flatten()))
Run Code Online (Sandbox Code Playgroud)
现在我正在努力收听它们,以便我可以将它们送入我的网络来训练它.我想要2d coords作为输入,3d要成为训练我的netwrok的输出.
def read_and_decode(filename):
filename_queue = tf.train.string_input_producer(filename, name='queue')
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
features = tf.parse_single_example(
serialized_example,
features= {'train/coord2d': tf.FixedLenFeature([], tf.float32),
'train/coord3d': tf.FixedLenFeature([], tf.float32)})
coord2d = tf.cast(features['train/coord2d'], tf.float32)
coord3d = tf.cast(features['train/coord3d'], tf.float32)
return coord2d, coord3d
with tf.Session() as sess:
filename = ["train.tfrecords"]
dataset = tf.data.TFRecordDataset(filename)
c2d, c3d = read_and_decode(filename)
print(sess.run(c2d))
print(sess.run(c3d))
Run Code Online (Sandbox Code Playgroud)
这是我的代码,但我真的不明白,因为我从教程等得到它所以我试图打印出c2d和c3d,看看他们的格式,但我的程序只是保持运行,并没有打印任何东西,永远不会终止.c2d和c3d是否包含数据集中每个元素的2d和3d坐标?在将网络作为输入和输出进行培训时,它们可以直接使用吗?
在将它们用作网络输入之前,我也不知道它们应该是什么格式.我应该将它们转换回2d numpy数组或2d张量?在哪种情况下我该怎么办?整体而言我只是非常失落,所以任何guidace都会非常有帮助!谢谢
我正在构建一些自定义 Qt 组件作为静态库,但我无法通过编译阶段。我的项目结构如下:
Root:
- .h and . cpp files of the custom Qt components
- GeneratedFiles/Debug/ <-- here the MOC compiler puts the generated moc_*.cpp files ("Debug" is automatically deducted from the build configuration, so it's Release for release builds)
Run Code Online (Sandbox Code Playgroud)
这是一个非常标准的文件夹设置,但无论出于何种原因,编译器都无法仅找到moc 文件。根文件夹中的任何内容都可以正常构建,但找不到 moc 文件。请注意,moc_ 文件生成得很好并且存在于它们应该存在的地方,具有正确的内容。问题似乎出在路径的评估上GeneratedFiles\Debug\moc_whatever.cpp。
有趣的是,如果我moc_example.cpp在根文件夹中移动一个 moc 文件(比如)并手动调整调用CL.exe以 compilemoc_example.cpp而不是GeneratedFiles\Debug\moc_example.cpp,该文件就会被构建。
我正在使用 VS 2017 版本 15.7.1,CL 是 x64 版本 19.00.24215.1,我会用任何其他可能有用的细节更新问题,只需在评论中添加询问。
那么......为什么编译器告诉我这些文件不存在?
我有一个变量uint16_t a=35;,我有一个功能
UINT Read(unsigned int& nVal);
Run Code Online (Sandbox Code Playgroud)
如何传递a到Read()作为unsigned int&?
如果我像这样通过
Read(a);
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
无法将参数1从'uint16_t'转换为'unsigned int&
据我从张量流文档中了解到,地图用于基于函数 parse_function_wrapper 修改图像。
dataset = dataset.map(parse_function_wrapper,
num_parallel_calls=4)
dataset = dataset.batch(32)
Run Code Online (Sandbox Code Playgroud)
现在数据集将只有增强图像而没有原始图像。所以我的疑问是我们需要使用原始数据和增强数据来训练我们的模型。谁能告诉我如何用原始数据进行训练?