그래서 지점 A에서 작업해온 파일이 있습니다. 이제 그 파일을 커밋 할 준비가되었습니다. 그러나 diff를 살펴보면 두 개의 별도 커밋에 넣는 것이 더 좋습니다 (이 경우 두 개의 분기가 어쩌면 가능할 수도 있음). 나는 git add -patch를 사용하여 별도의 청크를 준비 했으므로 이것을 사용할 수있을 것이라고 생각했다. 문제는, 나는 내 숙모 중 하나를 분리해야한다는 것입니다. ... 괜찮아git add --patch를 사용하여 수동으로 편집 <filename>
# Manual hunk edit mode -- see bottom for a quick guide
@@ -50,13 +50,74 @@ import PIL.Image as im
import constant
+
+def exp_range(min=None, max=None, step=None):
+ """
+ Generate an exponentially increasing value scaled and offset such
+ that it covers the range (min, max]. Behaviour is similar to
+ exp(x), scaled such that the final value generated is equal to
+ 'max'. 'step' defines the granularity of the exponential
+ function. The default value is 5, corresponding to a step-size
+ of tau.
+
+ :type min: float
+ :param min: minimum value of range (offset)
+
+ :type max: float
+ :param max: Maximum (final) value of range
+
+ :type step: int
+ :param step: Number of incremental steps within the range
+ (min, max]
+
+ """
+ if min is None:
+ raise StopIteration
+
+ # One input argument (same as range(10))
+ if min is not None and max is None and step is None:
+ step = min
+ min = 0.
+ max = 1.
+ elif step is None:
+ step = 5
+
+ for i in xrange(step):
+ exp_rate = np.exp(i - (step-1))
+ yield min + (max - min) * exp_rate
+ raise StopIteration
+
+
def norm(input):
+ """
+ Return the norm of a vector or row-wise norm of a matrix
+
+ :type input: theano.tensor.TensorType
+ :param input: Theano array or matrix to take the norm of.
+
+ """
return T.sqrt((input * input).sum(axis=0))
def normalize(vector, scale=1.0, offset=0.5):
+ """
+ Normalize (Zero and scale) a vector such that it's peak to peak
+ value is equal to 'scale', and it is centered about 'offset'.
+
+ :type vector: numpy.ndarray
+ :param vector: Vector to normalize to the given parameters.
+
+ :type scale: float
+ :param scale: Peak-to-peak range to stretch or shrink the vector's
+ current peak-to-peak range to.
+
+ :type offset: float
+ :param offset: Value at which to center the peak-to-peak range at.
+
+ """
return (vector - vector.min()) * scale/vector.ptp()
+
실행 git add --patch SdA.py
하고 문제 화물선을 편집 할 e
를 사용하여. 바닥에는 미니 가이드가 있습니다. 알 겠어. 그래서 우리는이 커밋에 새로운 함수를 넣고 다른 커밋에 대한 문서를 다른 커밋에 넣기를 원합니다. 미니 문서에 따르면 : 좋아 보인다 # To remove '+' lines, delete them.
# Manual hunk edit mode -- see bottom for a quick guide
@@ -50,13 +50,74 @@ import PIL.Image as im
import constant
+
+def exp_range(min=None, max=None, step=None):
+ """
+ Generate an exponentially increasing value scaled and offset such
+ that it covers the range (min, max]. Behaviour is similar to
+ exp(x), scaled such that the final value generated is equal to
+ 'max'. 'step' defines the granularity of the exponential
+ function. The default value is 5, corresponding to a step-size
+ of tau.
+
+ :type min: float
+ :param min: minimum value of range (offset)
+
+ :type max: float
+ :param max: Maximum (final) value of range
+
+ :type step: int
+ :param step: Number of incremental steps within the range
+ (min, max]
+
+ """
+ if min is None:
+ raise StopIteration
+
+ # One input argument (same as range(10))
+ if min is not None and max is None and step is None:
+ step = min
+ min = 0.
+ max = 1.
+ elif step is None:
+ step = 5
+
+ for i in xrange(step):
+ exp_rate = np.exp(i - (step-1))
+ yield min + (max - min) * exp_rate
+ raise StopIteration
+
+
def norm(input):
return T.sqrt((input * input).sum(axis=0))
def normalize(vector, scale=1.0, offset=0.5):
return (vector - vector.min()) * scale/vector.ptp()
합니다.
error: patch failed: SdA.py:50
error: SdA.py: patch does not apply
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]?
Mmkay ... git add --interactive "Your edited hunk does not apply" 및 How to read the output from git diff? 내가 영향을 줄 번호를 업데이트 할 필요가 있다고 설명 ...의 그 강아지를 추가 할 수 있습니다. 이렇게하려면 수동으로 계산하고 "흠, 1, 2, 3 ... 23 줄을 제거했습니다. 이전에 74 줄을 편집 중이 었는데 지금 편집 중입니다 ... 흠 ... 원하는 ... 나는 계산기를 가지고 있었다. ... .... 51 lines "('whew, 나는 땀 투성이 다.')
이것은 복잡 한 방법처럼 보인다. 필자는 여전히 패치가 올바른 접근법이라고 생각하지만, To 파일에서 영향을받는 라인의 수를 수동으로 업데이트해야하는 경우 잘못된 작업을 수행해야합니다. 누구든지이 작업을보다 쉽고 효율적으로 수행하는 방법에 대해 조언을 구합니까?
나는 대부분의 것들에 불필요한 추상화를 추가한다고 느낄 정도로 GUI에 대해 싫어한다. 이것은 좋거나 나쁠 수 있습니다. 복잡한 작업의 경우 GUI가 도구가되어 내가 할 수있는 것보다 훨씬 더 가능성이 높습니다. 그러나 간단한 조작을 위해서 (그리고 나는이 패치가 간단한 조작이라고 느낀다.) 커맨드 라인을 선호해야한다고 생각한다. 나는이 며칠을 기다려서 다른 대답이 들어 왔는지 살펴볼 것입니다. 제안에 감사드립니다. –
@Phox는 가치가있다. 커맨드 라인에서 거의 독점적으로 Git을 사용하지만, 선택적인 스테이징을 위해서는 GUI를 사용하면 빠르고 쉽게 사용할 수있다. –
+1 git-cola를 위해, 나는 잠시 동안 리눅스에서 그 기능을 찾고 있었지만, git add -p를 자주 사용하지만 어떤 이유로 "s"가 잘 작동하지 않습니다. – nemesisdesign