如何用向量元素划分角膜3D张量的切片?

时间:2019-09-20 06:07:32

标签: python tensorflow keras

我必须执行张量运算,其中张量的每个切片都被矢量中的相应元素所除。例如,形状为(4,80,50)的张量K沿轴0具有4个形状为(80,50)的切片。 4个切片中的每个切片都必须用形状为(4,1)的矢量P的元素进行划分。 K [0,:,:] / p [0],K [1,::] / p [1]等。是否存在可以执行此操作的keras函数?

1 个答案:

答案 0 :(得分:1)

由于console.log(wrapper.instance().changeHandler() ComponentA { props: { array: { insert: [Function], move: [Function], pop: [Function], push: [Function], remove: [Function], removeAll: [Function], shift: [Function], splice: [Function], swap: [Function], unshift: [Function] }, anyTouched: false, asyncValidate: [Function], asyncValidating: false, blur: [Function], change: [Function], clearSubmit: [Function], destroy: [Function], dirty: false, dispatch: [Function: dispatch], error: undefined, form: 'campaign', handleSubmit: [Function], initialize: [Function], initialized: false, initialValues: undefined, invalid: false, pristine: true, reset: [Function], resetSection: [Function], submitting: false, submitFailed: false, submitSucceeded: false, touch: [Function], untouch: [Function], valid: true, warning: undefined, currentUser: { username: 'test', userId: 1 }, codes: { bitlyCompany: [] }, config: { classificationsPermissions: [Object] }, codeConfiguration: { status: 'In Progress' }, store: { getState: [Function: getState], getActions: [Function: getActions], dispatch: [Function: dispatch], clearActions: [Function: clearActions], subscribe: [Function: subscribe], replaceReducer: [Function: replaceReducer] }, pure: true, validate: [Function], triggerSubmit: undefined, autofill: [Function], clearFields: [Function], clearSubmitErrors: [Function], clearAsyncError: [Function], submit: [Function], storeSubscription: Subscription { store: [Object], parentSub: [Object], onStateChange: [Function: bound onStateChange], unsubscribe: [Function: unsubscribe], listeners: [Object] }, }, context: { router: undefined }, refs: {}, updater: Updater { _renderer: ReactShallowRenderer { _context: [Object], _element: [Object], _instance: [Circular], _newState: null, _rendered: [Object], _rendering: false, _forcedUpdate: false, _updater: [Circular], _dispatcher: [Object], _workInProgressHook: null, _firstWorkInProgressHook: null, _isReRender: false, _didScheduleRenderPhaseUpdate: false, _renderPhaseUpdates: null, _numberOfReRenders: 0 }, _callbacks: [] }, changeHandler: [Function], setState: [Function], } 的0轴尺寸相同,因此您需要在最后扩展K的尺寸。在tf2.0中,这是一个示例

P