Questions tagged [gradient]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Gradient calculation of the pre-trained model

I have pre-trained tensorflow model in a graph format. I have not used tf.gradient on the graph structure. In such cases, is there any way to calculate the gradient of some tensors operation?
0
votes
0answers
11 views

Gradients vanishing despite using Kaiming initialization

I was implementing a conv block in pytorch with activation function(prelu). I used Kaiming initilization to initialize all my weights and set all the bias to zero. However as I tested these blocks (by ...
0
votes
0answers
22 views

Gradient calculation analysis

I'm using VGG16 pretrained architecture for classification and visualization of result using Guided Backpropagation technique. I have used tensorflow code for calaulating the input gradientSharing ...
0
votes
1answer
18 views

Vanishing gradient problem

In a neural network, does gradient vanish during a great number epochs as well, rather that only vanishing through different layers?
1
vote
1answer
31 views

Why does my manual derivative of Layer Normalization imply no gradient flow?

I recently tried computing the derivative of the layer norm function (https://arxiv.org/abs/1607.06450), an essential component of transformers, but the result suggests that no gradient flows through ...
0
votes
0answers
11 views

How can my loss be stable while the gradient keeps growing?

I have been working on an Offline/Batch Reinforcement Learning problem where I am using a BCQ-DDQN model as a Q-table. The model input is a state of 8 dimensions, and the output is a vector of Q-...
2
votes
3answers
614 views

Why a sign of gradient (plus or minus) is not enough for finding a steepest ascend?

Consider a simple 1-D function $y = x^2$ to find a maximum with the gradient ascent method. If we start in point 3 on x-axis: $$ \frac{\partial f}{\partial x} \...
1
vote
1answer
24 views

Gradient passthough in PyTorch

I need to quantize the inputs, but the method (bucketize) I need to do so is indifferentiable. I can of course detach the tensor, but then I lose the flow of gradients to earlier weights. I guess ...
0
votes
0answers
10 views

Why do we do small number of iterations per epoch and large number of epochs rather than one epoch iterate on entire batch until small gradient?

Why do we do many epochs and one iteration per epoch rather than one epoch and iterate while gradient is not within tolerance in Keras deep learning or by default?
0
votes
0answers
16 views

Relationship between gradient norm and layer depth

I was wondering, if there was some relationship between the gradient norms of a layer in a neural network and its respective depth. I would suspect the: The smaller the depth of the layer, the bigger ...
1
vote
1answer
92 views

vanishing gradient and gradient zero

There is a well known problem vanishing gradient in BackPropagation training of ...
0
votes
0answers
18 views

SNIP (single-shot network pruning) definition in SynFlow paper

I am trying to understand how the SNIP saliency metric definition in the original paper is equivalent to the definition in the SynFlow paper on neural network pruning. The former defines saliency $\...
1
vote
0answers
25 views

How to choose appropriate epsilon value while approximating gradients to check training?

While approximating gradients, using actual epsilon to shift the weights results in wildly big gradient approximations, as the "width" of the used approximation triangle is ...
0
votes
1answer
50 views

implementing forward and backward of a Linear model

I'm implementing the code of this abstraction. The forward is easy and looks like that: I don't understand the backward path and how it fit's the abstraction in the first image: Why is db defined as ...
0
votes
2answers
39 views

Intuitive explanation for representing gradient in higher dimensions

I do not understand how complex networks with many parameters/dimensions can be represented in a 3D space, and form a standard cost surface just like a simple network with, say, 2 parameters. For ...
1
vote
1answer
60 views

Can mini-batch gradient descent outperform batch gradient descent? [duplicate]

As I was reading and going through the second course of Andrew Ng's deep learning course, I came across a sentence that said, With a well-turned mini-batch size, usually it outperforms either ...
2
votes
1answer
533 views

Tensorflow.Keras: How to get gradient for an output class w.r.t a given input?

I have implemented and trained a sequential model using tf.keras. Say I am given an input array of size 8X8 and an output [0,1,0,...(rest all 0)]. How to calculate the gradient of the input w.r.t to ...
2
votes
1answer
53 views

CNN gradients with different magnitude

I have a CNN architecture with two cross entropy losses $\mathcal{L}_1$ and $\mathcal{L}_2$ summed in the total loss $\mathcal{L} = \mathcal{L}_1 + \mathcal{L}_2$. The task I want to solve is ...
0
votes
1answer
29 views

when x is a vector, derivative of vector diag(f'(x)) is formal notation?

https://web.stanford.edu/class/cs224n/readings/gradient-notes.pdf (4) this note says this $$ \frac{\partial \textbf{z}}{\partial \textbf{x}} = \text{diag}(f'(\textbf{x})) $$ I know this means make ...
0
votes
1answer
213 views

Gradient of a function in Python

I've defined a function in this way: def qfun(par): return(par[0]+atan(par[3])*par[1]+atan(par[4])*par[2]) How can I obtain the gradient of this function ...
0
votes
1answer
24 views

How can we get gradient with some other loss function apart from MSE?

In most of the gradient search examples, the update to weights are done by subtracting the derivative of MSE. Can we have an example, where we did not use ...
1
vote
0answers
18 views

Matlab Optimization. Meaning of warning: “The slope should be 2. It appears to be 1.”

I'm using the manopt package to solve some optimization problems in matlab. The problem is of the form. problem.cost = @(x) f(x) problem.egrad = @(x) g(x) After the problem definition, I check ...
3
votes
1answer
47 views

Gradient Checking: MeanSquareError. Why huge epsilon improves discrepancy?

I am using custom C++ code, and coded a simple "Mean Squared Error" layer. Temporarily using it for the 'classification task', not a simple regression. ...maybe this causes the issues? I don't have ...
3
votes
1answer
72 views

Vanishing Gradient vs Exploding Gradient as Activation function?

ReLU is used as an activation function that serves two purposes: Breaking linearity in DNN. Helping in handling Vanishing Gradient problem. For Exploding Gradient problem, we use Gradient Clipping ...
2
votes
1answer
531 views

What does it mean for a method to be invariant to diagonal rescaling of the gradients?

In the paper which describes Adam: a method for stochastic optimization, the author states: The method is straightforward to implement, is computationally efficient, has little memory requirements, ...