Skip to content

sonnet abstract module in tensorflow2  #271

@AI-lab-sh

Description

@AI-lab-sh

Hello friends

I want to use i3d model created by sonnet in tensorflow 2

these are my environment:
ubuntu 20
tensorflow 2.12
python 3.8

this is my i3d code:

`
from future import absolute_import

from future import division
from future import print_function
import sonnet as snt
import tensorflow as tf
class Unit3D(snt.AbstractModule):

`

but when I want to import it in tf2, I face the following error:
AttributeError: module 'sonnet' has no attribute 'AbstractModule'

which is related to this line:

class Unit3D(snt.AbstractModule):
>>> class MultiplyModule(snt.Module):
... def call(self, x):
... if not hasattr(self, 'w'):
... self.w = tf.Variable(2., name='w')
... return x * self.w

  >>> mod = MultiplyModule()
  >>> mod(1.)
  <tf.Tensor: ... numpy=2.0>

how to fix it ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions