tensor-house icon indicating copy to clipboard operation
tensor-house copied to clipboard

Input tensor

Open somum opened this issue 4 years ago • 0 comments

#image-artistic-style-similarity

After # compute styles when calling "style" facing an issue:

InvalidArgumentError: Must provide as many biases as the last dimension of the input tensor: [3] vs. [1,400,400,4] [Op:BiasAdd] name: style_model_7/BiasAdd/.

I found a reason initially if I run this:

compute styles

image_style_embeddings = {} for image_path in tqdm(image_paths): image_tensor = load_image(image_path) style = style_to_vec(image_to_style(image_tensor)) image_style_embeddings[ntpath.basename(image_path)] = style

Then for some reason, the shape remains [1,400,400,4] when the tensor is empty but after when tensor start to fill the shape changes to [1,400,400,3]

But if I run this:

compute styles

image_style_embeddings = {} for image_path in tqdm(image_paths): ->image_tensor = load_image(image_path) ->if (image_tensor.shape[3]!= 4): -> ->style = style_to_vec(image_to_style(image_tensor)) ->->image_style_embeddings[ntpath.basename(image_path)] = style

Its working fine is it ok to do?

Thanks in advance!

somum avatar Jan 15 '21 22:01 somum