我在远程+本地分支中提交,我想将该提交从历史记录中删除,并将其中一些提交到自己的分支中.
基本上,我现在有:
D---E---F---G master
Run Code Online (Sandbox Code Playgroud)
而且我要:
E---G topic
/
D master
Run Code Online (Sandbox Code Playgroud)
这应该在我的本地和(只有一个,称为origin)远程存储库中.
这是最干净的方法吗?
此外,还有其他人克隆了该回购并且已经检查了主分支.如果我在远程仓库中进行这样的改变,那么'git pull'工作会让他们也进入相同的状态吗?
我想做的事情如下:
all = [ x for x in t[1] for t in tests ]
Run Code Online (Sandbox Code Playgroud)
测试看起来像:
[ ("foo",[a,b,c]), ("bar",[d,e,f]) ]
Run Code Online (Sandbox Code Playgroud)
所以我想得到结果
all = [a,b,c,d,e,f]
Run Code Online (Sandbox Code Playgroud)
我的代码不起作用,Python说:
UnboundLocalError: local variable 't' referenced before assignment
Run Code Online (Sandbox Code Playgroud)
有没有简单的方法呢?
在这段代码中:
int foo() {
static int x;
}
Run Code Online (Sandbox Code Playgroud)
是x每个线程中所有线程或本地的全局?或者这取决于编译器标志和/或编译器,所以我真的不知道代码是什么?
几个问题(所有问题都独立于编译器和编译器标志和操作系统):
我想这不是C++本身.(它是在C++ 0x?)一些Boost lib可以做到这一点?
我有这个函数头:
template <
bool src_alpha,
int sbpp, int dbpp,
typename T1, typename T2,
Color (*getFunc)(T1 data, Uint8* addr),
void (*putFunc)(T2 data, Uint8* addr, Color c)
>
static void OperateOnSurfaces(T1 data1, T2 data2, SDL_Surface * bmpDest, SDL_Surface * bmpSrc, SDL_Rect& rDest, SDL_Rect& rSrc)
Run Code Online (Sandbox Code Playgroud)
这就是我使用它的方式:
OperateOnSurfaces<
true,
32, 32,
SDL_PixelFormat*, SDL_PixelFormat*,
GetPixel<true,32>, PutPixel<true,true,32> >(
bmpSrc->format, bmpDest->format,
bmpDest, bmpSrc, rDest, rSrc);
Run Code Online (Sandbox Code Playgroud)
这是GetPixel和PutPixel:
template<bool alpha, int bpp>
static Color GetPixel(SDL_PixelFormat* format, Uint8* addr) { /* .. */ }
template<bool alpha, …Run Code Online (Sandbox Code Playgroud) 当我使用nosetestsTensorFlow的一些测试脚本时,我从TensorFlow获得了大量的调试输出:
az@azmacbookpro ~/P/crnn> nosetests tests/test_TFUtil.py
Level 1:tensorflow:Registering FakeQuantWithMinMaxArgs (<function _FakeQuantWithMinMaxArgsGradient at 0x112306048>) in gradient.
Level 1:tensorflow:Registering FakeQuantWithMinMaxVars (<function _FakeQuantWithMinMaxVarsGradient at 0x1126ba9d8>) in gradient.
Level 1:tensorflow:Registering FakeQuantWithMinMaxVarsPerChannel (<function _FakeQuantWithMinMaxVarsPerChannelGradient at 0x1126ba950>) in gradient.
...
Level 1:tensorflow:Registering Fact (<function _set_call_cpp_shape_fn.<locals>.call_without_requiring at 0x1122c0268>) in default shape functions.
Level 1:tensorflow:Registering TensorSummary (None) in gradient.
Level 1:tensorflow:Registering queue_runners ((<class 'tensorflow.core.protobuf.queue_runner_pb2.QueueRunnerDef'>, <function QueueRunner.to_proto at 0x1130687b8>, <function QueueRunner.from_proto at 0x113068840>)) in proto functions.
E
======================================================================
...
-------------------- >> begin captured logging << --------------------
tensorflow: Level …Run Code Online (Sandbox Code Playgroud) 我想使用一些对象作为某些字典的键,这些对象要么是不可散列的,要么是可散列的,但我想用默认的__eq__/覆盖它们的/ ,即iff 。__hash__object.__eq__object.__hash__a == ba is b
(这些对象可能是numpy.ndarray、、torch.Tensor或其他东西,但我现在想问一般性的问题。)
例如:
x = numpy.array([2,3,4])
d = {x: 5}
Run Code Online (Sandbox Code Playgroud)
那就例外了TypeError: unhashable type: 'numpy.ndarray'。
或者:
x = torch.Tensor([2,3,4])
d = weakref.WeakKeyDictionary()
d[x] = 5
print(d[x])
Run Code Online (Sandbox Code Playgroud)
那就例外了RuntimeError: Boolean value of Tensor with more than one value is ambiguous。(这是相当误导或意外的。但我认为这是因为它会bool(__eq__(...))在内部执行。但是,奇怪的是,当我在这里使用法线时没有这样的异常dict。为什么?)
我可以编写一个自定义对象包装器来解决这个问题,例如:
class WrappedObject:
def __init__(self, orig):
self.orig = orig
def __eq__(self, other):
return object.__eq__(self.orig, other.orig)
def __ne__(self, other): …Run Code Online (Sandbox Code Playgroud) 我非常喜欢for(T e : iterable)Java中的for-each-loop构造(),Iterable<T>因为它在很多情况下非常容易阅读和编写代码.
我想知道是否有任何方法可以从这样的循环访问底层迭代器.如果我想remove()从迭代器中使用它,这可以是必需的.
我在我的 C++ 应用程序中使用 V8,我想添加console.log(). 我可以使用一些好的标准实现吗?
目前,我有自己的虚拟实现,但它还很不完整。
c++ ×2
java ×2
python ×2
tensorflow ×2
foreach ×1
git ×1
iterator ×1
javascript ×1
nose ×1
revert ×1
static ×1
templates ×1
unit-testing ×1
v8 ×1
variables ×1