Controlling number of channels in weight/kernel in tensorflow2019 Community Moderator ElectionStuck on deconvolution in Theano and TensorFlowReproducing randomForest Proximity Matrix from R package in Python“concat” mode can only merge layers with matching output shapes except for the concat axisTensorFlow: number of channels of conv1d filterMinimum number of features to run TensorflowImplementing spatio-temporal convolutions in pytorchTraining images with multiple channelswhat happens to the depth channels when convolved by multiple filters in a cnn (keras, tensorflow)What is exactly meant by neural network that can take different types of input?What are the possible values of a filter in a CNN?

Watching something be piped to a file live with tail

Forgetting the musical notes while performing in concert

How could indestructible materials be used in power generation?

Dealing with conflict between co-workers for non-work-related issue affecting their work

What's the point of deactivating Num Lock on login screens?

Neighboring nodes in the network

How can saying a song's name be a copyright violation?

Why is Collection not simply treated as Collection<?>

Why are electrically insulating heatsinks so rare? Is it just cost?

Why doesn't using multiple commands with a || or && conditional work?

Is it canonical bit space?

How do I deal with an unproductive colleague in a small company?

Is there a hemisphere-neutral way of specifying a season?

What does it mean to describe someone as a butt steak?

Has there ever been an airliner design involving reducing generator load by installing solar panels?

Alternative to sending password over mail?

How do I find out when a node was added to an availability group?

Personal Teleportation: From Rags to Riches

Does casting Light, or a similar spell, have any effect when the caster is swallowed by a monster?

Why does Optional.map make this assignment work?

How can I tell some body that I want to be his or her friend?

Why would the Red Woman birth a shadow if she worshipped the Lord of the Light?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Contemplating leaving job of two years, but a long travel is in the works. Is it professional for me to resign?



Controlling number of channels in weight/kernel in tensorflow



2019 Community Moderator ElectionStuck on deconvolution in Theano and TensorFlowReproducing randomForest Proximity Matrix from R package in Python“concat” mode can only merge layers with matching output shapes except for the concat axisTensorFlow: number of channels of conv1d filterMinimum number of features to run TensorflowImplementing spatio-temporal convolutions in pytorchTraining images with multiple channelswhat happens to the depth channels when convolved by multiple filters in a cnn (keras, tensorflow)What is exactly meant by neural network that can take different types of input?What are the possible values of a filter in a CNN?










1












$begingroup$


To implement a specific function, I need "input_channels" number of kernels in my layer, each having only a single channel depth, and not depth = "input_channels". I need to convolve one kernel with one channel of the input, thus the output of the layer would have "input_channels" number of kernels.



Image attached for reference -
enter image description here



Thanks in advance for any help.



(if anyone wishes to know what all i have tried yet -
In the conv2d function of tensorflow, if I specify number of kernels = 1 to do this, then it will sum over all input_channels and number of output_channels will be 1, since it always initialises kernel depth = "input_channels".



Another option is to specify number of number of kernels = input_channels in conv2d function but this would create "input_channels" number of kernels of depth "input_channels", thus adding lot of complexity and incorrect implementation of my layer.



Yet another thing I tried was to initialise a kernel of volume (kernel_height, kernel_width, input_channels) and loop over the third dimension to convolve only a single input channel with a single kernel. But the tensorflow conv2d function requires a rank 4 kernel to work and gives the following error -



ValueError: Shape must be rank 4 but is rank 3 for 'generic_act_func_4/Conv2D' (op: 'Conv2D') with input shapes: [?,28,28], [28,28].


)










share|improve this question











$endgroup$











  • $begingroup$
    Dear, probably the error occurs in (kernel_height, kernel_width, input_channels), its 3 parameters (means rank 3), but the error said it should be rank for, means it needs the fourth parameters, which I think the number of the filters in this conv.
    $endgroup$
    – honar.cs
    Mar 26 at 13:09















1












$begingroup$


To implement a specific function, I need "input_channels" number of kernels in my layer, each having only a single channel depth, and not depth = "input_channels". I need to convolve one kernel with one channel of the input, thus the output of the layer would have "input_channels" number of kernels.



Image attached for reference -
enter image description here



Thanks in advance for any help.



(if anyone wishes to know what all i have tried yet -
In the conv2d function of tensorflow, if I specify number of kernels = 1 to do this, then it will sum over all input_channels and number of output_channels will be 1, since it always initialises kernel depth = "input_channels".



Another option is to specify number of number of kernels = input_channels in conv2d function but this would create "input_channels" number of kernels of depth "input_channels", thus adding lot of complexity and incorrect implementation of my layer.



Yet another thing I tried was to initialise a kernel of volume (kernel_height, kernel_width, input_channels) and loop over the third dimension to convolve only a single input channel with a single kernel. But the tensorflow conv2d function requires a rank 4 kernel to work and gives the following error -



ValueError: Shape must be rank 4 but is rank 3 for 'generic_act_func_4/Conv2D' (op: 'Conv2D') with input shapes: [?,28,28], [28,28].


)










