INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Returns a list of Action objects This actions can be used to check the droplet s status
def get_actions(self): """ Returns a list of Action objects This actions can be used to check the droplet's status """ answer = self.get_data("droplets/%s/actions/" % self.id, type=GET) actions = [] for action_dict in answer['actions']: action...
Returns a specific Action by its ID.
def get_action(self, action_id): """Returns a specific Action by its ID. Args: action_id (int): id of action """ return Action.get_object( api_token=self.token, action_id=action_id )
This method will return the snapshots/ images connected to that specific droplet.
def get_snapshots(self): """ This method will return the snapshots/images connected to that specific droplet. """ snapshots = list() for id in self.snapshot_ids: snapshot = Image() snapshot.id = id snapshot.token = self.token ...
Get a list of kernels available
def get_kernel_available(self): """ Get a list of kernels available """ kernels = list() data = self.get_data("droplets/%s/kernels/" % self.id) while True: for jsond in data[u'kernels']: kernel = Kernel(**jsond) kernel.toke...
Class method that will return a Domain object by ID.
def get_object(cls, api_token, domain_name): """ Class method that will return a Domain object by ID. """ domain = cls(token=api_token, name=domain_name) domain.load() return domain
Create new domain record. https:// developers. digitalocean. com/ #create - a - new - domain - record
def create_new_domain_record(self, *args, **kwargs): """ Create new domain record. https://developers.digitalocean.com/#create-a-new-domain-record Args: type: The record type (A, MX, CNAME, etc). name: The host name, alias, or service being de...
Create new doamin
def create(self): """ Create new doamin """ # URL https://api.digitalocean.com/v2/domains data = { "name": self.name, "ip_address": self.ip_address, } domain = self.get_data("domains", type=POST, params=data) return domain
Returns a list of Record objects
def get_records(self, params=None): """ Returns a list of Record objects """ if params is None: params = {} # URL https://api.digitalocean.com/v2/domains/[NAME]/records/ records = [] data = self.get_data("domains/%s/records/" % self.name, ...
Class method that will return an Account object.
def get_object(cls, api_token): """ Class method that will return an Account object. """ acct = cls(token=api_token) acct.load() return acct
Class method that will return a FloatingIP object by its IP.
def get_object(cls, api_token, ip): """ Class method that will return a FloatingIP object by its IP. Args: api_token: str - token ip: str - floating ip address """ floating_ip = cls(token=api_token, ip=ip) floating_ip.load() ...
Load the FloatingIP object from DigitalOcean.
def load(self): """ Load the FloatingIP object from DigitalOcean. Requires self.ip to be set. """ data = self.get_data('floating_ips/%s' % self.ip, type=GET) floating_ip = data['floating_ip'] # Setting the attribute values for attr in floating_ip...
Creates a FloatingIP and assigns it to a Droplet.
def create(self, *args, **kwargs): """ Creates a FloatingIP and assigns it to a Droplet. Note: Every argument and parameter given to this method will be assigned to the object. Args: droplet_id: int - droplet id """ data = self.ge...
Creates a FloatingIP in a region without assigning it to a specific Droplet.
def reserve(self, *args, **kwargs): """ Creates a FloatingIP in a region without assigning it to a specific Droplet. Note: Every argument and parameter given to this method will be assigned to the object. Args: region_slug: str - regi...
Assign a FloatingIP to a Droplet.
def assign(self, droplet_id): """ Assign a FloatingIP to a Droplet. Args: droplet_id: int - droplet id """ return self.get_data( "floating_ips/%s/actions/" % self.ip, type=POST, params={"type": "assign", "droplet_id": d...
Class method that will return a Firewall object by ID.
def get_object(cls, api_token, firewall_id): """ Class method that will return a Firewall object by ID. """ firewall = cls(token=api_token, id=firewall_id) firewall.load() return firewall
Add tags to this Firewall.
def add_tags(self, tags): """ Add tags to this Firewall. """ return self.get_data( "firewalls/%s/tags" % self.id, type=POST, params={"tags": tags} )
Remove tags from this Firewall.
def remove_tags(self, tags): """ Remove tags from this Firewall. """ return self.get_data( "firewalls/%s/tags" % self.id, type=DELETE, params={"tags": tags} )
Class method that will return a SSHKey object by ID.
def get_object(cls, api_token, ssh_key_id): """ Class method that will return a SSHKey object by ID. """ ssh_key = cls(token=api_token, id=ssh_key_id) ssh_key.load() return ssh_key
Load the SSHKey object from DigitalOcean.
def load(self): """ Load the SSHKey object from DigitalOcean. Requires either self.id or self.fingerprint to be set. """ identifier = None if self.id: identifier = self.id elif self.fingerprint is not None: identifier = self.finger...
This method will load a SSHKey object from DigitalOcean from a public_key. This method will avoid problems like uploading the same public_key twice.
def load_by_pub_key(self, public_key): """ This method will load a SSHKey object from DigitalOcean from a public_key. This method will avoid problems like uploading the same public_key twice. """ data = self.get_data("account/keys/") for jsoned in dat...
Create the SSH Key
def create(self): """ Create the SSH Key """ input_params = { "name": self.name, "public_key": self.public_key, } data = self.get_data("account/keys/", type=POST, params=input_params) if data: self.id = data['ssh_key']['id...
Edit the SSH Key
def edit(self): """ Edit the SSH Key """ input_params = { "name": self.name, "public_key": self.public_key, } data = self.get_data( "account/keys/%s" % self.id, type=PUT, params=input_params ) ...
This function returns a list of Region object.
def get_all_regions(self): """ This function returns a list of Region object. """ data = self.get_data("regions/") regions = list() for jsoned in data['regions']: region = Region(**jsoned) region.token = self.token regions.append(re...
This function returns a list of Droplet object.
def get_all_droplets(self, tag_name=None): """ This function returns a list of Droplet object. """ params = dict() if tag_name: params["tag_name"] = tag_name data = self.get_data("droplets/", params=params) droplets = list() for jsoned in...
Return a Droplet by its ID.
def get_droplet(self, droplet_id): """ Return a Droplet by its ID. """ return Droplet.get_object(api_token=self.token, droplet_id=droplet_id)
This function returns a list of Size object.
def get_all_sizes(self): """ This function returns a list of Size object. """ data = self.get_data("sizes/") sizes = list() for jsoned in data['sizes']: size = Size(**jsoned) size.token = self.token sizes.append(size) return...
This function returns a list of Image object.
def get_images(self, private=False, type=None): """ This function returns a list of Image object. """ params = {} if private: params['private'] = 'true' if type: params['type'] = type data = self.get_data("images/", params=params) ...
Return a Image by its ID/ Slug.
def get_image(self, image_id_or_slug): """ Return a Image by its ID/Slug. """ return Image.get_object( api_token=self.token, image_id_or_slug=image_id_or_slug, )
This function returns a list of Image objects representing public DigitalOcean images ( e. g. base distribution images and One - Click applications ).
def get_global_images(self): """ This function returns a list of Image objects representing public DigitalOcean images (e.g. base distribution images and 'One-Click' applications). """ data = self.get_images() images = list() for i in data: ...
This function returns a list of Domain object.
def get_all_domains(self): """ This function returns a list of Domain object. """ data = self.get_data("domains/") domains = list() for jsoned in data['domains']: domain = Domain(**jsoned) domain.token = self.token domains.append(do...
Return a Domain by its domain_name
def get_domain(self, domain_name): """ Return a Domain by its domain_name """ return Domain.get_object(api_token=self.token, domain_name=domain_name)
This function returns a list of SSHKey object.
def get_all_sshkeys(self): """ This function returns a list of SSHKey object. """ data = self.get_data("account/keys/") ssh_keys = list() for jsoned in data['ssh_keys']: ssh_key = SSHKey(**jsoned) ssh_key.token = self.token ssh_keys...
Return a SSHKey object by its ID.
def get_ssh_key(self, ssh_key_id): """ Return a SSHKey object by its ID. """ return SSHKey.get_object(api_token=self.token, ssh_key_id=ssh_key_id)
This method returns a list of all tags.
def get_all_tags(self): """ This method returns a list of all tags. """ data = self.get_data("tags") return [ Tag(token=self.token, **tag) for tag in data['tags'] ]
This function returns a list of FloatingIP objects.
def get_all_floating_ips(self): """ This function returns a list of FloatingIP objects. """ data = self.get_data("floating_ips") floating_ips = list() for jsoned in data['floating_ips']: floating_ip = FloatingIP(**jsoned) floating_ip.token = se...
Returns a of FloatingIP object by its IP address.
def get_floating_ip(self, ip): """ Returns a of FloatingIP object by its IP address. """ return FloatingIP.get_object(api_token=self.token, ip=ip)
Returns a list of Load Balancer objects.
def get_all_load_balancers(self): """ Returns a list of Load Balancer objects. """ data = self.get_data("load_balancers") load_balancers = list() for jsoned in data['load_balancers']: load_balancer = LoadBalancer(**jsoned) load_balancer.token ...
Returns a Load Balancer object by its ID.
def get_load_balancer(self, id): """ Returns a Load Balancer object by its ID. Args: id (str): Load Balancer ID """ return LoadBalancer.get_object(api_token=self.token, id=id)
Returns a Certificate object by its ID.
def get_certificate(self, id): """ Returns a Certificate object by its ID. Args: id (str): Certificate ID """ return Certificate.get_object(api_token=self.token, cert_id=id)
This function returns a list of Certificate objects.
def get_all_certificates(self): """ This function returns a list of Certificate objects. """ data = self.get_data("certificates") certificates = list() for jsoned in data['certificates']: cert = Certificate(**jsoned) cert.token = self.token ...
Return a Snapshot by its ID.
def get_snapshot(self, snapshot_id): """ Return a Snapshot by its ID. """ return Snapshot.get_object( api_token=self.token, snapshot_id=snapshot_id )
This method returns a list of all Snapshots.
def get_all_snapshots(self): """ This method returns a list of all Snapshots. """ data = self.get_data("snapshots/") return [ Snapshot(token=self.token, **snapshot) for snapshot in data['snapshots'] ]
This method returns a list of all Snapshots based on Droplets.
def get_droplet_snapshots(self): """ This method returns a list of all Snapshots based on Droplets. """ data = self.get_data("snapshots?resource_type=droplet") return [ Snapshot(token=self.token, **snapshot) for snapshot in data['snapshots'] ]
This method returns a list of all Snapshots based on volumes.
def get_volume_snapshots(self): """ This method returns a list of all Snapshots based on volumes. """ data = self.get_data("snapshots?resource_type=volume") return [ Snapshot(token=self.token, **snapshot) for snapshot in data['snapshots'] ]
This function returns a list of Volume objects.
def get_all_volumes(self, region=None): """ This function returns a list of Volume objects. """ if region: url = "volumes?region={}".format(region) else: url = "volumes" data = self.get_data(url) volumes = list() for jsoned in d...
Returns a Volume object by its ID.
def get_volume(self, volume_id): """ Returns a Volume object by its ID. """ return Volume.get_object(api_token=self.token, volume_id=volume_id)
This function returns a list of Firewall objects.
def get_all_firewalls(self): """ This function returns a list of Firewall objects. """ data = self.get_data("firewalls") firewalls = list() for jsoned in data['firewalls']: firewall = Firewall(**jsoned) firewall.token = self.token i...
Return a Firewall by its ID.
def get_firewall(self, firewall_id): """ Return a Firewall by its ID. """ return Firewall.get_object( api_token=self.token, firewall_id=firewall_id, )
Class method that will return a LoadBalancer object by its ID.
def get_object(cls, api_token, id): """ Class method that will return a LoadBalancer object by its ID. Args: api_token (str): DigitalOcean API token id (str): Load Balancer ID """ load_balancer = cls(token=api_token, id=id) load_balancer.load() ...
Loads updated attributues for a LoadBalancer object.
def load(self): """ Loads updated attributues for a LoadBalancer object. Requires self.id to be set. """ data = self.get_data('load_balancers/%s' % self.id, type=GET) load_balancer = data['load_balancer'] # Setting the attribute values for attr in load_b...
Creates a new LoadBalancer.
def create(self, *args, **kwargs): """ Creates a new LoadBalancer. Note: Every argument and parameter given to this method will be assigned to the object. Args: name (str): The Load Balancer's name region (str): The slug identifier for a DigitalOcean reg...
Save the LoadBalancer
def save(self): """ Save the LoadBalancer """ forwarding_rules = [rule.__dict__ for rule in self.forwarding_rules] data = { 'name': self.name, 'region': self.region['slug'], 'forwarding_rules': forwarding_rules, 'redirect_http_to_h...
Assign a LoadBalancer to a Droplet.
def add_droplets(self, droplet_ids): """ Assign a LoadBalancer to a Droplet. Args: droplet_ids (obj:`list` of `int`): A list of Droplet IDs """ return self.get_data( "load_balancers/%s/droplets/" % self.id, type=POST, params={"drop...
Unassign a LoadBalancer.
def remove_droplets(self, droplet_ids): """ Unassign a LoadBalancer. Args: droplet_ids (obj:`list` of `int`): A list of Droplet IDs """ return self.get_data( "load_balancers/%s/droplets/" % self.id, type=DELETE, params={"droplet_id...
Adds new forwarding rules to a LoadBalancer.
def add_forwarding_rules(self, forwarding_rules): """ Adds new forwarding rules to a LoadBalancer. Args: forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects """ rules_dict = [rule.__dict__ for rule in forwarding_rules] return self.get_data( ...
Removes existing forwarding rules from a LoadBalancer.
def remove_forwarding_rules(self, forwarding_rules): """ Removes existing forwarding rules from a LoadBalancer. Args: forwarding_rules (obj:`list`): A list of `ForwrdingRules` objects """ rules_dict = [rule.__dict__ for rule in forwarding_rules] return self....
Customized version of get_data to directly get the data without using the authentication method.
def get_data(self, url, headers=dict(), params=dict(), render_json=True): """ Customized version of get_data to directly get the data without using the authentication method. """ url = urljoin(self.end_point, url) response = requests.get(url, headers=headers, par...
Class method that will return a Record object by ID and the domain.
def get_object(cls, api_token, domain, record_id): """ Class method that will return a Record object by ID and the domain. """ record = cls(token=api_token, domain=domain, id=record_id) record.load() return record
Creates a new record for a domain.
def create(self): """ Creates a new record for a domain. Args: type (str): The type of the DNS record (e.g. A, CNAME, TXT). name (str): The host name, alias, or service being defined by the record. data (int): Variable data depending on record...
Destroy the record
def destroy(self): """ Destroy the record """ return self.get_data( "domains/%s/records/%s" % (self.domain, self.id), type=DELETE, )
Save existing record
def save(self): """ Save existing record """ data = { "type": self.type, "data": self.data, "name": self.name, "priority": self.priority, "port": self.port, "ttl": self.ttl, "weight": self.weight, ...
This method will perform the real request in this way we can customize only the output of the API call by using self. __call_api method. This method will return the request object.
def __perform_request(self, url, type=GET, params=None): """ This method will perform the real request, in this way we can customize only the "output" of the API call by using self.__call_api method. This method will return the request object. """ ...
Perform multiple calls in order to have a full list of elements when the API are paginated. ( content list is divided in more than one page )
def __deal_with_pagination(self, url, method, params, data): """ Perform multiple calls in order to have a full list of elements when the API are "paginated". (content list is divided in more than one page) """ all_data = data while data.get("links", {...
Checks if any timeout for the requests to DigitalOcean is required. To set a timeout use the REQUEST_TIMEOUT_ENV_VAR environment variable.
def get_timeout(self): """ Checks if any timeout for the requests to DigitalOcean is required. To set a timeout, use the REQUEST_TIMEOUT_ENV_VAR environment variable. """ timeout_str = os.environ.get(REQUEST_TIMEOUT_ENV_VAR) if timeout_str: ...
This method is a basic implementation of __call_api that checks errors too. In case of success the method will return True or the content of the response to the request.
def get_data(self, url, type=GET, params=None): """ This method is a basic implementation of __call_api that checks errors too. In case of success the method will return True or the content of the response to the request. Pagination is automatically detected and ...
Class method that will return an Volume object by ID.
def get_object(cls, api_token, volume_id): """ Class method that will return an Volume object by ID. """ volume = cls(token=api_token, id=volume_id) volume.load() return volume
Creates a Block Storage volume
def create_from_snapshot(self, *args, **kwargs): """ Creates a Block Storage volume Note: Every argument and parameter given to this method will be assigned to the object. Args: name: string - a name for the volume snapshot_id: string - unique identifier...
Attach a Volume to a Droplet.
def attach(self, droplet_id, region): """ Attach a Volume to a Droplet. Args: droplet_id: int - droplet id region: string - slug identifier for the region """ return self.get_data( "volumes/%s/actions/" % self.id, type=POST, ...
Detach a Volume to a Droplet.
def resize(self, size_gigabytes, region): """ Detach a Volume to a Droplet. Args: size_gigabytes: int - size of the Block Storage volume in GiB region: string - slug identifier for the region """ return self.get_data( "volumes/%s/actions/" % s...
Create a snapshot of the volume.
def snapshot(self, name): """ Create a snapshot of the volume. Args: name: string - a human-readable name for the snapshot """ return self.get_data( "volumes/%s/snapshots/" % self.id, type=POST, params={"name": name} )
Retrieve the list of snapshots that have been created from a volume.
def get_snapshots(self): """ Retrieve the list of snapshots that have been created from a volume. Args: """ data = self.get_data("volumes/%s/snapshots/" % self.id) snapshots = list() for jsond in data[u'snapshots']: snapshot = Snapshot(**jsond) ...
Class method that will return a Certificate object by its ID.
def get_object(cls, api_token, cert_id): """ Class method that will return a Certificate object by its ID. """ certificate = cls(token=api_token, id=cert_id) certificate.load() return certificate
Load the Certificate object from DigitalOcean.
def load(self): """ Load the Certificate object from DigitalOcean. Requires self.id to be set. """ data = self.get_data("certificates/%s" % self.id) certificate = data["certificate"] for attr in certificate.keys(): setattr(self, attr, certifi...
Create the Certificate
def create(self): """ Create the Certificate """ params = { "name": self.name, "type": self.type, "dns_names": self.dns_names, "private_key": self.private_key, "leaf_certificate": self.leaf_certificate, "certific...
Class method that will return an Image object by ID or slug.
def get_object(cls, api_token, image_id_or_slug): """ Class method that will return an Image object by ID or slug. This method is used to validate the type of the image. If it is a number, it will be considered as an Image ID, instead if it is a string, it will c...
Checks if the value provided is a string ( True ) or not integer ( False ) or something else ( None ).
def _is_string(value): """ Checks if the value provided is a string (True) or not integer (False) or something else (None). """ if type(value) in [type(u''), type('')]: return True elif type(value) in [int, type(2 ** 64)]: return False ...
Creates a new custom DigitalOcean Image from the Linux virtual machine image located at the provided url.
def create(self): """ Creates a new custom DigitalOcean Image from the Linux virtual machine image located at the provided `url`. """ params = {'name': self.name, 'region': self.region, 'url': self.url, 'distribution': self.di...
Load slug.
def load(self, use_slug=False): """ Load slug. Loads by id, or by slug if id is not present or use slug is True. """ identifier = None if use_slug or not self.id: identifier = self.slug else: identifier = self.id if not ide...
Transfer the image
def transfer(self, new_region_slug): """ Transfer the image """ return self.get_data( "images/%s/actions/" % self.id, type=POST, params={"type": "transfer", "region": new_region_slug} )
Rename an image
def rename(self, new_name): """ Rename an image """ return self.get_data( "images/%s" % self.id, type=PUT, params={"name": new_name} )
Convert convolution layer.
def convert_conv(params, w_name, scope_name, inputs, layers, weights, names): """ Convert convolution layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary...
Convert transposed convolution layer.
def convert_convtranspose(params, w_name, scope_name, inputs, layers, weights, names): """ Convert transposed convolution layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
Convert sum.
def convert_sum( params, w_name, scope_name, inputs, layers, weights, names ): """ Convert sum. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with ker...
Convert reduce_sum layer.
def convert_reduce_sum(params, w_name, scope_name, inputs, layers, weights, names): """ Convert reduce_sum layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dicti...
Convert concatenation.
def convert_concat(params, w_name, scope_name, inputs, layers, weights, names): """ Convert concatenation. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary w...
Convert slice operation.
def convert_slice(params, w_name, scope_name, inputs, layers, weights, names): """ Convert slice operation. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
Convert clip operation.
def convert_clip(params, w_name, scope_name, inputs, layers, weights, names): """ Convert clip operation. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary wi...
Convert elementwise addition.
def convert_elementwise_add( params, w_name, scope_name, inputs, layers, weights, names ): """ Convert elementwise addition. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
Convert elementwise multiplication.
def convert_elementwise_mul( params, w_name, scope_name, inputs, layers, weights, names ): """ Convert elementwise multiplication. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
Convert elementwise multiplication.
def convert_elementwise_div( params, w_name, scope_name, inputs, layers, weights, names ): """ Convert elementwise multiplication. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
Convert elementwise subtraction.
def convert_elementwise_sub( params, w_name, scope_name, inputs, layers, weights, names ): """ Convert elementwise subtraction. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs ...
Convert Linear.
def convert_gemm(params, w_name, scope_name, inputs, layers, weights, names): """ Convert Linear. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras...
Convert matmul layer.
def convert_matmul(params, w_name, scope_name, inputs, layers, weights, names): """ Convert matmul layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary wi...
Convert constant layer.
def convert_constant(params, w_name, scope_name, inputs, layers, weights, names): """ Convert constant layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionar...
Convert reshape ( view ).
def convert_flatten(params, w_name, scope_name, inputs, layers, weights, names): """ Convert reshape(view). Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...
Convert transpose layer.
def convert_transpose(params, w_name, scope_name, inputs, layers, weights, names): """ Convert transpose layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictiona...
Convert reshape layer.
def convert_reshape(params, w_name, scope_name, inputs, layers, weights, names): """ Convert reshape layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary w...
Convert squeeze operation.
def convert_squeeze(params, w_name, scope_name, inputs, layers, weights, names): """ Convert squeeze operation. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: diction...
Convert unsqueeze operation.
def convert_unsqueeze(params, w_name, scope_name, inputs, layers, weights, names): """ Convert unsqueeze operation. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dic...
Convert shape operation.
def convert_shape(params, w_name, scope_name, inputs, layers, weights, names): """ Convert shape operation. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary ...