在 Keras 中乘以大小 [batch] 和大小 [batch, features] 的张量

问题描述

基本上我有两个张量,我试图将两个张量相乘(一个只是大小 [batch](即每个批次具有单个值的张量),以及一个大小为 [batch,x,y,z ]) 使得批次中的每个 3D 张量都按其相应的值进行缩放

目前,我正在尝试以下方法,但我还没有找到有效的方法!:

enc_out1 = tf.math.multiply(enc_out1,w_int,name=None)
#enc_out1 has shape [batch,z],w_int has shape [batch]

非常感谢任何和所有帮助

解决方法

你可以重塑它。 这是一个例子

Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\site-packages\PyPDF2\pdf.py",line 1147,in getNumPages
  self.decrypt('')
File "C:\Program Files (x86)\Python38-32\lib\site-packages\PyPDF2\pdf.py",line 1987,in decrypt  
  return self._decrypt(password)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\PyPDF2\pdf.py",line 1996,in _decrypt 
  raise NotImplementedError("only algorithm code 1 and 2 are supported")
NotImplementedError: only algorithm code 1 and 2 are supported

During handling of the above exception,another exception occurred:

Traceback (most recent call last):
File "main.py",line 11,in <module>
  print(pdfReader.getNumPages())
File "C:\Program Files (x86)\Python38-32\lib\site-packages\PyPDF2\pdf.py",line 1150,in getNumPages
  raise utils.PdfReadError("File has not been decrypted")
PyPDF2.utils.PdfReadError: File has not been decrypted

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...