share|improve this question











$endgroup$











  • $begingroup$
    Dear, probably the error occurs in (kernel_height, kernel_width, input_channels), its 3 parameters (means rank 3), but the error said it should be rank for, means it needs the fourth parameters, which I think the number of the filters in this conv.
    $endgroup$
    – honar.cs
    Mar 26 at 13:09













1












1








1





$begingroup$


To implement a specific function, I need "input_channels" number of kernels in my layer, each having only a single channel depth, and not depth = "input_channels". I need to convolve one kernel with one channel of the input, thus the output of the layer would have "input_channels" number of kernels.



Image attached for reference -
enter image description here



Thanks in advance for any help.



(if anyone wishes to know what all i have tried yet -
In the conv2d function of tensorflow, if I specify number of kernels = 1 to do this, then it will sum over all input_channels and number of output_channels will be 1, since it always initialises kernel depth = "input_channels".



Another option is to specify number of number of kernels = input_channels in conv2d function but this would create "input_channels" number of kernels of depth "input_channels", thus adding lot of complexity and incorrect implementation of my layer.



Yet another thing I tried was to initialise a kernel of volume (kernel_height, kernel_width, input_channels) and loop over the third dimension to convolve only a single input channel with a single kernel. But the tensorflow conv2d function requires a rank 4 kernel to work and gives the following error -



ValueError: Shape must be rank 4 but is rank 3 for 'generic_act_func_4/Conv2D' (op: 'Conv2D') with input shapes: [?,28,28], [28,28].


)










share|improve this question











$endgroup$




To implement a specific function, I need "input_channels" number of kernels in my layer, each having only a single channel depth, and not depth = "input_channels". I need to convolve one kernel with one channel of the input, thus the output of the layer would have "input_channels" number of kernels.



Image attached for reference -
enter image description here



Thanks in advance for any help.



(if anyone wishes to know what all i have tried yet -
In the conv2d function of tensorflow, if I specify number of kernels = 1 to do this, then it will sum over all input_channels and number of output_channels will be 1, since it always initialises kernel depth = "input_channels".



Another option is to specify number of number of kernels = input_channels in conv2d function but this would create "input_channels" number of kernels of depth "input_channels", thus adding lot of complexity and incorrect implementation of my layer.



Yet another thing I tried was to initialise a kernel of volume (kernel_height, kernel_width, input_channels) and loop over the third dimension to convolve only a single input channel with a single kernel. But the tensorflow conv2d function requires a rank 4 kernel to work and gives the following error -



ValueError: Shape must be rank 4 but is rank 3 for 'generic_act_func_4/Conv2D' (op: 'Conv2D') with input shapes: [?,28,28], [28,28].


)







python tensorflow






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 8:29







psj

















asked Mar 26 at 7:58









psjpsj

112




112











  • $begingroup$
    Dear, probably the error occurs in (kernel_height, kernel_width, input_channels), its 3 parameters (means rank 3), but the error said it should be rank for, means it needs the fourth parameters, which I think the number of the filters in this conv.
    $endgroup$
    – honar.cs
    Mar 26 at 13:09
















  • $begingroup$
    Dear, probably the error occurs in (kernel_height, kernel_width, input_channels), its 3 parameters (means rank 3), but the error said it should be rank for, means it needs the fourth parameters, which I think the number of the filters in this conv.
    $endgroup$
    – honar.cs
    Mar 26 at 13:09















$begingroup$
Dear, probably the error occurs in (kernel_height, kernel_width, input_channels), its 3 parameters (means rank 3), but the error said it should be rank for, means it needs the fourth parameters, which I think the number of the filters in this conv.
$endgroup$
– honar.cs
Mar 26 at 13:09




$begingroup$
Dear, probably the error occurs in (kernel_height, kernel_width, input_channels), its 3 parameters (means rank 3), but the error said it should be rank for, means it needs the fourth parameters, which I think the number of the filters in this conv.
$endgroup$
– honar.cs
Mar 26 at 13:09










0






active

oldest

votes












Your Answer





StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48003%2fcontrolling-number-of-channels-in-weight-kernel-in-tensorflow%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Data Science Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48003%2fcontrolling-number-of-channels-in-weight-kernel-in-tensorflow%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

Luettelo Yhdysvaltain laivaston lentotukialuksista Lähteet | Navigointivalikko

Gary (muusikko) Sisällysluettelo Historia | Rockin' High | Lähteet | Aiheesta muualla | NavigointivalikkoInfobox OKTuomas "Gary" Keskinen Ancaran kitaristiksiProjekti Rockin' High