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

Marja Vauras Lähteet | Aiheesta muualla | NavigointivalikkoMarja Vauras Turun yliopiston tutkimusportaalissaInfobox OKSuomalaisen Tiedeakatemian varsinaiset jäsenetKasvatustieteiden tiedekunnan dekaanit ja muu johtoMarja VaurasKoulutusvienti on kestävyys- ja ketteryyslaji (2.5.2017)laajentamallaWorldCat Identities0000 0001 0855 9405n86069603utb201588738523620927

Which is better: GPT or RelGAN for text generation?2019 Community Moderator ElectionWhat is the difference between TextGAN and LM for text generation?GANs (generative adversarial networks) possible for text as well?Generator loss not decreasing- text to image synthesisChoosing a right algorithm for template-based text generationHow should I format input and output for text generation with LSTMsGumbel Softmax vs Vanilla Softmax for GAN trainingWhich neural network to choose for classification from text/speech?NLP text autoencoder that generates text in poetic meterWhat is the interpretation of the expectation notation in the GAN formulation?What is the difference between TextGAN and LM for text generation?How to prepare the data for text generation task

Is this part of the description of the Archfey warlock's Misty Escape feature redundant?When is entropic ward considered “used”?How does the reaction timing work for Wrath of the Storm? Can it potentially prevent the damage from the triggering attack?Does the Dark Arts Archlich warlock patrons's Arcane Invisibility activate every time you cast a level 1+ spell?When attacking while invisible, when exactly does invisibility break?Can I cast Hellish Rebuke on my turn?Do I have to “pre-cast” a reaction spell in order for it to be triggered?What happens if a Player Misty Escapes into an Invisible CreatureCan a reaction interrupt multiattack?Does the Fiend-patron warlock's Hurl Through Hell feature dispel effects that require the target to be on the same plane as the caster?What are you allowed to do while using the Warlock's Eldritch Master feature?